http://stackoverflow.com/q/25417048
tagged with: wsdl
has body: THE SETUP I have a complex project that I'm trying to build using Maven. What follows is a simplified example of that project. The directory structure is as follows: main - The project has more than one 'ear', each of which contains more than one 'war' plus other supporting jars. Yet they share a common set of WSDL/XSD, as well as Java code. pom.xml - This is the main pom.xml file, I'll describe it in more detail below. common-code-one - the two 'ear' package have a body of code in common, it's just java code, no wsdl, no xsd, so no problem. wsdl - single package holding all the XSD and WSDL files, it has a pom.xml that simply packs it all up inside a jar file, for later use in sub-directories. ear-package-one common-code-two - Some of the XSD from 'wsdl' is unpacked here, and turned into code via jaxb2. As part of that, an episode file is generated. war-package-one - More of the XSD and WSDL files are unpacked here, and turned into code via jaxws. To avoid having duplicate code, I need the episode file from 'common-code-two', and I need the XSD/WSDL files from 'wsdl'. war-package-two - Different XSD/WSDL, but I still need the episode file from common-code-two, as well as the XSD/WSDL from 'wsdl'. ejb-package-one - Don't need anything from 'wsdl', but may need some of the code from 'common-code-two', without needing the episode file. ... ear-package-two common-code-two - Same problem, different XSD. ejb-package-two - Same problem, different code. war-package-three - Same problem, different XSD/WSDL. war-package-four - Same problem, different XSD/WSDL. Now, the main 'pom.xml' file. Following Maven's DRY principle, I've put both executions of the maven-dependency-plugin into the main pom.xml. The problem is that in some of the sub-packages above, I only want the 'unpack-schema' execution to run, in others I want both the 'unpack-schema' and 'unpack-common-binding' to run. Of course, for the ones that don't need either, I just don't add the dependency plugin to the bui…
type: Question
has title: How to choose which maven executions are run?
tagged with: maven
tagged with: xsd
tagged with: maven-dependency-plugin
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25417293
tagged with: java
accepted answer: http://stackoverflow.com/a/25417293
answer count: 1

http://stackoverflow.com/q/25512437
type: AnsweredQuestion
answer count: 2
upvote count: 0
tagged with: java
downvote count: 2
has body: Consider the following code snippet: Scanner in = new Scanner(. . .); . . . if (in.hasNext()) { throw new IOException("End of file expected"); } Two of the answers are: a. The program will display the message "End of file expected" if there is data left in the input when the if statement is executed. Incorrect b. The program will throw an exception if there is data left in the input when the if statement is executed. Correct I chose "a". Is this not true? Are both of these statements not true? Thank you.
possible better answer: http://stackoverflow.com/a/25512612
accepted answer: http://stackoverflow.com/a/25512618
has answer: http://stackoverflow.com/a/25512612
has answer: http://stackoverflow.com/a/25512618
favorite count: 0
type: Question
score: -2
has title: Java IOException error
has comment: http://stackoverflow.com/comment/39826879

http://stackoverflow.com/q/25530394
type: Question
tagged with: ejb
has answer: http://stackoverflow.com/a/25537376
type: UnansweredQuestion
tagged with: websphere
score: 0
tagged with: java
has body: I'm developing under IBM RAD 9 the application for WebSphere 8.5, using EJB 3 :( I've split the project to following maven modules: dto (only 'stupid' transfer objects) ejb (the business logic) web (the REST channels, build type is WAR) ear (well, build type is EAR) EJB module has empty beans.xml file in META-INF. There's a producer class there, that produces some my.ejb.HelperClass @ApplicationScoped public class MyHelperProducer { @Produces @ApplicationScoped public HelperClass produceGenWsClient() { .... } } The usage is quite trivial: @Inject private HelperClass helper; It was already functioning! After some changes in the code (involving refactoring of many fields in many classes, but not those involved!) Everything stopped to function. Now I get error messages like that: [8/27/14 16:33:38:960 CEST] 00000063 BeansDeployer E BeansDeployer deploy javax.enterprise.inject.UnsatisfiedResolutionException: Api type [my.ejb.HelperClass] is not found with the qualifiers Qualifiers: [@javax.enterprise.inject.Default()] for injection into Field Injection Point, field : private my.ejb.HelperClass my.web.MyChannel.helper, Bean Owner : [WSEjbBean [businessLocals=[my.web.MyChannel], ejbName=MyChannel1710565165,Name:null,WebBeans Type:ENTERPRISE,API Types:[java.lang.Object,my.web.MyChannel],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]] InjectionType : [class my.ejb.HelperClass] Annotated : [Annotated Field,Base Type : class my.ejb.HelperClass,Type Closures : [class my.ejb.HelperClass, class java.lang.Object],Annotations : [@javax.inject.Inject()],Java Member Name : helper] Qualifiers : @javax.enterprise.inject.Default() at org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:92) at org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:96) at org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:189) at org.apache.webbe…
answer count: 1
tagged with: jakarta-ee
tagged with: ibm-rad
has title: Websphere - bean produced by producer from other maven module stopped to be seen
has comment: http://stackoverflow.com/comment/39882723

http://stackoverflow.com/a/25401412
upvote count: 2
has comment: http://stackoverflow.com/comment/39622065
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39621432
has body: you can simply populate the tree using the tree model DefaultMutableTreeNode root = new DefaultMutableTreeNode(filename); DefaultTreeModel treeModel = new DefaultTreeModel(root); Enumeration enumeration = properties.keys(); while (enumeration.hasMoreElements()) { String key = (String) enumeration.nextElement(); String nodeObj = key+" : "+properties.get(key); treeModel.insertNodeInto(new DefaultMutableTreeNode(nodeObj), root, 0); } JTree tree = new JTree(treeModel); NOTE: the elements are not sorted... to do so, you need to push all keys into a list and sort that list List sortedList&lt;String&gt; = new ArrayList&lt;String&gt;(); Enumeration enumeration = properties.keys(); while (enumeration.hasMoreElements()) { String key = (String) enumeration.nextElement(); sortedList.add(key); } Collection.sort(sortedList); for(String key: sortedList){ String nodeObj = key+" : "+properties.get(key); // [...] same as above }
has comment: http://stackoverflow.com/comment/39622285
has comment: http://stackoverflow.com/comment/39622157
has comment: http://stackoverflow.com/comment/39621699
has comment: http://stackoverflow.com/comment/39621759
has comment: http://stackoverflow.com/comment/39620278
answers question: http://stackoverflow.com/q/25399983
has comment: http://stackoverflow.com/comment/39621908
accepted answer of: http://stackoverflow.com/q/25399983
has comment: http://stackoverflow.com/comment/39621869

http://stackoverflow.com/q/25452087
has comment: http://stackoverflow.com/comment/39713835
has title: Spring IoC: Inject a Map containing Bean names
has comment: http://stackoverflow.com/comment/39714862
type: Question
tagged with: java
has body: The following is legal Spring config: &lt;util:map id="beanMap"&gt; &lt;entry key="key1" value-ref="bean1"/&gt; &lt;entry key="key2" value-ref="bean2"/&gt; &lt;entry key="key3" value-ref="bean3"/&gt; &lt;/util:map&gt; &lt;bean id="usesBeanMap" class="..."&gt; &lt;constructor-arg ref="beanMap" /&gt; &lt;/bean&gt; I would like to externalise this map to a .properties file (or any other kind of file) for deployment config / environment reasons, for example: &lt;util:properties id="beanProperties" location="file:/bean-value.properties"/&gt; &lt;bean id="usesBeanProperties" class="..."&gt; &lt;constructor-arg ref="beanProperties" /&gt; &lt;/bean&gt; This doesn't work out of the box, as a Properties object is effectively a Map&lt;String, String&gt;, so this needs to be converted somehow, or use a way to tell Spring, that the values are in fact "value-ref" bean names. Is there an easy / recommended way to achieve this?
type: UnansweredQuestion
tagged with: spring
tagged with: dictionary
linked to: http://stackoverflow.com/q/25236748
tagged with: properties
tagged with: inversion-of-control
has comment: http://stackoverflow.com/comment/39713830
score: 0
has comment: http://stackoverflow.com/comment/39720726
answer count: 0
has comment: http://stackoverflow.com/comment/39713767

http://stackoverflow.com/comment/39797388
type: Comment
has text: why you throw your exceptions in main method? why do not you use try catch block?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25496699

http://stackoverflow.com/q/25496897
has answer: http://stackoverflow.com/a/25497000
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25497014
tagged with: switch-statement
type: Question
has title: Why does my sum suddenly decrease?
has answer: http://stackoverflow.com/a/25496971
accepted answer: http://stackoverflow.com/a/25496971
has body: I have a program that tracks the number of items and cost of the items that you place in a shopping bag and then prints out the number of items, total cost of the items, cost + tax, and average. When I run the program and I continue to add items it will calculate everything accurately, but then suddenly the total cost will drop down. ex: i add 2 items at 10 dollars each it prints: Items: 2 Total Cost: 20, but then I will add 1 item at 5 dollars and it will print: Items: 3 Total Cost: 15 rather than 25. I've tried running it multiple times. It seems like if I keep adding items at 10 dollars it is accurate, but if I change it up, the total cost decreases. It seems some what random as far as when the value decreases. I thought maybe there was some issue with using float, but I can't find anything to verify that. Here is the shopping bag class public class ShoppingBag { public float taxRate; public int items; public float cost; public float average; public float totalCost; public float finalCost; public ShoppingBag(float taxRate) { this.taxRate = taxRate; } public void place(int newitems, float newcost) { items = newitems; cost = newcost; cost = items * cost; } public int getItems() { return items; } public float getCost() { return cost; } public float getTotal() { finalCost = cost + (cost * taxRate); return finalCost; } public float getAverage() { average = finalCost/items; return average; } @Override public String toString() { return("Items: " + items + " Cost: " + cost + " Final cost: " + finalCost + " Average cost: " + average); } } Here is my main program import java.util.Scanner; public class ShoppingBagTracker { public static void main(String[] args) { Scanner in = new Scanner(System.in); float taxRate, cost; int items, newItems, choice; String receipt; String menu = ("1. Add items" + "2. Get receipt" + "3. Exit"); System.out.print("Enter the sales tax rate: "); taxRate = in.nextFloat(); ShoppingBag myBag = new ShoppingBag(taxRate); items = 0; do{ System.out.prin…
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25497014

http://stackoverflow.com/a/25507325
downvote count: 0
upvote count: 1
has body: Yes, it will work, you can see a SpringTest with hibernate here. You need a constructor with no arguments to work with JPA, this constructor don't need to be public, it can be protected. Also, your entities need a field annotated with @Id. If your interfaces provides a @Id getter method, you need to put your annotations (@OneToMany, etc), in the getters methods of your concrete classes. If you execute the test, you will see the result: Hibernate: call next value for man_seq Hibernate: insert into Test25504340$DefaultAccount (manager_id, password, email) values (?, ?, ?) Hibernate: insert into Test25504340$DefaultAccount (manager_id, password, email) values (?, ?, ?) Hibernate: insert into Test25504340$DefaultAccount (manager_id, password, email) values (?, ?, ?) Hibernate: insert into Test25504340$DefaultManager (managerAccount_email, id) values (?, ?) Hibernate: update Test25504340$DefaultAccount set manager_id=?, password=? where email=? Where: First, get the sequence to insert the manager (I add a attribute Long id to DefaultManager). It will add the three accounts referencing the Manager (Account#manager -> Manager#id). Insert the Manager Update the references of the Manager#Account to target the Account one (Manager#manageAccount -> Account#email). You can change the order of the calls (persirst first the manager for example), and the result will be different sequence of inserts with the same final result.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25504340

http://stackoverflow.com/a/25471448
answers question: http://stackoverflow.com/q/25470614
has body: If you're using swing components such as JFrame for your main window, you must enable the functionality that lets the [X] close button exit the application. This is done through: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
type: Answer
score: 0

http://stackoverflow.com/comment/39806848
comment on: http://stackoverflow.com/a/25501648
score: 0
type: Comment
has text: If a value is found to be null, it will break out of loop, and hence will not execute statement `System.out.println(i + "=" + arr[i]);` for further values, Which wont print the entire array (or expected output of the OP with i=1 & i=2 ). Also you are assigning `a` to `arr[i]` and later printing `System.out.println(i + "= null");` which will give value of null although now its value has been set to `a`
type: AnswerComment

http://stackoverflow.com/a/36677731
type: Answer
has body: This is the answer to your specific problem. Under the security tab in your Java Control Panel > Edit Site List > http://www.topcoder.com > You will be prompted that an unsecure address is dangerous > Proceed anyway. > Program It has to be that exact web address for it to work because that it was the check runs through.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25514571
downvote count: 0

http://stackoverflow.com/q/25533363
has title: How to add two integer values as year and month to a date variable?
has comment: http://stackoverflow.com/comment/39864586
has answer: http://stackoverflow.com/a/25533443
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25533407
has comment: http://stackoverflow.com/comment/39864523
has body: I am using NetBeans IDE 8.0 beta. I have 2 integers with values obtained from a database table. int year, month; try{ string sql = "select * from item where item_id = i001"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); rs.next(); year = Integer.parseInt(rs.getString("warr_years")); month = Integer.parseInt(rs.getString("warr_months")); } catch(SQLException e){ } And I have a String variable which holds the current date. DateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd"); Date date = new Date(); String d = dateFormat.format(date); Now I need to add the years and months to the date. Can anyone help me with this?
possible better answer: http://stackoverflow.com/a/25533443
tagged with: date
type: AnsweredQuestion
tagged with: netbeans
score: 3
answer count: 2
accepted answer: http://stackoverflow.com/a/25533407
upvote count: 3
tagged with: sql
tagged with: java
downvote count: 0

http://stackoverflow.com/comment/39889806
comment on: http://stackoverflow.com/q/25547354
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [How to keep/exclude a particular package path when using proguard?](http://stackoverflow.com/questions/4830474/how-to-keep-exclude-a-particular-package-path-when-using-proguard)

http://stackoverflow.com/q/25437239
has comment: http://stackoverflow.com/comment/39692972
type: UnansweredQuestion
answer count: 1
has body: I tried to launch a very simple project app on Eclipse (it runs OK on my mobile cellphone) but I get the console message "Waiting for HOME('android.process.acore') to be launched". I have tried multiple time and waited long periods of time (in excess of 30 minutes) with no launch. Over the past 3 days I have read and tried various things that I read on Stackoverflow but I'm still stuck. I reinstalled Java, Java JDK, Eclipse ADT and Android SDK with no progress. My project consists of 3 cases that basically transfer between each other to display a video file. The logcat message when I first get the "Waiting for HOME.." message is: 08-21 21:47:15.610: I/dalvikvm(53): threadid=1: recursive native library load attempt (/system/lib/libmedia_jni.so) 08-21 21:47:15.620: I/dalvikvm(53): threadid=1: recursive native library load attempt (/system/lib/libmedia_jni.so) 08-21 21:47:15.720: D/dalvikvm(53): GC_EXPLICIT freed 9K, 2% free 851K/864K, paused 28ms+3ms, total 93ms 08-21 21:47:15.960: V/NatController(50): runCmd(/system/bin/iptables -F natctrl_FORWARD) res=0 08-21 21:47:16.130: V/NatController(50): runCmd(/system/bin/iptables -A natctrl_FORWARD -j DROP) res=0 08-21 21:47:16.310: V/NatController(50): runCmd(/system/bin/iptables -t nat -F natctrl_nat_POSTROUTING) res=0 08-21 21:47:16.340: E/logwrapper(276): executing /system/bin/ip failed: No such file or directory 08-21 21:47:16.360: V/NatController(50): runCmd(/system/bin/ip rule flush) res=255 08-21 21:47:16.380: E/logwrapper(277): executing /system/bin/ip failed: No such file or directory 08-21 21:47:16.400: V/NatController(50): runCmd(/system/bin/ip -6 rule flush) res=255 08-21 21:47:16.410: E/logwrapper(278): executing /system/bin/ip failed: No such file or directory 08-21 21:47:16.440: V/NatController(50): runCmd(/system/bin/ip rule add from all lookup default prio 32767) res=255 I am new to Android/Java/Eclipse and have been making progress in learning to program Android/Java apps. I would appreciate any help in re…
score: 0
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39693100
has title: Android (Eclipse) - Waiting for HOME ('android.process.acore') to be launched
tagged with: eclipse
has answer: http://stackoverflow.com/a/25437305
type: Question

http://stackoverflow.com/a/25501127
accepted answer of: http://stackoverflow.com/q/25490396
has body: Should be fixed here: https://github.com/spring-projects/spring-boot/commit/95d65c2ff5ff9cbed7cdcb479618dc8f7ee9c39c (i.e. in 1.1.6).
answers question: http://stackoverflow.com/q/25490396
has comment: http://stackoverflow.com/comment/39817813
type: AcceptedAnswer
type: Answer
score: 0

http://stackoverflow.com/q/25532955
has answer: http://stackoverflow.com/a/25551837
score: 2
tagged with: sql
tagged with: java
has body: I create two tables with relationship between them with UCanAccess. But it doesnt create the relationship. Why? What is wrong? How can i solve this problem? statement.execute("CREATE TABLE example1 (ExId LONG PRIMARY KEY, Title TEXT) "); statement.execute("CREATE TABLE example2 (Id COUNTER PRIMARY KEY," + " ExId LONG REFERENCES example1(ExId), Description TEXT)");
downvote count: 0
answer count: 1
tagged with: ms-access
favorite count: 0
type: Question
upvote count: 2
has title: How to create relationship between two tables with UCanAccess?
tagged with: ucanaccess
accepted answer: http://stackoverflow.com/a/25551837
type: AnsweredQuestion

http://stackoverflow.com/comment/39790744
has text: You have another error: `NetworkOnMainThreadException` stackoverflow this question
type: Comment
comment on: http://stackoverflow.com/q/25493166
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39853853
score: 1
type: Comment
type: QuestionComment
has text: Are you sure `redirectSystemStreams()` is called on all systems? Do you get any hint on what could be wrong - exceptions, log messages etc.? Do the JVM versions differ or is it the same on every system?
comment on: http://stackoverflow.com/q/25527244

http://stackoverflow.com/q/25540892
type: Question
has answer: http://stackoverflow.com/a/29207378
has title: java.sql.SQLException: You cannot commit during a managed transaction
answer count: 2
upvote count: 2
type: UnansweredQuestion
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/37291865
has body: In jboss 7, I have below config jdbc:oracle:thin:@erptstdb.sc.kaka.com:14100:ERPTST XAOracleJDBCDriver 10 20 true apps apps oracle.jdbc.driver.OracleDriver In orther class, I've method to get the connection for datasource public static Connection getNonXAConnection() { try { InitialContext context = new InitialContext(); DataSource dataSource = (DataSource)context.lookup(JNDILookup.PURE_CONNECTION_JNDI); return dataSource.getConnection(); } catch (Exception e) { e.printStackTrace(); logger.fatal(e.getMessage(), e.getCause()); } return null; } The error occur when I commit this connection java.sql.SQLException: You cannot commit during a managed transaction! at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:981) at org.jboss.jca.adapters.jdbc.WrappedConnection.commit(WrappedConnection.java:757) I just like to get connection and execute some stored procedure, and finnaly commit this connection. Please help me
downvote count: 0
tagged with: java
tagged with: datasource
tagged with: jboss

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

http://stackoverflow.com/comment/39780107
type: QuestionComment
has text: From `stackTrace` it looks as this line is faulty: `ResponseEntity<K> response = mRestTemplate.postForEntity(mUri, requestEntity, mResponseType);` Is there a chance that some other `thread` is working on the same params?
score: 0
comment on: http://stackoverflow.com/q/25487655
type: Comment

http://stackoverflow.com/comment/45791908
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25484180
has text: @majkel Please give an answer.
type: Comment

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

http://stackoverflow.com/comment/39840493
comment on: http://stackoverflow.com/q/25520007
type: Comment
type: QuestionComment
score: 0
has text: Are you asking how to get the `th` in `25th`? Or the `rd` in `3rd` or the `nd` in `2nd`?

http://stackoverflow.com/q/25393089
tagged with: swing
score: 2
has comment: http://stackoverflow.com/comment/39642203
tagged with: java
answer count: 1
tagged with: splash-screen
has title: Custom splash screen using JWindow/JPanel doesn't load image correctly when attempting to display it a second time
favorite count: 0
type: Question
upvote count: 2
has body: Thank you in advance for any attempts at trying to help me figure this one out. I've searched all over stack and google and haven't been able to find anything similar to the problem I am having. I am designing a small program using NetBeans that switches between multiple frames login screen &gt; settings screen &gt; main screen My program can take a while in-between frames to load the next one due to a large amount of frame initialization code. To prevent it from looking like the program is unresponsive. I wrote code which displays an intermediary splash screen JWindow which performs all the initialization for the next frame. I realize that there is a splash screen class, but I could not get it to work as desired, this custom implementation of mine does almost everything I need except when I attempt to display the splash screen a second time, during a single program run, the image does not show up on the JWindow. So run program &gt; splash screen (works) &gt; login &gt; splash screen (image does not load) &gt; settings. Here is a sample clip of code which displays the splash screen JWindow: public class Splash extends JPanel { private static Calendar date; private static long startTime; private static final long MAX_TIME = 3000l; public static final int LOAD_LOGIN = 0; public static final int LOAD_SETTINGS = 1; public static JWindow win; private final ImageIcon img; public Splash() { date = Calendar.getInstance(TimeZone.getTimeZone("EST"), Locale.ENGLISH); img = new ImageIcon("loader.gif"); startTime = date.getTimeInMillis(); this.setSize(300, 300); win = new JWindow(); win.setSize(300, 300); win.getContentPane().add(this); Login.centerWindow(win); // method from login class that centers window win.setVisible(true); } public void runSplash(int flag) { if (flag == LOAD_LOGIN) firstRunCheck(); else { initSettings(); } long currTime = date.getTimeInMillis(); // holds splash display for at least 3 secs while ((currTime - startTime) &lt; MAX_TIME) { currTime = System.cur…
has comment: http://stackoverflow.com/comment/39636321
linked to: http://stackoverflow.com/q/9554636
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25393445
downvote count: 0

http://stackoverflow.com/comment/39614243
comment on: http://stackoverflow.com/q/25398452
has text: Take a look at this: http://stackoverflow.com/questions/14891717/custom-exception-class-extends-from-exception-or-thowable or possibly even this: http://stackoverflow.com/questions/498217/when-should-throwable-be-used-instead-of-new-exception
type: Comment
score: 4
type: QuestionComment

http://stackoverflow.com/comment/39837415
type: AnswerComment
score: 0
has text: Defiantly a rabbit trail this one. I'll see what I can do to trace this out. Thank you MadProgrammer
type: Comment
comment on: http://stackoverflow.com/a/25517392

http://stackoverflow.com/a/25446618
has comment: http://stackoverflow.com/comment/39780523
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25445918
score: 1
type: Answer
has body: I see now that you are asking a slightly different question than I had originally thought. I will leave my other answer up though, since it explains why this is a problem. Since you are only dealing with Strings, Booleans, and Integers you could do what you are asking by only storing Strings in your Map and converting to the proper type later. Map&lt;String, String&gt; m = new HashMap&lt;&gt;(); m.put("bool", "true"); m.put("int", "1"); Integer i = Integer(m.get("int")); Boolean b = Boolean(m.get("bool")); This would be pseudo safe, but you would have to track the types for the values somewhere else in your code. Probably the best solution would be to use three Maps, one for each type. Map&lt;String, String&gt; stringMap; Map&lt;String, Integer&gt; intMap; Map&lt;String, Boolean&gt; boolMap; There is really no harm in having three maps, in general. For reasons why you can't use one map cleanly, see my other answer on this question.
accepted answer of: http://stackoverflow.com/q/25445918

http://stackoverflow.com/q/25427493
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39668171
tagged with: spring
has comment: http://stackoverflow.com/comment/39668579
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/39668840
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25427700
has comment: http://stackoverflow.com/comment/39667949
score: 0
has body: I am new to Maven, Spring and Hibernate. I have an application deployed on tomcat server, getting this exception. javax.servlet.ServletException: Servlet.init() for servlet dispatcher 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:314) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Unknown Source) with Root Cause org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homeController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.beingjavaguys.service.UserService com.beingjavaguys.controller.HomeController.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.beingjavaguys.dao.UserDao com.beingjavaguys.service.UserServiceImpl.userDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:…
has title: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.AnnotationConfiguration
tagged with: maven

http://stackoverflow.com/comment/39662300
comment on: http://stackoverflow.com/a/25423635
score: 0
type: AnswerComment
has text: Thank you very much. This solved the problem. I'll do my best to use your suggestion.
type: Comment

http://stackoverflow.com/comment/39648494
type: Comment
has text: user Arrays.copyOf() to have deep copy and I have to override colne() as well?
type: AnswerComment
comment on: http://stackoverflow.com/a/25416597
score: 0

jscrollpane
tags question: http://stackoverflow.com/q/25391798
tag name: jscrollpane
tags question: http://stackoverflow.com/q/25404056
tags question: http://stackoverflow.com/q/25530004
type: Tag
tags question: http://stackoverflow.com/q/25535330
tags question: http://stackoverflow.com/q/25504854

http://stackoverflow.com/a/25416624
score: 5
has comment: http://stackoverflow.com/comment/39648636
has comment: http://stackoverflow.com/comment/39648643
answers question: http://stackoverflow.com/q/25416607
type: Answer
has comment: http://stackoverflow.com/comment/39648685
has comment: http://stackoverflow.com/comment/39648653
has comment: http://stackoverflow.com/comment/39648591
has body: Start by making sure you have included the import javax.swing.JOptionPane; statement within your import portion of your code. Next, try using JOptionPane.showMessageDialog(null, "Window text."); instead. For example... import javax.swing.JOptionPane; public class TestDialog { public static void main(String[] args) { JOptionPane.showMessageDialog(null, "Window text."); } } Take a closer look at How to Make Dialogs for more details. You should also consult the JavaDocs when in doubt...
has comment: http://stackoverflow.com/comment/39648550
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39648825
accepted answer of: http://stackoverflow.com/q/25416607
has comment: http://stackoverflow.com/comment/39648605
upvote count: 5

http://stackoverflow.com/comment/54171105
type: AnswerComment
comment on: http://stackoverflow.com/a/25417505
score: 0
type: Comment
has text: actually, this might be a javac bug; and the spec is probably bad too. see the very last example in http://stackoverflow.com/a/33182091

http://stackoverflow.com/comment/39743878
type: Comment
score: 0
has text: Do you get "Unfortuanly <Your App> Has Stopped"?
type: QuestionComment
comment on: http://stackoverflow.com/q/25467703

http://stackoverflow.com/comment/39835280
type: Comment
comment on: http://stackoverflow.com/a/25498160
type: AnswerComment
has text: I like the way you think. +1 for finding a variant solution.
score: 1

http://stackoverflow.com/q/25537165
type: UnansweredQuestion
answer count: 1
has title: HashMap's KeySet, EntrySet, and values are null while table is not empty
has answer: http://stackoverflow.com/a/25537255
tagged with: collections
score: 4
has comment: http://stackoverflow.com/comment/39872029
tagged with: keyset
has comment: http://stackoverflow.com/comment/39872458
has comment: http://stackoverflow.com/comment/39872253
downvote count: 0
has body: I'm reading a data.ser file to fill some HashMaps with saved data. Although the Map has the values I'm supposed to have, the KeySet, EntrySet, and values are all null. for example, Hashmap "Employees" looks like this when I inspect it in debug mode: Can someone help me figure out what's wrong with it? How is that situation even possible? An example for a null value returned although the map contains a value (Employee) with the key (ID) im searching:
has comment: http://stackoverflow.com/comment/39872187
upvote count: 4
tagged with: eclipse
tagged with: java
has comment: http://stackoverflow.com/comment/39872135
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39872181
tagged with: hashmap

http://stackoverflow.com/comment/39893935
type: Comment
type: QuestionComment
has text: It is `tar zxvf jdk-8u20-linux-x64.tar.gz`, without the starting percent and with the correct version
comment on: http://stackoverflow.com/q/25549492
score: 1

http://stackoverflow.com/comment/39869796
has text: Yes, I have tried that already. However, the problem is that my solution overrides ObjectFactory, which is generated from each WSDL file. Each ObjectFactory is more or less unique for each WSDL file.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25515024
score: 1

http://stackoverflow.com/q/25490092
answer count: 1
has title: Android SQLite Colunm not found error
has answer: http://stackoverflow.com/a/25490115
type: AnsweredQuestion
score: 0
has body: Im trying to store data from some editTexts on a local android database and then eventually show it on a listview, but right now Im getting an error that says a column doesnt exist, I was following a tutorial on android hive so some of the variable names might look weird, but everything should be accurate. StackTrace 2038-12038/com.example.adrian.legioncheck_in E/SQLiteLog﹕ (1) table contacts has no column named Longitude 08-25 12:12:19.121 12038-12038/com.example.adrian.legioncheck_in E/SQLiteDatabase﹕ Error inserting Latitude=-85 Longitude=50 POnumber=255902 android.database.sqlite.SQLiteException: table contacts has no column named Longitude (code 1): , while compiling: INSERT INTO contacts(Latitude,Longitude,POnumber) VALUES (?,?,?) at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:923) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:534) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58) at android.database.sqlite.SQLiteStatement.&lt;init&gt;(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1523) at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1395) at com.example.adrian.legioncheck_in.DatabaseHandler.addContact(DatabaseHandler.java:67) at com.example.adrian.legioncheck_in.MapsActivity.SaveAction(MapsActivity.java:67) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at android.view.View$1.onClick(View.java:3850) at android.view.View.performClick(View.java:4470) at android.view.View$PerformClick.run(View.java:18593) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:157) at android.app.A…
tagged with: android
tagged with: java
tagged with: sqlite
type: Question
accepted answer: http://stackoverflow.com/a/25490115
linked to: http://stackoverflow.com/q/21881992

http://stackoverflow.com/q/25483023
has title: A regex to specify that the length of data should be either 12 or 14 but not 13
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/25483250
tagged with: java
has body: My regex requirement is the length of data should be either 12 or 14 but not 13. Accordingly I created regex expression as ^[0-9]{12,14}$ . It doesn't work.
tagged with: regex
has answer: http://stackoverflow.com/a/25483045
type: Question
tagged with: regex-lookarounds
score: 0
accepted answer: http://stackoverflow.com/a/25483044
possible better answer: http://stackoverflow.com/a/25483045
has answer: http://stackoverflow.com/a/25483044
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/139848723

http://stackoverflow.com/q/25549820
score: 0
has comment: http://stackoverflow.com/comment/39895958
type: UnansweredQuestion
answer count: 1
has title: Java Regex Capturing Groups for {X}
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25552772
tagged with: regex
has comment: http://stackoverflow.com/comment/39894708
linked to: http://stackoverflow.com/q/6939526
has body: I have a regex with a character sequence. I want the sequences parts into groups. Pattern e_1394Pattern = Pattern .compile("\\dR\\|\\d\\|(((([^\\|]))*\\|){11})"); String resultLine = "\4R|1|^^^02^Myo^1021406330|25.6^F|ng/mL||N||F||Administrator||20140318215839|"; This pattern works fine, but I need the groups of the following Part (((([^\\|]))*\\|){11}). Is this possible using a short regex? This is no option: \\dR\\|\\d\\|((([^\\|]))*\\|) ((([^\\|]))*\\|) ((([^\\|]))*\\|) ((([^\\|]))*\\|)....
tagged with: capturing-group

http://stackoverflow.com/a/41723855
downvote count: 1
has body: Below example should help you. private void batteryLevel() { BroadcastReceiver batteryLevelReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { context.unregisterReceiver(this); int rawlevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1); float level = -1; if (rawlevel &gt;= 0 &amp;&amp; scale &gt; 0) { level = (rawlevel * 100) / scale; } //batterLevel.setText("Battery Level Remaining: " + level + "%"); animate(pgbTablet, null,level, 10000); animate(pgbCase, null, level, 10000); tvTblCharging.setText(""+(int)Math.ceil(level)); tvCaseCharging.setText(""+(int)Math.ceil(level)); } }; IntentFilter batteryLevelFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); getContext().registerReceiver(batteryLevelReceiver, batteryLevelFilter); }
upvote count: 0
type: Answer
score: -1
answers question: http://stackoverflow.com/q/25468380

http://stackoverflow.com/comment/39782803
type: Comment
type: AnswerComment
score: 0
has text: Thanks for the answer. I don't need to store whole files. I need to insert data from XML to a stored XML. In this case, Streams is the correct choice? Because checking on Stackoverflow, i found a similar question where they were speaking about using SQLite database.
comment on: http://stackoverflow.com/a/25488615

http://stackoverflow.com/comment/39739048
comment on: http://stackoverflow.com/a/25465006
type: AnswerComment
score: 0
type: Comment
has text: Yes, I know but how to get this data: `saved.getGroup().getName()` from my service method `saveProbe(Probe probe)`. As You can see in test method I filled all necessary data before saving.

http://stackoverflow.com/comment/39752800
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25472584
score: 1
has text: What, in your mind, does "find the program flow" mean? The complexity of program flow is on the same order as the complexity of the source code, so to get any benefit beyond rewording source code you would need to introduce some lossy transformation rules which extract one aspect or another from the it.

http://stackoverflow.com/a/25486913
has comment: http://stackoverflow.com/comment/39778509
answers question: http://stackoverflow.com/q/25486800
score: 0
has body: Your class Strat apparently starts class Strat implements Strat&lt;Map&gt; Obviously you cannot have a class that implements itself (since that's an interface; it appears that you have a name collision). Further it can't be generic if it isn't declared as having a parameter. Since you have a generic interface in a different package (per your comment, yes it is in different package) you can explicitly use the full package to the interface - for example, package com.example.interface; // A generic Strat interface interface Strat&lt;T&gt; { } Then the to implement it (you should probably pick a more descriptive name - maybe IStrat&lt;T&gt;) - package com.example.impl; class Strat implements com.example.interface.Strat&lt;Map&gt; { } or using IStrat class Strat implements IStrat&lt;Map&gt; { }
has comment: http://stackoverflow.com/comment/39778502
has comment: http://stackoverflow.com/comment/39778432
type: Answer

http://stackoverflow.com/q/25522063
type: UnansweredQuestion
downvote count: 0
has body: I am using Hibernate Search Along with Lucene to implement full text search on my data base. I want to know that do hibernate search query or lucene query return top ranked and the most relevant results? Documentation says: Apache Lucene provides a very flexible and powerful way to sort results. While the default sorting (by relevance) is appropriate most of the time Link: http://docs.jboss.org/hibernate/search/4.2/reference/en-US/html_single/#search-query Section: 5.1.3.3. Sorting But I am very confused with the results as they are always arranged with the IDs of the objects. I just need the top 100 most relevant records.
upvote count: 1
has answer: http://stackoverflow.com/a/25524361
tagged with: lucene
has title: Hibernate Search Result Ranking
has answer: http://stackoverflow.com/a/25566645
has comment: http://stackoverflow.com/comment/39892411
score: 1
tagged with: java
favorite count: 0
type: Question
tagged with: hibernate-search
answer count: 2

http://stackoverflow.com/comment/39809035
comment on: http://stackoverflow.com/q/25503075
score: 0
type: Comment
type: QuestionComment
has text: Your exception is caused by a bug in SQLiteTableModel. That's the code you should post.

http://stackoverflow.com/comment/39647353
comment on: http://stackoverflow.com/q/25414060
score: 1
has text: Look at it this way...you have to repaint the screen anyway. The `JTable` has been optimised to paint (reasonably) quick and it would cause, generally, less havoc across the container hierarchy, then switching the physical tables out might. Besides, unless were talking tens of thousands of rows, I doubt you'd notice the difference...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39792793
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25493948
has text: this represents the container, in this case. I will, if I can recreate the error.

http://stackoverflow.com/comment/39689608
type: QuestionComment
comment on: http://stackoverflow.com/q/25438681
has text: @ErwinBolwidt To be clear, what I mean with "the value in myPath" is the char array `value` inside the `String` object. I was thinking this char array could be `null` yet while the String object is not `null` already due to reordering of instructions.
score: 0
type: Comment

http://stackoverflow.com/a/25545838
has comment: http://stackoverflow.com/comment/39893186
has body: I'd go with a PreparedStatement PreparedStatement s = connection.prepareStatement("INSERT INTO users (name,city,salary) VALUES (?, ?, ?)"); s.setString(1, name); s.setString(2, city); s.setString(3, salary); boolean res = s.execute(); This approach is a bit better, quoting will be automatically managed and will prevent simple SQL Injection.
type: Answer
answers question: http://stackoverflow.com/q/25545728
score: 2
has comment: http://stackoverflow.com/comment/39983241
upvote count: 2
downvote count: 0

http://stackoverflow.com/a/25413829
type: Answer
answers question: http://stackoverflow.com/q/25413758
has body: It returns true because you are asking mysql to create the database only if it exists, so, if it exists there is no error, it just does not create it. What you can do is try to create it and, if it fails, check that the reason is that the database alreyady existed. try { statement = connection.createStatement(); String sql = "CREATE DATABASE DBNAME"; //To delete database: sql = "DROP DATABASE DBNAME"; statement.executeUpdate(sql); System.out.println("Database created!"); } catch (SQLException sqlException) { if (sqlException.getErrorCode() == 1007) { // Database already exists error System.out.println(sqlException.getMessage()); } else { // Some other problems, e.g. Server down, no permission, etc sqlException.printStackTrace(); } } catch (ClassNotFoundException e) { // No driver class found! }
score: 0

http://stackoverflow.com/q/25528837
has comment: http://stackoverflow.com/comment/39877245
has comment: http://stackoverflow.com/comment/39880299
score: 2
has comment: http://stackoverflow.com/comment/39914942
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39868018
tagged with: java
downvote count: 0
has body: I tried to view a class file using Gel and i tried opening the same file in eclipse using jad eclipse it has got compiled to a different package i.e.., shows a different package structure. My question here is, does the package gets changed when we use different De-compiler's. example:- Gel :- package directoryutility; eclipse:- package multidirutility;
has comment: http://stackoverflow.com/comment/39879667
favorite count: 0
has title: Java Decompiler - Shows different package structure
has comment: http://stackoverflow.com/comment/39860330
type: Question
has comment: http://stackoverflow.com/comment/39885215
type: UnansweredQuestion
tagged with: package
tagged with: decompiler
tagged with: eclipse

http://stackoverflow.com/comment/39785983
type: QuestionComment
has text: @chiastic-security Well, that might depend on how *restrictive* the SecurityManager ultimately is, I/O completely forbidden? Thread creation forbidden? And what about places where you can "add" something to the JDK, e.g. loading a Resource (e.g. Font) or hijack a JDK spawned thread (e.g. EventQueue.invokeLater). For concrete examples of past security problems (I never really cared), the list of bug fixes with regards to applets is probably also a good source.
score: 0
comment on: http://stackoverflow.com/q/25489720
type: Comment

gson
tag name: gson
tags question: http://stackoverflow.com/q/25476712
tags question: http://stackoverflow.com/q/25449706
tags question: http://stackoverflow.com/q/25455123
tags question: http://stackoverflow.com/q/25431859
tags question: http://stackoverflow.com/q/25531109
tags question: http://stackoverflow.com/q/25429237
tags question: http://stackoverflow.com/q/25423883
tags question: http://stackoverflow.com/q/25460568
tags question: http://stackoverflow.com/q/25447611
tags question: http://stackoverflow.com/q/25391638
tags question: http://stackoverflow.com/q/25542268
tags question: http://stackoverflow.com/q/25522309
tags question: http://stackoverflow.com/q/25434368
type: Tag
tags question: http://stackoverflow.com/q/25469648
tags question: http://stackoverflow.com/q/25390566

http://stackoverflow.com/comment/46028767
type: Comment
has text: If you run in to trouble set the `outputProperty` attribute of exec and echo it afterwards (that's how I solved it).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/28883856

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/25415384
tags question: http://stackoverflow.com/q/25469360
tags question: http://stackoverflow.com/q/25438803
tags question: http://stackoverflow.com/q/25509958
tags question: http://stackoverflow.com/q/25487354
tag name: jfreechart
tags question: http://stackoverflow.com/q/25529042

retrofit
tags question: http://stackoverflow.com/q/25463606
tag name: retrofit
tags question: http://stackoverflow.com/q/25520000
type: Tag
tags question: http://stackoverflow.com/q/25494434
tags question: http://stackoverflow.com/q/25482558
tags question: http://stackoverflow.com/q/25422255
tags question: http://stackoverflow.com/q/25496244

http://stackoverflow.com/a/25487390
has body: You can use the name() or the local-name() function for the currently selected node. See how to selecting current element name in XSLT Here's the sketch of the code: &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:template match="/Report/"&gt; &lt;Value&gt; &lt;xsl:for-each select="*"&gt; &lt;Attribute&gt; &lt;name&gt; &lt;xsl:value-of select="name()"/&gt; &lt;/name&gt; &lt;values&gt; &lt;xsl:value-of select="./input"/&gt; &lt;/values&gt; &lt;/Attribute&gt; &lt;/xsl:for-each&gt; &lt;/Value&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt;
has comment: http://stackoverflow.com/comment/39813381
has comment: http://stackoverflow.com/comment/39815594
answers question: http://stackoverflow.com/q/25486726
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39782013
has comment: http://stackoverflow.com/comment/39813658
has comment: http://stackoverflow.com/comment/39783737
has comment: http://stackoverflow.com/comment/39794015
score: 1

http://stackoverflow.com/q/25435535
upvote count: 3
accepted answer: http://stackoverflow.com/a/25435564
has comment: http://stackoverflow.com/comment/39683488
tagged with: java
has answer: http://stackoverflow.com/a/25435564
has body: In PHP I can make: $array = array(); for($i = 0; $i &lt; 10; $i++){ $array[$i]['title'] = "title" . $i; $array[$i]['text'] = "text" . $i; } How can i make it in Java? Why I can't use text in index arrays? Maybe i must use Object, but how? Next problem - in Java i must declare array with numbers of elements, but sometimes I get a list that does not know how much has elements and on listing i use instruction "IF" also to skip some of the elements.
has title: Multi array/object with Java same as in PHP
linked to: http://stackoverflow.com/q/383947
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39683850
has comment: http://stackoverflow.com/comment/39683476
has comment: http://stackoverflow.com/comment/39683943
possible better answer: http://stackoverflow.com/a/25435571
has answer: http://stackoverflow.com/a/25435605
has answer: http://stackoverflow.com/a/25435571
type: AnsweredQuestion
score: 2
answer count: 3

http://stackoverflow.com/comment/39688516
has text: What errors are you getting?
score: 0
comment on: http://stackoverflow.com/q/25437906
type: QuestionComment
type: Comment

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

http://stackoverflow.com/q/25491379
has title: RuntimeWorkerException: Invalid nested tag head found, expected closing tag meta
has answer: http://stackoverflow.com/a/53125342
tagged with: html-to-pdf
possible better answer: http://stackoverflow.com/a/58132198
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
has body: I'm using iText in order to convert html into a pdf, but I keep getting a RuntimeWorkerException thrown at parseXHtml. Here's my code: Document tempDoc = new Document(); PdfWriter pdfWriter = PdfWriter.getInstance(tempDoc, out); tempDoc.open(); XMLWorkerHelper.getInstance().parseXHtml(pdfWriter, tempDoc, new ByteArrayInputStream(html.getBytes())); tempDoc.close(); I'm not too familiar with the differences between HTML and XHTML, so I'm at a bit of a loss as to how I should handle this. Here's the html source if it helps.
has answer: http://stackoverflow.com/a/58132198
tagged with: itext
upvote count: 7
downvote count: 1
has answer: http://stackoverflow.com/a/58028397
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39787779
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25493133
has answer: http://stackoverflow.com/a/44545530
answer count: 5
has answer: http://stackoverflow.com/a/25493133
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/39787378
score: 6

http://stackoverflow.com/q/25500213
answer count: 1
favorite count: 0
has title: How do I pass a copy constructor as a method reference?
has body: I have a class PlanItemEditor. I require the E item's copy constructor. How do I pass it in using a method reference? public void initValues(ObservableList&lt;E&gt; srcList, E toEdit) { indexToSet = srcList.indexOf(toEdit); editing = new E(toEdit); this.srcList = srcList; } I was thinking of including a Unary function as a parameter, and passing in a method from the E class that was exactly a copy constructor, but with a different name signature. It's kind of hacky, however. Is there a better way of doing this?
type: Question
has comment: http://stackoverflow.com/comment/39805012
score: 3
accepted answer: http://stackoverflow.com/a/25500382
tagged with: java
has answer: http://stackoverflow.com/a/25500382
has comment: http://stackoverflow.com/comment/39803604
has comment: http://stackoverflow.com/comment/39803821
tagged with: method-reference
has comment: http://stackoverflow.com/comment/39803763
type: AnsweredQuestion
upvote count: 3
tagged with: copy-constructor
downvote count: 0
tagged with: lambda
tagged with: java-8

http://stackoverflow.com/comment/39697945
type: QuestionComment
has text: VLC opens that window when it does not have a valid window handle for embedding - i.e. via the libvlc_window_set_hwnd API call on Windows, which vlcj uses for its Embedded media player components. So, is the video I can see in the background of your picture actually appearing in a JFrame you created? Also, run the vlcj TestPlayer and see if the same thing happens or not.
score: 2
comment on: http://stackoverflow.com/q/25441284
type: Comment

http://stackoverflow.com/q/25434368
tagged with: android
tagged with: pojo
accepted answer: http://stackoverflow.com/a/25434745
has comment: http://stackoverflow.com/comment/39681474
has answer: http://stackoverflow.com/a/25434745
has title: Arrays containing 10 extra null elements when parsed into POJO with GSON
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39681486
has comment: http://stackoverflow.com/comment/39681292
has comment: http://stackoverflow.com/comment/39681362
answer count: 3
has body: I am receiving a Json object from web api, it looks as follows: {"Sites":[{"SiteId":1,"SiteName":"Site 1"},{"SiteId":2,"SiteName":"Site 2"},{"SiteId":3,"SiteName":"Site 3"}]} Now I have the following code which uses gson to parse it to a POJO: @Override protected Response<T> parseNetworkResponse(NetworkResponse response) { try { String json = new String(response.data, HttpHeaderParser.parseCharset(response.headers)); return Response.success(gson.fromJson(json, clazz), HttpHeaderParser.parseCacheHeaders(response)); } catch (UnsupportedEncodingException e) { return Response.error(new ParseError(e)); } catch (JsonSyntaxException e) { return Response.error(new ParseError(e)); } } And here is my POJO: public class UsersSitesViewModel { public List<UserSite> Sites; } public class UserSite { public UserSite(int siteId, String siteName) { SiteId = siteId; SiteName = siteName; } public int SiteId; public String SiteName; } But now when I run in my code and I debug to look at the pojo it created: it looks as follows: WHy is it inseting 10 Null values into my array? That is incorrect!
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25434474
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
downvote count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/25434416
has comment: http://stackoverflow.com/comment/39681333
favorite count: 0
has comment: http://stackoverflow.com/comment/39681229
type: Question
has answer: http://stackoverflow.com/a/25434416
has comment: http://stackoverflow.com/comment/39681554

http://stackoverflow.com/comment/39834163
type: Comment
comment on: http://stackoverflow.com/q/25515603
type: QuestionComment
has text: The first item the controller class loads is the child item of an Objective--a Strategy. Within that screen that displays the list of Strategies, you have the option of selecting a strategy and viewing ITS children--a list of Tactics. And so on all the way down. The controller requires a default constructor for the option of adding a new item, however far down we are. It also requires a copy constructor for editing an existing selected item (since the PlanItem is immutable).
score: 0

http://stackoverflow.com/comment/39692694
has text: again, don't waste your time [trying that](http://docs.opencv.org/doc/user_guide/ug_traincascade.html), it won't work. there's just a limit, what you can achieve with cascades. in your case, the input is inappropriate.
type: Comment
comment on: http://stackoverflow.com/a/25439903
type: AnswerComment
score: 1

jtds
tags question: http://stackoverflow.com/q/25405435
tag name: jtds
tags question: http://stackoverflow.com/q/25532361
type: Tag

http://stackoverflow.com/comment/40184492
has text: Sorry @Loganathan Mohanraj my mistake.I have mailed you please Check
comment on: http://stackoverflow.com/a/25463773
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40372833
type: Comment
comment on: http://stackoverflow.com/q/25418916
type: QuestionComment
has text: OSX 10.9.4 and 5 more characters
score: 0

http://stackoverflow.com/comment/39809744
type: Comment
has text: you hide the button by setting the visibility and later after 15 seconds make it visible
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25503606

http://stackoverflow.com/q/25527244
has comment: http://stackoverflow.com/comment/39853227
has comment: http://stackoverflow.com/comment/39863623
has comment: http://stackoverflow.com/comment/39853853
score: 0
has comment: http://stackoverflow.com/comment/39863644
has comment: http://stackoverflow.com/comment/39853586
answer count: 0
has comment: http://stackoverflow.com/comment/39863740
tagged with: java
has comment: http://stackoverflow.com/comment/39853573
type: Question
has title: error using a message redirection method (Java)
has comment: http://stackoverflow.com/comment/39881740
has comment: http://stackoverflow.com/comment/39863290
has body: some months ago, I have implemented a GUI which contains a method that basically transfers the console output messages to a text area contained inside the GUI. The method works okay in some computers (in other words, it transfers and prints the messages from the console output and to the JTextArea outputText), but it fails to execute on others (nothing is printed). Here is some piece of code: private JTextArea outputText; private void redirectSystemStreams() { OutputStream out = new OutputStream() { @Override public void write(int b) throws IOException { updateTextArea(String.valueOf((char) b)); } @Override public void write(byte[] b, int off, int len) throws IOException { updateTextArea(new String(b, off, len)); } @Override public void write(byte[] b) throws IOException { write(b, 0, b.length); } }; System.setOut(new PrintStream(out, true)); System.setErr(new PrintStream(out, true)); } private void updateTextArea(final String text) { SwingUtilities.invokeLater(new Runnable() { public void run() { outputText.append(text); } }); } I believe the problem lies on the differences of the java versions installed on each computer, but I have no idea on how to solve this through code... UPDATE (27.08.14): added additional explanation about the method behaviour... UPDATE 2 (27.08.14): After analysing my project a little, I figured out that the problem exists because of a bad thread execution (it worked differently on some computers because one was not loading the dll which this thread uses...). The thread code is something like this: public class MyThread implements Runnable { private static final int sleepDelay = 100; public MyThread() {} @Override public void run() { try { //do something... while(true) { Thread.sleep(MyThread.sleepDelay); //do something... } } catch(Exception e) { //do something... } } } It is important to know that both processes (redirectSystemStreams() and the thread above) do not access or share the same objects. I have already done some researching abo…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39863569
has comment: http://stackoverflow.com/comment/39854952
tagged with: multithreading

http://stackoverflow.com/a/25416046
has comment: http://stackoverflow.com/comment/39647629
has comment: http://stackoverflow.com/comment/39647692
has comment: http://stackoverflow.com/comment/39647707
upvote count: 4
has comment: http://stackoverflow.com/comment/39647649
answers question: http://stackoverflow.com/q/25416006
has comment: http://stackoverflow.com/comment/39647616
has comment: http://stackoverflow.com/comment/39647564
has comment: http://stackoverflow.com/comment/39647617
downvote count: 0
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/25416006
has comment: http://stackoverflow.com/comment/39647698
has body: You should use a DocumentFilter for this, take a look at Implementing a Document Filter and DocumentFilter Examples It will allow you to filter out text coming directly before it's applied to the underlying Document, which makes it flexible enough to be used with any Document implementation that extends from AbstractDocument, takes into account the use cases where the user pastes text into the field or calls setText For example... import java.awt.EventQueue; import java.awt.GridBagLayout; import java.awt.Toolkit; import javax.print.attribute.AttributeSet; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.text.AbstractDocument; import javax.swing.text.BadLocationException; import javax.swing.text.DocumentFilter; import javax.swing.text.DocumentFilter.FilterBypass; public class FilterTest { public static void main(String[] args) { new FilterTest(); } public FilterTest() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JTextField field = new JTextField(10); ((AbstractDocument)field.getDocument()).setDocumentFilter(new SizeFilter(5)); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridBagLayout()); frame.add(field); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class SizeFilter extends DocumentFilter { private int maxCharacters; public SizeFilter(int maxChars) { maxCharacters = maxChars; } public void insertString(FilterBypass fb, int offs, String str, AttributeSet a) throws BadLocationException { if ((fb.getDocument().getLength() + str.length()) &lt;= maxCharacters) { super.insertString(fb, offs, str, a); } else { Toolkit.getDefaultToolkit…
type: AcceptedAnswer

http://stackoverflow.com/a/30767405
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25411547
score: 1
has body: Agree with the above, in plain english, your code will be executed like this: final List studentList = new ArrayList(); ParseQuery query = ParseQuery.getQuery("Student"); ------> 1. query.findInBackground (Popped onto background thread) return studentList (so yes, by the time you get here, studentList will probably be null). Just remember ".findinbackground" will always go to a background thread.
downvote count: 0

http://stackoverflow.com/comment/39660661
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25423536
has text: Are you using any Build tool for building your applications ? As example making parent-child projects is possible with maven. You can refer to [SO-Link](http://stackoverflow.com/questions/3209119/creating-multi-module-maven-projects-in-eclipse).

http://stackoverflow.com/comment/39831654
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25491362
type: Comment
has text: I haven't yet profiled to check out whether that's really creating problems for me.. but I am seeking a general consensus whether this looks like the right implementation.. deserializing several hundered small protobuf messages to generate a single webpage on high traffic site ..?

http://stackoverflow.com/q/25527080
tagged with: freemarker
has answer: http://stackoverflow.com/a/25527250
has body: How can I get the current timestamp (number of seconds since 01/01/1970) in a freemarker file? I know the .now var but I didn't figure how to get a basic timestamp format.
score: 4
upvote count: 4
type: AnsweredQuestion
tagged with: java
answer count: 1
downvote count: 0
has title: Freemarker get current timestamp
favorite count: 0
tagged with: timestamp
type: Question
accepted answer: http://stackoverflow.com/a/25527250

http://stackoverflow.com/comment/39681187
type: Comment
comment on: http://stackoverflow.com/q/25434353
type: QuestionComment
score: 0
has text: Exception in thread "LWJGL Application" java.lang.NullPointerException at com.Aaron.pong.PlayScreenPong.render(PlayScreenPong.java:83) at com.badlogic.gdx.Game.render(Game.java:46) at com.Aaron.pong.pong.render(pong.java:22) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:206) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)

http://stackoverflow.com/a/25482815
score: 1
type: Answer
has body: result is a DBObject so you can just use result.get("leadTime_30.value"). If you want the aggregation to only return value you will have to change your aggregation (using $project).
answers question: http://stackoverflow.com/q/25482700
has comment: http://stackoverflow.com/comment/39771950
downvote count: 0
has comment: http://stackoverflow.com/comment/39770994
upvote count: 1
has comment: http://stackoverflow.com/comment/39771023
has comment: http://stackoverflow.com/comment/39772391
has comment: http://stackoverflow.com/comment/39771945

http://stackoverflow.com/q/25504595
has comment: http://stackoverflow.com/comment/39811405
has title: while loop performnace single core vs multicore machine
type: AnsweredQuestion
answer count: 2
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25504689
downvote count: 0
accepted answer: http://stackoverflow.com/a/25504649
upvote count: 1
has answer: http://stackoverflow.com/a/25504649
has answer: http://stackoverflow.com/a/25504689
has body: I have faced below interview question sometime back, how the below loop will behave in single core and multicore systems, meaning does it affect single core, multicore performance or it's the same? while (r &lt; 1000000) { //assume r = 0 initially t = r*r; r++ }
favorite count: 0
has comment: http://stackoverflow.com/comment/39811415
type: Question

http://stackoverflow.com/comment/39634341
comment on: http://stackoverflow.com/q/25409198
score: 0
type: QuestionComment
has text: How hard can it be to write two extra lines of code and execute it yourself.
type: Comment

http://stackoverflow.com/q/25449434
has comment: http://stackoverflow.com/comment/39708777
tagged with: jaxb
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/39709018
type: Question
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25461762
has title: XML Value extraction using Java JAXB
has answer: http://stackoverflow.com/a/25450577
score: 0
tagged with: java
has body: I need a help in the following scenario. I have got a XML String response. In that XML response I need to extract three values. I could not achieve it. I have specified the XML response and the value I need. Also I created set of .java file using pojo one line tool. My XML Response: <?xml version="1.0" encoding="UTF-8"?> <response> success XXXXX ControlIdHere false 3.0 success XXXXX1 XXXXX 2014-08-22T07:12:37-07:00 success readByQuery testControlId A 12 A 12 A 12 In this XML response I would need the following values Like count=100, totalcount=5142 My object class is like this public class Data { private String totalcount; private Sodocument[] sodocument; private String numremaining; private String count; private String listtype; public String getTotalcount () { return totalcount; } public void setTotalcount (String totalcount) { this.totalcount = totalcount; } public Sodocument[] getSodocument () { return sodocument; } public void setSodocument (Sodocument[] sodocument) { this.sodocument = sodocument; } public String getNumremaining () { return numremaining; } public void setNumremaining (String numremaining) { this.numremaining = numremaining; } public String getCount () { return count; } } XMLInputFactory xif = XMLInputFactory.newFactory(); Reader reader = new StringReader(response.toString()); XMLStreamReader xsr = xif.createXMLStreamReader(reader); JAXBContext jc = JAXBContext.newInstance(Data.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); Data jb = unmarshaller.unmarshal(xsr,Data.class).getValue(); System.out.println(jb.getCount()); This is my JAXB class. For the value getCount gives me null response. Can somebody help me on fixing this?

http://stackoverflow.com/comment/39844895
score: 0
comment on: http://stackoverflow.com/q/25522335
type: Comment
has text: Is start value and return data corrent when requesting new data?
type: QuestionComment

http://stackoverflow.com/comment/40466335
has text: cross posted: https://www.biostars.org/p/109943/
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25399930

http://stackoverflow.com/comment/39614197
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25398389
has text: Add links to the library you use

http://stackoverflow.com/comment/39706475
comment on: http://stackoverflow.com/a/25448275
type: Comment
score: 0
type: AnswerComment
has text: first section of your answer helped me fix the issue, thank you so much ;)

http://stackoverflow.com/comment/39753630
score: 0
type: AnswerComment
has text: This is your code that I combined together, I don't know if it's correct but here it is [link](http://pastebin.com/qkG55hiH)
type: Comment
comment on: http://stackoverflow.com/a/25472363

http://stackoverflow.com/comment/39721677
score: 0
type: Comment
type: AnswerComment
has text: You know something about jasper reports, I really need help with that. Thanks again for your response. I will try to put in practice
comment on: http://stackoverflow.com/a/25454879

pyqt
type: Tag
tags question: http://stackoverflow.com/q/25475475
tag name: pyqt

http://stackoverflow.com/a/25529574
has comment: http://stackoverflow.com/comment/39857546
has comment: http://stackoverflow.com/comment/39859092
has comment: http://stackoverflow.com/comment/39858001
has comment: http://stackoverflow.com/comment/39858846
has comment: http://stackoverflow.com/comment/39858056
has comment: http://stackoverflow.com/comment/39875215
has comment: http://stackoverflow.com/comment/39859410
has comment: http://stackoverflow.com/comment/39858783
has comment: http://stackoverflow.com/comment/39857748
has comment: http://stackoverflow.com/comment/39858179
has comment: http://stackoverflow.com/comment/39857833
has comment: http://stackoverflow.com/comment/39857843
has comment: http://stackoverflow.com/comment/39859514
answers question: http://stackoverflow.com/q/25529314
has comment: http://stackoverflow.com/comment/39858664
has comment: http://stackoverflow.com/comment/39857613
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/39859350
downvote count: 2
type: Answer
has body: Among other options, you can use an implicit inner join: select first_table.pk_data, first_table.user_name, second_table.address, third_table.age, fourth_table.cost from first_table, second_table, third_table, fourth_table where first_table.pk_data = 'value' and second_table.pk_data = first_table.pk_data and third_table.pk_data = first_table.pk_data and fourth_table = first_table.pk_data
has comment: http://stackoverflow.com/comment/39857885
has comment: http://stackoverflow.com/comment/39859682
has comment: http://stackoverflow.com/comment/39871725
has comment: http://stackoverflow.com/comment/39858271

http://stackoverflow.com/a/38511111
type: Answer
downvote count: 0
has body: @Bated answer is pretty thorough but want to add some additional information about why it is so important to use the ATG dsp tags to achieve this. ATG maintains your session in two ways: Via the jsessionid stored in a cookie Via the jsessionid stored in the query string By using the &lt;dsp&gt; tags you ensure that you maintain the users session as it is quite possible that the user has cookies disabled and the dsp tags will revert to using the query string. Using the html anchor tag is unsafe for this reason as the users session will only be maintained if they have cookies enabled.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25510040

http://stackoverflow.com/comment/39933053
comment on: http://stackoverflow.com/q/25545174
score: 0
has text: I'm trying to make a jsp server by my own,I think it helps me to better understand java ee technology, so I have to implement the RequestDispatcher, lol
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39715217
has text: is it a console app cuz then it wont work
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25452660
score: 0

http://stackoverflow.com/comment/39620738
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25401800
has text: On Mac I can put the caret inside the string and use **Cmd+Enter** and it will split the one-liner string and create a string per line which is concatenated with `+`. As @kan has already mentioned, your first version is invalid Java while the second version is valid Java. IntelliJ offers however the ability to wrap a (very) long string at the end of the line (`Preferences/IDE Settings/Editor` and check here `Use soft wraps in editor` and/or `Use soft wraps in console`)
type: Comment

http://stackoverflow.com/q/25473015
has body: I am new to Android and working on a "project" as a teaching method. I added a spinner on the UI &lt;Spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="38dp" /&gt; and i am trying to pass on the values from a String Array String[] branchesArray = st.split(";"); I have been looking around the web for this one, but i just cant make it to work. The most popular seems to be something like that ArrayAdapter&lt;String&gt; adapter0 = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, branchesArray); which is giving me this error The constructor ArrayAdapter(MainActivity.getData, int, String[]) is undefined and, according to an other post using this ArrayAdapter&lt;String&gt; adapter0 = new ArrayAdapter&lt;String&gt; (Activity.this, android.R.layout.simple_spinner_item, branchesArray); gives me this error No enclosing instance of the type Activity is accessible in scope Any help is highly appreciated.
tagged with: android
has comment: http://stackoverflow.com/comment/39753058
tagged with: android-spinner
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39753039
score: 0
has comment: http://stackoverflow.com/comment/39753116
has comment: http://stackoverflow.com/comment/39753189
accepted answer: http://stackoverflow.com/a/25473039
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25473039
has title: How to populate an android spinner with a java String array
has comment: http://stackoverflow.com/comment/39753085
type: Question

http://stackoverflow.com/comment/39730810
score: 0
comment on: http://stackoverflow.com/q/25460965
type: Comment
type: QuestionComment
has text: what do you want in output? long value?

http://stackoverflow.com/a/28332910
upvote count: 14
downvote count: 0
has body: You can configure Jersey client to use Apache HttpClient with connection pooling. Details of how to do so can be found on this blog post. Note that the post itself covers Jersey 2.x, but there is a gist for Jersey 1.x mentioned in the comments.
accepted answer of: http://stackoverflow.com/q/25424302
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25424302
type: Answer
score: 14

http://stackoverflow.com/a/25488221
has comment: http://stackoverflow.com/comment/39813046
type: Answer
has comment: http://stackoverflow.com/comment/39817463
has comment: http://stackoverflow.com/comment/39805329
has comment: http://stackoverflow.com/comment/39818946
has comment: http://stackoverflow.com/comment/39848777
has body: Data in a PieChart needs two attributes: a name (String) and a value (double). A BarChart is similar. So, assuming you are using some arbitrary data structure (such as a List&lt;String&gt;) for the data displayed in each row in the TableView, you will need to store the user's choice of which column has the name of the data, and which has the value. For each element in the TableView's list of items, you will need to map that item to a new PieChart.Data(name, value), and use those to populate an ObservableList&lt;PieChart.Data&gt; to pass to the PieChart: int userChosenDataNameColumnIndex ; int userChosenDataValueColumnIndex ; // for each List&lt;String&gt; in the table's data: List&lt;String&gt; rowData ; String name = rowData.get(userChosenDataNameColumnIndex); double value = Double.parseDouble(rowData.get(userChosenDataValueColumnIndex)); PieChart.Data pieChartData = new PieChart.Data(name, value); You can manage all this by hand: TableView&lt;List&lt;String&gt;&gt; table = new TableView&lt;&gt;(); ObservableList&lt;List&lt;String&gt;&gt; tableData = loadTableDataFromDatabase(); int userChosenDataNameColumnIndex ; int userChosenDataValueColumnIndex ; ObservableList&lt;PieChart.Data&gt; pieChartData = FXCollections.observableArrayList(); for (List&lt;String&gt; rowData : tableData) { String name = rowData.get(userChosenDataNameColumnIndex); double value = Double.parseDouble(rowData.get(userChosenDataValueColumnIndex)); pieChartData.add(new PieChart.Data(name, value)); } PieChart pieChart = new PieChart(pieChartData); Note that this just creates a pie chart that is a snapshot of the data in the table. If you add rows to the table, or delete rows from the table, the pie chart will not update. You can use the EasyBind framework to create an ObservableList&lt;PieChart.Data&gt; that is a "live" view of the table data: TableView&lt;List&lt;String&gt;&gt; table = new TableView&lt;&gt;(); ObservableList&lt;List&lt;String&gt;&gt; tableData = loadTableDataFromDatabase(); int …
has comment: http://stackoverflow.com/comment/39816824
upvote count: 1
has comment: http://stackoverflow.com/comment/39807772
has comment: http://stackoverflow.com/comment/39781863
downvote count: 0
answers question: http://stackoverflow.com/q/25486493
has comment: http://stackoverflow.com/comment/39843413
has comment: http://stackoverflow.com/comment/39816230
score: 1

http://stackoverflow.com/comment/39758582
comment on: http://stackoverflow.com/a/25475929
has text: couldn't get you can you please elaborate your question.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39632269
score: 0
has text: I am using AccountDao accountDao = new AccountDao();
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25408001

http://stackoverflow.com/q/25543588
has body: In my program i have to create some document creator and I want to split functionality of creating elements into several classes. Each class will create a single element and main creator will extract that element via interface and attach to body. The thing is that i don't want to pass any arguments into constructors call e.g. creator.createDocument() .setDocumentHeader( new DocumentHeader() .setSomeValue(41) ) To simplify the problem lets say that I have a code import org.w3c.dom.Document; import org.w3c.dom.Element; DocumentBuilderFactory dbfac1 = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder1 = dbfac1.newDocumentBuilder(); Document document1 = docBuilder1.newDocument(); DocumentBuilderFactory dbfac2 = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder2 = dbfac2.newDocumentBuilder(); Document document2 = docBuilder2.newDocument(); Element elementFromDoc1 = document1.createElement("body"); Element elementFromDoc2 = document2.createElement("someElement"); The question is, is that legal to do the following operation? elementFromDoc1.appendChild(elementFromDoc2);
type: Question
tagged with: w3c
accepted answer: http://stackoverflow.com/a/25543769
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/883987
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
downvote count: 0
answer count: 1
has title: Appending child element from other document
has answer: http://stackoverflow.com/a/25543769
favorite count: 0

http://stackoverflow.com/comment/39775553
type: AnswerComment
has text: @PulahNandha There is no such thing as "overriding" a (static) inner class. Methods can be overriden only. The static inner class belongs to the declaring interface (see my answer).
type: Comment
comment on: http://stackoverflow.com/a/25485176
score: 0

http://stackoverflow.com/a/25503707
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39839118
has comment: http://stackoverflow.com/comment/39817704
answers question: http://stackoverflow.com/q/25502637
has body: CXF includes a Maven plugin which can generate java artifacts from WSDL. It's enough add it with some specified config values like this: org.apache.cxf cxf-codegen-plugin ${cxf.version} generate-sources generate-sources ${project.build.directory}/generated/cxf ${basedir}/src/main/resources/myService.wsdl wsdl2java Refer to this address for more info. Hope this helps.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39688681
type: QuestionComment
type: Comment
has text: I already did the same thing as pointed in Tomas's link. But, somehow it is still complaining. It must be that there is still something missing in the way i added the jar file like afzalex said.
score: 0
comment on: http://stackoverflow.com/q/25437451

http://stackoverflow.com/comment/39848323
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25520470
has text: @AnkurShah: If you have a compiled class in your class path, you can get the disassembled bytecode for it using the [`javap` tool](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javap.html): `javap -c ClassName`.

http://stackoverflow.com/q/25390200
has answer: http://stackoverflow.com/a/25390398
tagged with: java
has answer: http://stackoverflow.com/a/58400207
favorite count: 0
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/25390545
has title: using ant svn task to get the version of a working copy?
tagged with: ant
downvote count: 0
has answer: http://stackoverflow.com/a/25390545
type: AnsweredQuestion
has body: Is there a way use the svn ant task to get the svn revision number of a working copy and put it into a variable? I would like to add an entry in my Java manifest file which includes the svn revision number, e.g. 0.9.65361 where 65361 is the revision number.
possible better answer: http://stackoverflow.com/a/25390398
answer count: 3
tagged with: svn
upvote count: 5

http://stackoverflow.com/a/36557656
answers question: http://stackoverflow.com/q/25462416
upvote count: 2
score: 2
has body: This might be a bit outdated, but I ran into the same issue and found that hibernate 2nd level cache was the issue.
downvote count: 0
type: Answer

http://stackoverflow.com/q/25497590
has title: Executing millions of tasks in Java within a short period of time?
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/39799206
has body: I need to execute around 8,000,000 tasks in Java. Each task runs in between 1 and 50 ms. I have tried executing these tasks serially using a loop and in parallel using a ThreadPoolExecutor. Obviously, running them serially in a loop is a lot slower and then running them through a ThreadPoolExecutor has a significant performance gain. However, I am still not satisfied with the performance with the ThreadPoolExecutor. I am able to run all 8,000,000 tasks using 15 threads on 4 cores. I am batching 50,000 tasks when submitting tasks to the ThreadPoolExecutor. I am allowing a 1000 ms timeout for the ExecutorCompletionService to return a result. After tuning my application with these parameters I am getting about 25 minutes to process all 8,000,000 tasks. Is there some way for me to run my application any faster than 25 minutes, perhaps Hadoop (distributed system using multiple machines)? I am open to using some other technology or framework.
tagged with: multithreading
downvote count: 1
has comment: http://stackoverflow.com/comment/39805158
has comment: http://stackoverflow.com/comment/39799546
has comment: http://stackoverflow.com/comment/39799260
has comment: http://stackoverflow.com/comment/39827346
favorite count: 0
has answer: http://stackoverflow.com/a/25501303
type: Question
has comment: http://stackoverflow.com/comment/39803286
tagged with: performance
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39799349
tagged with: java
has answer: http://stackoverflow.com/a/25500579
upvote count: 6
has comment: http://stackoverflow.com/comment/39805539
has comment: http://stackoverflow.com/comment/39798915
has comment: http://stackoverflow.com/comment/39798987
has comment: http://stackoverflow.com/comment/39920018
has comment: http://stackoverflow.com/comment/39803266

http://stackoverflow.com/q/25534421
tagged with: deployment
has comment: http://stackoverflow.com/comment/39866901
has comment: http://stackoverflow.com/comment/39866445
score: 1
tagged with: javafx
downvote count: 0
answer count: 1
upvote count: 1
has body: I have a problem with getting the Application to run on other People's machines. I have tested a self contained and the normal .jar file. When i pass them to a friend of mine who has java installed, when he opens the .jar file, there is an Error: "Java Exception has occured". When i run both the .jar and the .exe off the self contained one, both do work on my PC. So the actual question is: Why isn't it working just like that? Can't i just run JavaFX applications without installing the whole JDK? Thanks for your help :)
favorite count: 0
has answer: http://stackoverflow.com/a/33963793
type: Question
type: UnansweredQuestion
has title: JavaFX - Deployed Application doesn't run on other PCs?
tagged with: java
tagged with: self-contained
tagged with: public
has comment: http://stackoverflow.com/comment/39878691

http://stackoverflow.com/a/62224079
score: 3
type: Answer
answers question: http://stackoverflow.com/q/25493837
has body: RowSetFactory factory = RowSetProvider.newFactory(); CachedRowSet rowset = factory.createCachedRowSet(); rowset.populate(ResultSet data) /* now you can close you connection and prepare statement*/
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/25534401
accepted answer of: http://stackoverflow.com/q/25532758
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25532758
upvote count: 1
downvote count: 0
type: Answer
has body: You can define define another(test) context for the unit tests: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "my-test-context.xml", "some-other-context.xml" }) public class SkipSampleFunctionalTests { @Autowired private SomeBean bean; ... } If you want to override only one bean, you can import your main(core) context int the test context and change only the desired bean: &lt;import resource="main-context.xml"/&gt; &lt;bean id="x" class="com.asd.MyClass"&gt; &lt;property name="y" ref="y"/&gt; &lt;/bean&gt;

http://stackoverflow.com/a/25571039
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39941113
accepted answer of: http://stackoverflow.com/q/25549866
has body: Developers might have might have binded an event with first drop down. I mean, after selecting option from first drop down on onblur event they might generate the dependency values in second drop down. So what you need to do is you need to fire an event on first drop down after choosing the option.
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25549866

http://stackoverflow.com/comment/39693059
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25439927
has text: Thank Jens and Laurence Geng. I fixed the bug . I post create funtion bellow. I also chage the FetchType.LAZY of Category to EAGER
score: 0

http://stackoverflow.com/a/25421028
answers question: http://stackoverflow.com/q/25414636
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39657562
has body: Apparently this is a bug in AjaxEditableLabel, it will be fixed in the next Wicket release. For now you can override onCancel(): protected void onCancel(final AjaxRequestTarget target) { super.onCancel(); getEditor().clearInput(); }
type: Answer
accepted answer of: http://stackoverflow.com/q/25414636
score: 4
upvote count: 4

http://stackoverflow.com/a/25534135
has body: You can create the synchronized Map once and have both threads use that one Map instance. final Map&lt;Integer,String&gt; map = Collections.synchronizedMap(b.getMap()); b.setMap(map); Thread t1 = new Thread(new Runnable() { @Override public void run() { map.put(1, "one"); map.put(2, "two"); map.put(3, "three"); } }); Thread t2 = new Thread(new Runnable() { @Override public void run() { map.put(4, "four"); map.put(5, "five"); map.put(6, "six"); } });
answers question: http://stackoverflow.com/q/25533908
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/39898586
type: AnswerComment
has text: Now it makes sense: Image is in pixel, matrix is in points so I need both and a simple division will give me the result I want, right?
score: 0
comment on: http://stackoverflow.com/a/25551595
type: Comment

http://stackoverflow.com/comment/39914930
score: 0
type: AnswerComment
has text: Masterful! This looked like fun; hell is trying to explain why it's a bad idea. :-)
comment on: http://stackoverflow.com/a/25538945
type: Comment

tcp
tags question: http://stackoverflow.com/q/25475337
tags question: http://stackoverflow.com/q/25474479
type: Tag
tags question: http://stackoverflow.com/q/25536160
tags question: http://stackoverflow.com/q/25480229
tags question: http://stackoverflow.com/q/25541670
tags question: http://stackoverflow.com/q/25440035
tags question: http://stackoverflow.com/q/25524414
tags question: http://stackoverflow.com/q/25489113
tags question: http://stackoverflow.com/q/25394752
tag name: tcp
tags question: http://stackoverflow.com/q/25455253

http://stackoverflow.com/comment/39813322
type: AnswerComment
comment on: http://stackoverflow.com/a/25505196
has text: ok @DeiAndrei i am new to java can you tell me that how to use stringtokenizer inthis code and where to do it?
type: Comment
score: 0

http://stackoverflow.com/comment/39847196
comment on: http://stackoverflow.com/a/25519488
has text: helped me a lot in understanding how it works, thanks!
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25473219
answers question: http://stackoverflow.com/q/25473181
has comment: http://stackoverflow.com/comment/39753758
downvote count: 0
has body: The settings folder just contains a preferences file which describes the preferences of your project. example : for a project in my workspace, the file org.eclipse.jdt.core.prefs it contains : eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.7 All project specific settings and what is enabled, what is not etc. Edit : org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled From eclipse docs -When enabled in conjunction with a Java target platform lesser than or equal to "1.4", the compiler will no longer generate JSR instructions, but rather inline corresponding subroutine code sequences (mostly corresponding to try finally blocks). The generated code will thus get bigger, but will load faster on virtual machines since the verification process is then much simpler. This mode is adding support for the Java Specification Request 202 to pre-"1.5" Java target platforms. For a Java target platform greater than or equal to "1.5", the inlining of the JSR bytecode instruction is mandatory and this option is ignored.
upvote count: 1
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39753388

http://stackoverflow.com/comment/54306589
type: Comment
has text: Once you fix your download issue, you can call that basic method in the loop. Have a look at http://stackoverflow.com/questions/31390793/cannot-download-file-from-url-in-java/33252453#33252453
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25480708

http://stackoverflow.com/comment/39790761
score: 1
has text: What about moving the javadoc above the annotation?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25493177

http://stackoverflow.com/comment/39676738
comment on: http://stackoverflow.com/q/25431922
has text: @fadwa which version of java and what type of application
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25399439
tagged with: datastax-java-driver
has body: I'm not sure if I'm missing something but whenever a cassandra node is going down due to OutOfMemoryError my DataStax Java driver is not detecting it and still sending read requests to it. Where as its working fine if I manually bring the node down. I'm using default values for reconnection and retry policies: LoadBalancingPolicy loadBalancingPolicy; if (datacenter != null) { loadBalancingPolicy = new DCAwareRoundRobinPolicy(datacenter); } else { loadBalancingPolicy = new RoundRobinPolicy(); } loadBalancingPolicy = new TokenAwarePolicy(loadBalancingPolicy); loadBalancingPolicy = LatencyAwarePolicy.builder(loadBalancingPolicy).build(); Builder builder = Cluster.builder().addContactPoints(endpoints).withLoadBalancingPolicy(loadBalancingPolicy); Any Suggestions?
has title: Automatic failover for Datastax java driver not working for OutOfMemoryError node failure
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25447898
score: 1
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25447898
tagged with: cassandra
tagged with: java

http://stackoverflow.com/a/25479472
accepted answer of: http://stackoverflow.com/q/25479412
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25479412
has body: Since JSTL is executed on server side, there's no security hole because the query cannot be seen by clients of the application. There are other problems with this approach: The query is not reusable. If you need it in other pages, you will need to repeat the query. When you have simple queries like this one you cannot check the problem, but this arises with more complex statements that needs parameters as well. You're creating a connection manually per page! This will slow your application. Use a proper datasource for a database connection pool configured as a resource or programatically (C3PO or BoneCP, for example) Move all your database code into proper Data Access Layer classes. And use &lt;sql&gt; for JSTL for learning purposes only, not for real world applications. More info: How to use JSTL sql tag Retrieve values from JDBC and use JSTL tags to call the methods Should a database connection stay open all the time or only be opened when needed?
type: Answer
upvote count: 4
score: 4

http://stackoverflow.com/a/25532607
has body: Query Governor is similar to the limit option in Oracle: Link Resource Governor allows you to set the min and max memory for the server: Link2
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25532361

identifier
tags question: http://stackoverflow.com/q/25406961
tag name: identifier
type: Tag

http://stackoverflow.com/comment/39705451
comment on: http://stackoverflow.com/a/25447446
type: Comment
has text: The string is not empty, it contains the same data as submitted from the client side. The png file is generated with 47K, but when you open it, it's blank. The dimensions (height and width) are correct, though.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39613801
has text: @jwenting If an hacker derived whole class and trying to inject in to JVM, why won't he just extends with it Object ;) He might be a dumb hacker.
comment on: http://stackoverflow.com/a/25397931
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25474033
type: AnsweredQuestion
has title: Getting hours,minutes, and seconds from Date?
tagged with: time
score: 21
linked to: http://stackoverflow.com/q/25539891
tagged with: date
has body: I want to get the current hour,minute, and second from the Date object. This is my code: Date date = new Date(); int hour = date.getHours(); But I get a kind of error, the getHours() part doesnt work. I get a "The method getHours() from the type Data is deprecated". What does that mean, and how do I get the hour,minutes, and seconds?
has comment: http://stackoverflow.com/comment/81518661
linked to: http://stackoverflow.com/q/9474121
upvote count: 22
tagged with: java
linked to: http://stackoverflow.com/q/14938253
accepted answer: http://stackoverflow.com/a/25474071
answer count: 1
duplicate of: http://stackoverflow.com/q/907170
has answer: http://stackoverflow.com/a/25474071
tagged with: swing
has comment: http://stackoverflow.com/comment/39754860
downvote count: 1
has comment: http://stackoverflow.com/comment/39754870
favorite count: 0
linked to: http://stackoverflow.com/q/8150155
type: Question
linked to: http://stackoverflow.com/q/907170

http://stackoverflow.com/comment/39895310
comment on: http://stackoverflow.com/a/25549779
has text: That's was the problem, my console had a limit output, so i only "unchecked" the option of limit, and then it works fine! Thanks a lot!:3
type: Comment
score: 0
type: AnswerComment

automation
tags question: http://stackoverflow.com/q/25525421
tags question: http://stackoverflow.com/q/25500342
tag name: automation
tags question: http://stackoverflow.com/q/25549443
type: Tag

java-web-start
tags question: http://stackoverflow.com/q/25433371
type: Tag
tag name: java-web-start

http://stackoverflow.com/q/25536231
linked to: http://stackoverflow.com/q/9766986
score: 0
tagged with: java
has title: Eclipse stuck with Android Library Update at 3%
answer count: 3
has answer: http://stackoverflow.com/a/31284595
tagged with: eclipse
linked to: http://stackoverflow.com/q/5516827
has body: I'm at a standstill in Eclipse due to an "Android Library Update" that never finishes. I tried restarting Eclipse, restarting my computer, deleting the .metadata folder under my Eclipse workspace, and several other shots in the dark. Under Window -> Preferences, I also already checked "Skip packaging and dexing (...)" I have only two projects open: a small demo app and the Google Play Services Library linked to it. So the problem can't be too many projects, per this question. Does anybody have any other ideas?
has answer: http://stackoverflow.com/a/30729458
has answer: http://stackoverflow.com/a/25536269
type: Question
tagged with: android
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13489141

http://stackoverflow.com/q/25446997
tagged with: web-services
possible better answer: http://stackoverflow.com/a/25479637
favorite count: 0
has answer: http://stackoverflow.com/a/25479637
type: AnsweredQuestion
tagged with: cxf
score: 1
tagged with: java
tagged with: apache-camel
has body: I am new to CAMEL, CXF and Karaf. I want to access static file using CAMEL with CXF and KARAF. Wanted to know the best way to do that. I have searched through net and found that CXF based rest web service can be written for the same. Is there any other simpler way for this. We are using jboss FUSE server.
has title: Want to access static resource using CAMEL, CXF and Karaf
type: Question
upvote count: 2
answer count: 2
tagged with: apache-karaf
has answer: http://stackoverflow.com/a/25485134
accepted answer: http://stackoverflow.com/a/25485134
downvote count: 1

http://stackoverflow.com/q/25435327
tagged with: regex
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25457638
has comment: http://stackoverflow.com/comment/39683159
has comment: http://stackoverflow.com/comment/39688935
has body: For example: start 2 4 9 end 5 8 39 How to match 4 and 8 using regular expression? Thanks!
has answer: http://stackoverflow.com/a/25457638
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25435458
type: Question
has answer: http://stackoverflow.com/a/25435458
has comment: http://stackoverflow.com/comment/39683071
has answer: http://stackoverflow.com/a/25457840
has answer: http://stackoverflow.com/a/25458045
has comment: http://stackoverflow.com/comment/39688923
has title: How to match a number in the middle using regular expression in Java?

http://stackoverflow.com/q/25447222
has body: I've got the following pattern/matcher:- Pattern pattern = Pattern.compile(".*'G3[IJC]{1}'.*"); Matcher matcher = null; boolean matchFound = false; String values = ""; for (int i = 0; i &lt; attributes.getLength(); i++) { values = attributes.getValue(i); matcher = pattern.matcher(values); if (matcher.matches()) { matchFound = true; break; } } I'm trying to find attribute values within an XML document that contain 'G3C', 'G3I' or 'G3J' but it doesn't work. I've tried various patterns e.g. &amp;apos;G3[C|I|J]?&amp;apos; and other variations. If I use notepad++ these patterns in the Regex find function work. If i run a simple java class with a string containing some random text with any of these values included, it works, but if I put it in this XML document and read it in using a SaxParser then, no luck. Update Couldn't post sample XML for some reason. It didn't show up in the editor. Something like this though: &lt;SOMELEMENT = 'G3I' SOMETHINGELSE = 'G3J'&gt; I did print all of the information out using attributes.getValue(i) where i is iterated over and it prints out the values I'm looking for, but the regex still doesn't find them, yet the regex finds the values when I pass them in as string.
has comment: http://stackoverflow.com/comment/39707376
score: -2
has comment: http://stackoverflow.com/comment/39706858
tagged with: regex
has title: Cannot match my pattern with Matcher.matches
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/39704171
downvote count: 2
has comment: http://stackoverflow.com/comment/39706478
has comment: http://stackoverflow.com/comment/39706947
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25447297
has comment: http://stackoverflow.com/comment/39706929
accepted answer: http://stackoverflow.com/a/25447297
favorite count: 0
type: Question

java
tags question: http://stackoverflow.com/q/25455837
tags question: http://stackoverflow.com/q/25550092
tags question: http://stackoverflow.com/q/25476186
tags question: http://stackoverflow.com/q/25540087
tags question: http://stackoverflow.com/q/25457120
tags question: http://stackoverflow.com/q/25491428
tags question: http://stackoverflow.com/q/25495063
tags question: http://stackoverflow.com/q/25540019
tags question: http://stackoverflow.com/q/25420136
tags question: http://stackoverflow.com/q/25487597
tags question: http://stackoverflow.com/q/25447569
tags question: http://stackoverflow.com/q/25517141
tags question: http://stackoverflow.com/q/25406563
tags question: http://stackoverflow.com/q/25545085
tags question: http://stackoverflow.com/q/25514292
tags question: http://stackoverflow.com/q/25550288
tags question: http://stackoverflow.com/q/25439660
tags question: http://stackoverflow.com/q/25433586
tags question: http://stackoverflow.com/q/25546155
tags question: http://stackoverflow.com/q/25516006
tags question: http://stackoverflow.com/q/25506796
tags question: http://stackoverflow.com/q/25531477
tags question: http://stackoverflow.com/q/25527044
tags question: http://stackoverflow.com/q/25549400
tags question: http://stackoverflow.com/q/25515292
tags question: http://stackoverflow.com/q/25522063
tags question: http://stackoverflow.com/q/25470915
tags question: http://stackoverflow.com/q/25486486
tags question: http://stackoverflow.com/q/25499594
tags question: http://stackoverflow.com/q/25419398
tags question: http://stackoverflow.com/q/25544946
tags question: http://stackoverflow.com/q/25480172
tags question: http://stackoverflow.com/q/25489664
tags question: http://stackoverflow.com/q/25465334
tags question: http://stackoverflow.com/q/25399909
tags question: http://stackoverflow.com/q/25490081
tags question: http://stackoverflow.com/q/25547895
tags question: http://stackoverflow.com/q/25500494
tags question: http://stackoverflow.com/q/25390200
tags question: http://stackoverflow.com/q/25525581
tags question: http://stackoverflow.com/q/25524617
tags question: http://stackoverflow.com/q/25505138
tags question: http://stackoverflow.com/q/25540847
tags question: http://stackoverflow.com/q/25465165
tags question: http://stackoverflow.com/q/25435403
tags question: http://stackoverflow.com/q/25393991
tags question: http://stackoverflow.com/q/25543148
tags question: http://stackoverflow.com/q/25431871
tags question: http://stackoverflow.com/q/25537932
tags question: http://stackoverflow.com/q/25409533
tags question: http://stackoverflow.com/q/25400109
tags question: http://stackoverflow.com/q/25473015
tags question: http://stackoverflow.com/q/25545422
tags question: http://stackoverflow.com/q/25500786
tags question: http://stackoverflow.com/q/25514964
tags question: http://stackoverflow.com/q/25529002
tags question: http://stackoverflow.com/q/25443827
tags question: http://stackoverflow.com/q/25431477
tags question: http://stackoverflow.com/q/25513524
tags question: http://stackoverflow.com/q/25408330
tags question: http://stackoverflow.com/q/25515699
tags question: http://stackoverflow.com/q/25419131
tags question: http://stackoverflow.com/q/25420810
tags question: http://stackoverflow.com/q/25455924
tags question: http://stackoverflow.com/q/25516285
tags question: http://stackoverflow.com/q/25484168
tags question: http://stackoverflow.com/q/25461738
tags question: http://stackoverflow.com/q/25472982
tags question: http://stackoverflow.com/q/25441974
tags question: http://stackoverflow.com/q/25422638
tags question: http://stackoverflow.com/q/25451036
tags question: http://stackoverflow.com/q/25432890
tags question: http://stackoverflow.com/q/25452069
tags question: http://stackoverflow.com/q/25550301
tags question: http://stackoverflow.com/q/25442442
tags question: http://stackoverflow.com/q/25525149
tags question: http://stackoverflow.com/q/25440889
tags question: http://stackoverflow.com/q/25550772
tags question: http://stackoverflow.com/q/25539267
tags question: http://stackoverflow.com/q/25475124

http://stackoverflow.com/a/25472600
has body: Waiting is very different from sleeping. The javadoc of wait() explains it: The thread releases ownership of this monitor and waits until another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method. The thread then waits until it can re-obtain ownership of the monitor and resumes execution. (emphasis mine) BTW, it also contains a strong rule that you're not respecting: As in the one argument version, interrupts and spurious wakeups are possible, and this method should always be used in a loop: synchronized (obj) { while (&lt;condition does not hold&gt;) obj.wait(); ... // Perform action appropriate to condition } So, when notifyAll() is called, the 4 threads compete to get back the monitor. Each one gets it back once the previous one has released it, and continues executing.
has comment: http://stackoverflow.com/comment/39752542
type: Answer
has comment: http://stackoverflow.com/comment/39754013
has comment: http://stackoverflow.com/comment/39752407
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/39753016
accepted answer of: http://stackoverflow.com/q/25472553
downvote count: 0
has comment: http://stackoverflow.com/comment/39754129
has comment: http://stackoverflow.com/comment/39753583
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25472553
has comment: http://stackoverflow.com/comment/39752344
has comment: http://stackoverflow.com/comment/39753079

http://stackoverflow.com/q/25452535
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25452823
has comment: http://stackoverflow.com/comment/39714839
has body: I have a text file (called data.txt, which has 350 lines) How can I find the text on a given line of the file? For example: int imageVariable = 5; String imageText = nthLineOfFile(imageVariable); textView1.setText(imageText); I'm trying to write the String nthLineOfFile(int image) function. Thanks
score: 0
answer count: 2
has title: How to read from a specific line of a file
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/25452552

http://stackoverflow.com/q/25531640
score: 0
has title: Java DatagramSocket, Dart ClientSocket
tagged with: dart
tagged with: java
answer count: 1
type: Question
tagged with: datagram
tagged with: sockets
has body: I'm working on a project which contains 1 Java server, 1 Android client, 1 Dart web client and 1 Java client. I got the Java server and client finished and working. Now I want to get started with the Dart client. What's the best way to go so I can let Dart communicate with the Java DatagramSocket? Thanks in advance!
tagged with: client
accepted answer: http://stackoverflow.com/a/25532492
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25532492

http://stackoverflow.com/a/25530446
type: Answer
score: 15
has body: No access modifier for your constructor makes it package private. Assuming that First and Second are in the same package, you can call Second's constructors from first. Another class from another package, however, cannot access any of the constructors.
upvote count: 15
answers question: http://stackoverflow.com/q/25530382
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25530382
has comment: http://stackoverflow.com/comment/39859235

android
tags question: http://stackoverflow.com/q/25532779
tags question: http://stackoverflow.com/q/25482068
tags question: http://stackoverflow.com/q/25513188
tags question: http://stackoverflow.com/q/25490281
tags question: http://stackoverflow.com/q/25413704
tags question: http://stackoverflow.com/q/25457973
tags question: http://stackoverflow.com/q/25509253
tags question: http://stackoverflow.com/q/25393446
tags question: http://stackoverflow.com/q/25516964
tags question: http://stackoverflow.com/q/25476178
tags question: http://stackoverflow.com/q/25401030
tags question: http://stackoverflow.com/q/25528769
tags question: http://stackoverflow.com/q/25486775
tags question: http://stackoverflow.com/q/25457534
tags question: http://stackoverflow.com/q/25417349
tags question: http://stackoverflow.com/q/25469684
tags question: http://stackoverflow.com/q/25399676
tags question: http://stackoverflow.com/q/25521220
tags question: http://stackoverflow.com/q/25416661
tags question: http://stackoverflow.com/q/25513675
tags question: http://stackoverflow.com/q/25475881
tags question: http://stackoverflow.com/q/25487655
tags question: http://stackoverflow.com/q/25515213
tags question: http://stackoverflow.com/q/25440547
tags question: http://stackoverflow.com/q/25391349
tags question: http://stackoverflow.com/q/25451671
tags question: http://stackoverflow.com/q/25413547
tags question: http://stackoverflow.com/q/25391540
tags question: http://stackoverflow.com/q/25546357
tags question: http://stackoverflow.com/q/25467704
tags question: http://stackoverflow.com/q/25484784
tags question: http://stackoverflow.com/q/25465969
tags question: http://stackoverflow.com/q/25511552
tags question: http://stackoverflow.com/q/25405463
tags question: http://stackoverflow.com/q/25426064
tags question: http://stackoverflow.com/q/25403171
tags question: http://stackoverflow.com/q/25409138
tags question: http://stackoverflow.com/q/25521440
tags question: http://stackoverflow.com/q/25498370
tags question: http://stackoverflow.com/q/25475055
tags question: http://stackoverflow.com/q/25414210
tags question: http://stackoverflow.com/q/25507998
tags question: http://stackoverflow.com/q/25442753
tags question: http://stackoverflow.com/q/25430232
tags question: http://stackoverflow.com/q/25549914
tags question: http://stackoverflow.com/q/25499386
tags question: http://stackoverflow.com/q/25465754
tags question: http://stackoverflow.com/q/25407097
tags question: http://stackoverflow.com/q/25468380
tags question: http://stackoverflow.com/q/25477491
tags question: http://stackoverflow.com/q/25434630
tags question: http://stackoverflow.com/q/25414328
tags question: http://stackoverflow.com/q/25463103
tags question: http://stackoverflow.com/q/25548442
tags question: http://stackoverflow.com/q/25402290
tags question: http://stackoverflow.com/q/25507042
tags question: http://stackoverflow.com/q/25447153
tags question: http://stackoverflow.com/q/25455878
tags question: http://stackoverflow.com/q/25416528
tags question: http://stackoverflow.com/q/25414324
tags question: http://stackoverflow.com/q/25516426
tags question: http://stackoverflow.com/q/25485252
tags question: http://stackoverflow.com/q/25488119
tags question: http://stackoverflow.com/q/25441166
tags question: http://stackoverflow.com/q/25487092
tags question: http://stackoverflow.com/q/25510330
tags question: http://stackoverflow.com/q/25458843
tags question: http://stackoverflow.com/q/25420567
tags question: http://stackoverflow.com/q/25545518
tags question: http://stackoverflow.com/q/25500060
tags question: http://stackoverflow.com/q/25509245
tags question: http://stackoverflow.com/q/25400799
tags question: http://stackoverflow.com/q/25405444
tags question: http://stackoverflow.com/q/25480168
tags question: http://stackoverflow.com/q/25390782
tags question: http://stackoverflow.com/q/25443125
tags question: http://stackoverflow.com/q/25430242
tags question: http://stackoverflow.com/q/25448461
tags question: http://stackoverflow.com/q/25494339
tags question: http://stackoverflow.com/q/25485908

http://stackoverflow.com/a/25550129
has comment: http://stackoverflow.com/comment/39898658
has comment: http://stackoverflow.com/comment/39898764
upvote count: 1
has comment: http://stackoverflow.com/comment/39896769
has comment: http://stackoverflow.com/comment/39898401
has comment: http://stackoverflow.com/comment/39898017
has comment: http://stackoverflow.com/comment/39899106
accepted answer of: http://stackoverflow.com/q/25549733
has body: Problem is that you want to keep state between program startups, otherwise you will get repeats. So what you want to do is: During startup: if no property file with a shuffled list exists, create a shuffled list, set index to 1 Then: during startup: retrieve shuffled list and index from property file put the item with the given index in a static field increase the index and store the property file again display the item during paint I'll leave it up to you what you do when you run out of items. For a quick fix that simply displays a random item each time the class is used: private static String ITEMS[] = { "Buggy!", "New Game!", "Roll up, roll up!", "Made from Scratch" }; private String itemDisplayed = chooseItem(); private String chooseItem() { Random r = new SecureRandom(); int i = r.nextInt(ITEMS.length); return ITEMS[i]; } private void drawSplash(Graphics2D g) { g.setColor(Color.BLACK); g.setFont(font2); g.drawString(itemDisplayed, 320, 240); displayed = true; }
has comment: http://stackoverflow.com/comment/39896355
has comment: http://stackoverflow.com/comment/39896670
type: Answer
has comment: http://stackoverflow.com/comment/39897744
answers question: http://stackoverflow.com/q/25549733
has comment: http://stackoverflow.com/comment/39897483
has comment: http://stackoverflow.com/comment/39896537
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25436824
answer count: 1
tagged with: bufferedimage
has body: I was making a program where I load an image and after that I do something with opaque pixels. Transparent pixels showed up as black pixels, but after some time I found the cause: Color c = new Color (input.getRGB(x, y)); Works-&gt; if ((input.getRGB(x, y) &amp; 0xFF000000) != 0x00000000) { do_smth();} Returns true at all times-&gt; if (c.getAlpha() != 0) { do_smth(); } So why it does not work?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25436930
has title: Color getAlpha() not working as intended
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/25436930
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/comment/39711697
type: Comment
comment on: http://stackoverflow.com/a/25450577
type: AnswerComment
has text: If you want to use JAXB to marshall/unmarshall your xml, you will have to use annotations. If you want Data.java to remain as it is, then I would still recommend using xjc to generate the annotated class and then write a function to save the relevant data from the xml to your pojo class (Data).
score: 0

http://stackoverflow.com/comment/39778297
type: AnswerComment
comment on: http://stackoverflow.com/a/25479974
type: Comment
has text: @user3907211 is a filed with this id defined in the xml file belongsto the fragment? can you put `userRetrieveName = mUserNameRetrieved.getText().toString(); ` to `OnCreateView` of your fragment ond only declare it at the begining?
score: 2

http://stackoverflow.com/comment/39781710
score: 2
type: AnswerComment
has text: `Maybe give an example of a "correct" URI and describe how it might be consumed by some code.` - the correct URI is in my question already. It's `?array_name[]=value1&array_name[]=value2`. The backend parses it as an array named `array_name` consisting of two values: `value1` and `value2`.
comment on: http://stackoverflow.com/a/25488353
type: Comment

http://stackoverflow.com/q/25400502
has comment: http://stackoverflow.com/comment/40215110
has comment: http://stackoverflow.com/comment/40223389
has comment: http://stackoverflow.com/comment/39621062
has title: JDepend Maven Plugin - Add Excludes
tagged with: java
tagged with: properties
type: Question
score: 0
answer count: 0
has body: I want to use the the following mojo: JDepend Maven Plugin Unfortunately the generated report will also show dependencies to java.*, sun.* etc. Now I have seen that one can specify a jdepend.properties file where customization would happen. The thing is that I want to do this depending on the project. So I want to locate it somewhere in the project resources directory maybe, not in the user home directory. Does someone know how this could work? How can I specify the path to my properties file? And if this is not possible, how can I maybe exclude some classes in an other way?
type: UnansweredQuestion
tagged with: jdepend
has comment: http://stackoverflow.com/comment/39618972
has comment: http://stackoverflow.com/comment/39621980
tagged with: maven
has comment: http://stackoverflow.com/comment/39621117

http://stackoverflow.com/q/25531215
has comment: http://stackoverflow.com/comment/39860745
downvote count: 1
linked to: http://stackoverflow.com/q/11228384
favorite count: 0
type: Question
has body: I use the pattern like (J|N){1}N to match the text like JNN. Using this pattern I can only get the JN in the text. However I want to get both the JN and NN How could I get all the substring which satisfied the pattern? If the text is like JNNNN... Is there a convenient way to get all the matched string?
has comment: http://stackoverflow.com/comment/39860707
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25531408
score: -1
tagged with: regex
has answer: http://stackoverflow.com/a/25531460
has title: How could I use regular expression to match all the satisfied string in the text?
answer count: 2
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39860827
has comment: http://stackoverflow.com/comment/39860764

http://stackoverflow.com/a/25396695
has comment: http://stackoverflow.com/comment/39612032
has comment: http://stackoverflow.com/comment/39611756
type: Answer
answers question: http://stackoverflow.com/q/25396662
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39611990
downvote count: 0
has comment: http://stackoverflow.com/comment/39611940
has body: Why does it has still go onto the next token? That is because when nextInt() is executed it will consume the int number within the file but within it, it has a newLine character that needs to be consume and that is when next is executed to consume that newLine after the int number. sample file content: 1 what actually in there is 1 character and newline \n character
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39612049
accepted answer of: http://stackoverflow.com/q/25396662

swing
tags question: http://stackoverflow.com/q/25480357
tags question: http://stackoverflow.com/q/25390808
tags question: http://stackoverflow.com/q/25550772
tags question: http://stackoverflow.com/q/25444238
tags question: http://stackoverflow.com/q/25455771
tags question: http://stackoverflow.com/q/25458911
tags question: http://stackoverflow.com/q/25483867
tags question: http://stackoverflow.com/q/25521725
tags question: http://stackoverflow.com/q/25487472
tags question: http://stackoverflow.com/q/25474260
tags question: http://stackoverflow.com/q/25494851
tags question: http://stackoverflow.com/q/25535112
tags question: http://stackoverflow.com/q/25523036
tags question: http://stackoverflow.com/q/25526349
tags question: http://stackoverflow.com/q/25392239
tags question: http://stackoverflow.com/q/25406815
tags question: http://stackoverflow.com/q/25475972
tags question: http://stackoverflow.com/q/25496911
tags question: http://stackoverflow.com/q/25538213
tags question: http://stackoverflow.com/q/25454551
tags question: http://stackoverflow.com/q/25396091
tags question: http://stackoverflow.com/q/25435598
tags question: http://stackoverflow.com/q/25456108
tags question: http://stackoverflow.com/q/25479516
tags question: http://stackoverflow.com/q/25477663
tags question: http://stackoverflow.com/q/25482245
tags question: http://stackoverflow.com/q/25436071
tags question: http://stackoverflow.com/q/25535277
tags question: http://stackoverflow.com/q/25419808
tags question: http://stackoverflow.com/q/25415177
tags question: http://stackoverflow.com/q/25424027
tags question: http://stackoverflow.com/q/25516836
tags question: http://stackoverflow.com/q/25416934
tags question: http://stackoverflow.com/q/25495650
tags question: http://stackoverflow.com/q/25457659
tags question: http://stackoverflow.com/q/25446159
tags question: http://stackoverflow.com/q/25458599
tags question: http://stackoverflow.com/q/25488090
tags question: http://stackoverflow.com/q/25414129
tags question: http://stackoverflow.com/q/25419072
tags question: http://stackoverflow.com/q/25502552
tags question: http://stackoverflow.com/q/25416420
tags question: http://stackoverflow.com/q/25425085
tags question: http://stackoverflow.com/q/25513711
tags question: http://stackoverflow.com/q/25523037
tags question: http://stackoverflow.com/q/25476564
tags question: http://stackoverflow.com/q/25443962
tags question: http://stackoverflow.com/q/25517491
tags question: http://stackoverflow.com/q/25489102
tags question: http://stackoverflow.com/q/25395999
tags question: http://stackoverflow.com/q/25512333
tags question: http://stackoverflow.com/q/25422939
tags question: http://stackoverflow.com/q/25393089
tags question: http://stackoverflow.com/q/25502796
tags question: http://stackoverflow.com/q/25399983
tags question: http://stackoverflow.com/q/25524506
tags question: http://stackoverflow.com/q/25503075
tags question: http://stackoverflow.com/q/25416045
tags question: http://stackoverflow.com/q/25407557
tags question: http://stackoverflow.com/q/25511590
tags question: http://stackoverflow.com/q/25416607
tags question: http://stackoverflow.com/q/25451481
tags question: http://stackoverflow.com/q/25494732
tags question: http://stackoverflow.com/q/25446660
tags question: http://stackoverflow.com/q/25495754
tags question: http://stackoverflow.com/q/25419941
tags question: http://stackoverflow.com/q/25418694
tags question: http://stackoverflow.com/q/25462390
tags question: http://stackoverflow.com/q/25395201
tags question: http://stackoverflow.com/q/25464054
tags question: http://stackoverflow.com/q/25516824
tags question: http://stackoverflow.com/q/25544387
tags question: http://stackoverflow.com/q/25442584
tags question: http://stackoverflow.com/q/25447485
tags question: http://stackoverflow.com/q/25463238
tags question: http://stackoverflow.com/q/25507649
tags question: http://stackoverflow.com/q/25519727
tags question: http://stackoverflow.com/q/25456843
tags question: http://stackoverflow.com/q/25529487
tags question: http://stackoverflow.com/q/25405780

http://stackoverflow.com/q/25529253
tagged with: sts-springsourcetoolsuite
score: 0
has comment: http://stackoverflow.com/comment/39888024
tagged with: java
tagged with: spring-tool-suite
tagged with: eclipse
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/39889893
answer count: 0
has body: I use eclipse 4.4 and the Gradle plugin. If I do an import gradle operation from eclipse I can see that the subporjects folders are filtered out. Unfortunatly this is not enough for me because I have source files that are placed under the root project, but outside the subprojects folder (for legacy reasons). So for instance: root --- src --- one-sources --- two-sources --- one --- two --- random-folder --- random-file Now if I open the root project plus its subprojects in Eclipse all files under src are found twice on a navigation (once for the root, second for the subproject). Any ways to fix this? Second I have some other random files under the root that I want to exclude from the Eclipse project automatically. Any ways to achieve this? I have tried writing it with gradle script: // -------- Eclipse support ------------------------------ eclipse { project { buildCommand 'build' file { withXml { xmlProvider -> def addFilterMatcher = {Node to, String path -> Node matcher = to.appendNode('matcher') matcher.appendNode("id", "org.eclipse.ui.ide.multiFilter") matcher.appendNode("arguments", "1.0-projectRelativePath-equals-true-false-" + path) } Node project = xmlProvider.asNode() Node filter = project.appendNode('filteredResources').appendNode('filter') filter.appendNode('id', new Date().getTime()) filter.appendNode('name', 'filter subprojects source code') filter.appendNode('type', 10) Node orNode = filter.appendNode('matcher') orNode.appendNode('id', 'org.eclipse.ui.ide.orFilterMatcher') Node orArgs = orNode.appendNode('arguments') addFilterMatcher(orArgs, "api2") addFilterMatcher(orArgs, "AnnotationProcessor") } } The problem with this is that, it does not work. It is added to the relevant .project section. However, from within Eclipse I cannot see it (but is there alongside the subproject entries): 1409147301041 26 org.eclipse.ui.ide.orFilterMatcher org.eclipse.ui.ide.multiFilter 1.0-projectRelativePath-equals-true-false-one 1409147300428 filter subprojects source c…
has comment: http://stackoverflow.com/comment/39886839
type: UnansweredQuestion
has title: Gradle Eclipse filter non wanted fiiles from root

http://stackoverflow.com/a/25549006
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25540288
upvote count: 5
score: 5
type: Answer
answers question: http://stackoverflow.com/q/25540288
downvote count: 0
has body: Calendar is not expression-friendly. You can use apache commons lang3 DateUtils "#{T(org.apache.commons.lang3.time.DateUtils).toCalendar(myDate)}" (where myDate is a Date bean) or write your own helper class.

http://stackoverflow.com/comment/39628436
score: 0
has text: @FrankN.Stein Unfortunately that too didn't worked :(
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25405382

http://stackoverflow.com/comment/39824432
type: QuestionComment
has text: So what should I do?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25511219

http://stackoverflow.com/comment/39638501
has text: @TheLostMind My minimum sdk version is 8 so i think i cant use !string.isEmpty() as it actually support 9 and above
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25411193
score: 0

http://stackoverflow.com/q/25458832
has comment: http://stackoverflow.com/comment/39727826
answer count: 5
has comment: http://stackoverflow.com/comment/39726903
tagged with: data-conversion
accepted answer: http://stackoverflow.com/a/25458915
linked to: http://stackoverflow.com/q/18823627
tagged with: date
has answer: http://stackoverflow.com/a/25458915
has comment: http://stackoverflow.com/comment/110008198
score: 10
tagged with: integer
has comment: http://stackoverflow.com/comment/39726959
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39726967
downvote count: 4
upvote count: 14
has body: Here's my code: Integer value = 19000101; How can I convert the above Integer represented in YYYYMMDD format to YYYY-MM-DD format in java.util.Date?
possible better answer: http://stackoverflow.com/a/25458894
tagged with: java
has answer: http://stackoverflow.com/a/68711173
has title: How can I convert an Integer (e.g 19000101 ) to java.util.Date?
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/68713393
has answer: http://stackoverflow.com/a/25458894
has answer: http://stackoverflow.com/a/25458850
favorite count: 0
linked to: http://stackoverflow.com/q/14817898
type: Question

http://stackoverflow.com/comment/39656050
score: 0
type: Comment
has text: @Zrebec It just might be possible to create a `RenderedImage` and custom `DataBuffer` implementation that wraps a JavaFX `Image/WritableImage`, to allow ImageIO to store the image, without creating a full copy. Haven't tried though. ;-)
comment on: http://stackoverflow.com/a/25414297
type: AnswerComment

powermock
type: Tag
tags question: http://stackoverflow.com/q/25529188
tags question: http://stackoverflow.com/q/25447369
tag name: powermock
tags question: http://stackoverflow.com/q/25428317
tags question: http://stackoverflow.com/q/25431255
tags question: http://stackoverflow.com/q/25498993

http://stackoverflow.com/a/25432551
accepted answer of: http://stackoverflow.com/q/25407420
type: Answer
has body: Assuming that parsed JSON can be represented in memory as a Map, you can build an API similar to JsonPath that looks like: void update(Map&lt;String, Object&gt; json, String path, Object newValue); I've quickly done a gist of a dirty implementation for simple specific paths (no support for conditions and wildcards) that can traverse json tree, E.g. $.store.name, $.store.books[0].isbn. Here it is: MutableJson.java. It definitely needs improvement, but can give a good start. Usage example: import java.util.*; public class MutableJson { public static void main(String[] args) { MutableJson json = new MutableJson( new HashMap&lt;String, Object&gt;() {{ put("store", new HashMap&lt;String, Object&gt;() {{ put("name", "Some Store"); put("books", Arrays.asList( new HashMap&lt;String, Object&gt;() {{ put("isbn", "111"); }}, new HashMap&lt;String, Object&gt;() {{ put("isbn", "222"); }} )); }}); }} ); System.out.println("Before:\t" + json.map()); json.update("$.store.name", "Book Store"); json.update("$.store.books[0].isbn", "444"); json.update("$.store.books[1].isbn", "555"); System.out.println("After:\t" + json.map()); } private final Map&lt;String, Object&gt; json; public MutableJson(Map&lt;String, Object&gt; json) { this.json = json; } public Map&lt;String, Object&gt; map() { return json; } public void update(String path, Object newValue) { updateJson(this.json, Path.parse(path), newValue); } private void updateJson(Map&lt;String, Object&gt; data, Iterator&lt;Token&gt; path, Object newValue) { Token token = path.next(); for (Map.Entry&lt;String, Object&gt; entry : data.entrySet()) { if (!token.accept(entry.getKey(), entry.getValue())) { continue; } if (path.hasNext()) { Object value = token.value(entry.getValue()); if (value instanceof Map) { updateJson((Map&lt;String, Object&gt;) value, path, newValue); } } else { token.update(entry, newValue); } } } } class Path { public static Iterator&lt;Token&gt; parse(String path) { if (path.isEmpty()) { return Collections.&lt;Token&g…
has comment: http://stackoverflow.com/comment/39681095
answers question: http://stackoverflow.com/q/25407420
type: AcceptedAnswer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/39679144
has comment: http://stackoverflow.com/comment/39711531
upvote count: 6
has comment: http://stackoverflow.com/comment/117885981

http://stackoverflow.com/q/25427981
answer count: 1
has body: I'm new to Java and I am trying to follow the examples on developer.android.com. I'm interested in learning how to test applications. The specific problem I have is that I can't get the test files to run properly. For example, I go to developer.android.com -> Develop -> Samples -> Testing and download the ActivityInstrumentation files. I import them into Eclipse. I get 2 projects (MainActivity and tests). I right-click on "tests" and choose Properties. Under Project References, I check off "MainActivity" (my co-worker told me I should do this to link the projects). The SampleTests.java file has red squiggly lines under the following: import com.example.android.activityinstrumentation.MainActivity; import com.example.android.activityinstrumentation.R; I, and my co-worker can't figure out what is wrong. I'd really like to run these files. (If it helps, I am able to get the MainActivity part onto my phone, and I've been playing with clicking all the buttons and other fun things that it demonstrates.) Thanks in advance for your help.
linked to: http://stackoverflow.com/q/3487585
has answer: http://stackoverflow.com/a/25448545
tagged with: eclipse
favorite count: 0
has comment: http://stackoverflow.com/comment/39680100
type: Question
has title: How do I get the Sample test code (ActivityInstrumentation) from developer.android.com to run?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39669509
downvote count: 0
score: 1
upvote count: 1
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39669075

http://stackoverflow.com/comment/39841264
type: AnswerComment
comment on: http://stackoverflow.com/a/25514156
has text: Plus, `String` is `final` for important security reasons. When you receive a `String` from a caller, you want to be positively sure its immutability is a guaranteed property.
type: Comment
score: 0

http://stackoverflow.com/a/26381513
type: Answer
accepted answer of: http://stackoverflow.com/q/25526286
answers question: http://stackoverflow.com/q/25526286
score: 0
type: AcceptedAnswer
has body: We need to provide a shared file system location which should be access by all the elasticsearch nodes with read &amp; write permission.

http://stackoverflow.com/comment/39632279
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25408154
has text: Create the object **empty**, then start using setters.

http://stackoverflow.com/a/49650978
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25547555
has body: The solution was to execute the NetBeans installer as a normal user, or as the same user that you're logged in as in the X session

http://stackoverflow.com/comment/39656762
type: QuestionComment
comment on: http://stackoverflow.com/q/25420609
score: 0
has text: It's possible that this is more suited to code-review.stackexchange
type: Comment

http://stackoverflow.com/a/25524586
downvote count: 0
has body: The pattern letter a is the Am/pm marker, but it is locale specific. Obviously AM and PM are valid in the English locale, but they are not valid in the Hungarian locale for example. You get ParseException because you have a non-english locale set, and in your locale PM is invalid. // This is OK, English locale, "PM" is valid in English Locale.setDefault(Locale.forLanguageTag("en")); new SimpleDateFormat("hh:mm aa").parse("01:19 PM"); // This will throw Exception, Hungarian locale, "PM" is invalid in Hungarian Locale.setDefault(Locale.forLanguageTag("hu")); new SimpleDateFormat("hh:mm aa").parse("01:19 PM"); To get around this problem, the Locale can be specified in the constructor: // No matter what is the default locale, this will work: new SimpleDateFormat("hh:mm aa", Locale.US).parse("01:19 PM");
upvote count: 5
type: Answer
score: 5
answers question: http://stackoverflow.com/q/25524284

http://stackoverflow.com/comment/39622065
type: AnswerComment
comment on: http://stackoverflow.com/a/25401412
type: Comment
has text: It's fine now it just still says saying { is expected after Enumeration enumeration = properties.keys(); unfortunately!
score: 0

http://stackoverflow.com/q/25493083
has answer: http://stackoverflow.com/a/25744556
tagged with: jersey-2.0
score: 0
tagged with: grizzly
has title: Jersey+grizzly2 standalone server JSON parse error
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39792986
has comment: http://stackoverflow.com/comment/39791931
type: Question
has body: Code what i have now in my little project: Main class: package main; import com.sun.jersey.api.container.grizzly2.GrizzlyWebContainerFactory; import org.glassfish.grizzly.http.server.HttpServer; import utils.text.Messages; import utils.text.Props; import javax.ws.rs.core.UriBuilder; import java.io.IOException; import java.net.URI; import java.util.HashMap; import java.util.Map; public class Main { public static URI BASE_URI; private static void getBaseURI(int port) { BASE_URI = UriBuilder.fromUri(Props.BASE_URL).port(getPort(port)).build(); } private static int getPort(int defaultPort) { String port = System.getProperty(Props.JERSEY_TEST_PORT); if (null != port) { try { return Integer.parseInt(port); } catch (NumberFormatException e) { } } return defaultPort; } protected static HttpServer startServer() throws IOException { final Map<String, String> initParams = new HashMap<String, String>(); initParams.put("com.sun.jersey.config.property.packages", "rest"); initParams.put("com.sun.jersey.api.json.POJOMappingFeature", "true"); return GrizzlyWebContainerFactory.create(BASE_URI, initParams); } public static void main(String[] args) throws IOException, java.text.ParseException { getBaseURI(11111); final HttpServer httpServer = startServer(); System.out.println(Messages.STARTING_GRIZZLY + BASE_URI); System.in.read(); httpServer.stop(); } } pom.xml: com.sun.jersey jersey-grizzly2 1.9.1 com.sun.jersey jersey-json 1.9.1 Resource class: import utils.text.RestResources; import utils.text.RestResponse; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Path(RestResources.MAIN_REST_PATH) public class ClientDisconnectRest { @POST @Path("/client_disconnect") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createTrackInJSON(LoginData cld) { try { return Response.status(200).entity(RestResponse.OK).build(); } catc…
tagged with: jersey
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/comment/39825358
type: AnswerComment
comment on: http://stackoverflow.com/a/25500550
score: 1
type: Comment
has text: ok cool i was able to run your code and it ran perfectly but i dont want to copy your whole code so im trying to put it in my own format and this is what i currently done havent changed it a lot yet but its not working.

http://stackoverflow.com/a/25392774
has body: This site is for questions, not for debugging. But as an attempt to at least answer the question "What I'm doing wrong?": The term (7 / 16) will perform an integer division, and the result will be 0. Use (7.0 / 16.0) instead You may not do arithmetic with RGB values! When you have an RGB value like 0x000000FF (blue) and you multiply it with 256, then the result will be 0x0000FF00 (green). The computations like lPixel + (quantizationError * (3.0 / 16.0) have to be done separately for the R, G and B channel You're processing the image from the bottom to the top. Then distributing the error among the lower right pixels (as it is described on the wikipedia site) does not longer make sense. Change your loops from for (int y = (lHeight - 1); y &gt;= 0; y--) to for (int y = 0; y &lt; lHeight; y++) You can not store the quantization error directly in the pixels of BufferedImage, because the error may also be negative. The image can not handle this. (I also have doubts about your color model, but this is only a gut feeling) The image that you described as the "expected result" contains colors that definitely are not contained in your palette. Finally: Have a look at https://stackoverflow.com/a/5940260/3182664
answers question: http://stackoverflow.com/q/25391385
downvote count: 1
upvote count: 5
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/25391385
type: AcceptedAnswer

http://stackoverflow.com/a/25412421
answers question: http://stackoverflow.com/q/25412341
score: 1
type: AcceptedAnswer
downvote count: 0
has body: An ArrayList&lt;ArrayList&lt;Integer&gt;&gt; isn't a List&lt;List&lt;Integer&gt;&gt;, for the same reason that an ArrayList&lt;Apple&gt; isn't a List&lt;Fruit&gt;, and it's fairly easy to given an example of why that's the case: ArrayList&lt;ArrayList&lt;Integer&gt;&gt; arrayLists = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); // This won't work, but imagine that it did... List&lt;List&lt;Integer&gt;&gt; lists = arrayLists; // This is fine - a LinkedList&lt;Integer&gt; is a List&lt;Integer&gt; lists.add(new LinkedList&lt;Integer&gt;()); // This should be fine too ArrayList&lt;Integer&gt; arrayList = arrayLists.get(0); So what happens at that last line? Somehow arrayList would have a reference to a LinkedList, even though its type is ArrayList&lt;Integer&gt;. Eek! That's a demonstration of why the code wouldn't be safe if it were allowed - which is why it's not allowed. A simpler example is with fruits as I mentioned earlier: List&lt;Apple&gt; apples = new List&lt;Apples&gt;(); // Again, not allowed List&lt;Fruit&gt; fruit = apples; // Because this would be odd... fruit.Add(new Banana()); // It's a Banapple! Apple apple = apples.get(0); There are various things you could do here - but the simplest is probably just to create an ArrayList&lt;List&lt;Integer&gt;&gt; instead of an ArrayList&lt;ArrayList&lt;Integer&gt;&gt;.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25412341
has comment: http://stackoverflow.com/comment/39641342

http://stackoverflow.com/comment/39864270
comment on: http://stackoverflow.com/q/25533008
score: 0
type: Comment
type: QuestionComment
has text: something like this? FragmentActivity extends ListFragment

http://stackoverflow.com/comment/39739586
has text: @user3218114, it works, but it doesn't load the image when running from a jar.
comment on: http://stackoverflow.com/q/25465542
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25471963
has body: I am getting following error in my 'cmpmstaddedit.jsp': org.springframework.beans.NotReadablePropertyException: Invalid property 'cmpcode' of bean class [java.util.ArrayList]: Bean property 'cmpcode' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:725) org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:716) org.springframework.web.servlet.support.BindStatus.(BindStatus.java:149) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:141) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:132) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:116) org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:422) org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142) org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84) org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80) org.apache.jsp.WEB_002dINF.views.admin.cmpmstmgmt_jsp._jspx_meth_form_005finput_005f0(cmpmstmgmt_jsp.java:330) org.apache.jsp.WEB_002dINF.views.admin.cmpmstmgmt_jsp._jspx_meth_form_005fform_005f0(cmpmstmgmt_jsp.java:269) org.apache.jsp.WEB…
type: Question
has title: Bean property 'cmpcode' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
accepted answer: http://stackoverflow.com/a/25490160
has answer: http://stackoverflow.com/a/25490160
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/39751514
has comment: http://stackoverflow.com/comment/39783675
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39784890
answer count: 1
has comment: http://stackoverflow.com/comment/39783629
has comment: http://stackoverflow.com/comment/39751486
has comment: http://stackoverflow.com/comment/39784244

http://stackoverflow.com/comment/39795565
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25495650
has text: After changing the String comparing method, it still does not work. What should I do? @kiheru
type: Comment

http://stackoverflow.com/a/25497598
upvote count: 3
answers question: http://stackoverflow.com/q/25495952
type: AcceptedAnswer
downvote count: 0
has body: Something as below HQL select i from Item i inner join i.owners io where io like 'searchText'; Oracle Query SELECT Distinct(i.itemKey) FROM Item i, ITEM_OWNER_JOIN io WHERE i.itemKey = io.itemKey and io.x like '%%'; where 'x' is column name. Working example from my application From entity: @ElementCollection @JoinTable(name = "rule_tagged_name", joinColumns = @JoinColumn(name = "re_rule", referencedColumnName = "id")) private List&lt;String&gt; ruleTagNames; DB Columns RE_RULE NUMBER RULE_TAG_NAMES HQL Select ru FROM Rule ru inner join ru.ruleTagNames rt_name WHERE rt_name in :tagNameList
has comment: http://stackoverflow.com/comment/39822688
type: Answer
accepted answer of: http://stackoverflow.com/q/25495952
score: 3

http://stackoverflow.com/q/25392232
has answer: http://stackoverflow.com/a/25392354
has comment: http://stackoverflow.com/comment/39602929
has comment: http://stackoverflow.com/comment/39603315
has body: I have a program that parses through hundreds of thousands of files, stores data from each file and towards the end, prints some of the data extracted into an excel document. These are some of the errors I encountered and handled in regards to memory: java.lang.OutOfMemoryError: Java heap space Increased memory to 2gb Error occurred during initialization of VM. Could not reserve enough space for 2097152KB object heap downloaded jre8 for 64 bit machine. set -d64 as one of the default vm arguments java.lang.OurOfMemoryError: GC overhead limit exceeded Increased java heap memory from 2gb to 3g and included this argument -XX:-UseGCOverheadLimit So now my default VM arguments are: -d64 -Xmx3g -XX:-UseGCOverheadLimit The issue is that my program runs for several hours, reads in and stores all of the information I need from all of these files and then throws an error at the end when it's trying to print everything if a memory error occurs. What I'm wondering is if there is a way to store the data extracted and then access it again even if the program exits due to an error. The way I want to store the data is in the same format I use it in the program. For instance, let's say I have several hundred thousand files of user records and I traversed through all of them, stored the data I extracted in user objects and I have these user and other personally defined objects stored in HashMaps and LinkedLists. Is there a way to store these user objects and HashMaps and LinkedLists in a way that even if the program exits due to an error I can write another program that will go through the objects stored so far and printing out the information that I want without having to go through the process of reading in, extracting and storing the information over again?
has title: Storing temporary data even after program exists
linked to: http://stackoverflow.com/q/447898
type: Question
has comment: http://stackoverflow.com/comment/39602913
score: 0
has answer: http://stackoverflow.com/a/25392493
answer count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39602847

http://stackoverflow.com/a/25447062
has body: --skip-secure-auth allows the use of the old, pre-4.1 password hashing method. This obsolete authentication mechanism is handled by a plugin known as mysql_old_password. According to the Connector/J manual, it is not disabled by default (read about the disabledAuthenticationPlugins option), so I suppose the default behaviour is to allow such connections (i.e. equivalent to mysql --skip-secure-auth).
type: Answer
accepted answer of: http://stackoverflow.com/q/25443827
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25443827
has comment: http://stackoverflow.com/comment/39725608

http://stackoverflow.com/q/25541053
has comment: http://stackoverflow.com/comment/39878936
has answer: http://stackoverflow.com/a/25541255
upvote count: 1
score: 1
favorite count: 0
type: Question
has body: I am want to send a String - "HelloWorld" using ObjectInputStream from the client to server. The server will receive "HelloWorld" and print it out on console. Both of them are connected on localhost and port 4445. I received a error at the server side Error: java.io.OptionalDataException Client.java private ObjectOutputStream output; private ObjectInputStream input; @Override public void run() { try { socket = new Socket("localhost",4445); output = new ObjectOutputStream(socket.getOutputStream()); input = new ObjectInputStream(socket.getInputStream()); output.writeChars("HelloWorld"); output.flush(); } } Server.java private ObjectOutputStream output; private ObjectInputStream input; private Object message; @Override public void run() { try { output = new ObjectOutputStream(socket.getOutputStream()); input = new ObjectInputStream(socket.getInputStream()); while(true) { try { message =(String)input.readObject(); System.out.println(message); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }catch(IOException exception) { System.out.println("Error: " + exception); } I read up on this error and it states that this exception will be thrown when An attempt was made to read an object when the next element in the stream is primitive data. In this case, the OptionalDataException's length field is set to the number of bytes of primitive data immediately readable from the stream, and the eof field is set to false. I am quite lost after reading this explanation, so does that mean that you cannot send a String data type using ObjectInputStream?
tagged with: sockets
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39878861
linked to: http://stackoverflow.com/q/8630494
type: UnansweredQuestion
has title: sending String using ObjectInputStream. Error: OptionalDataException
has answer: http://stackoverflow.com/a/25541108
tagged with: java

http://stackoverflow.com/q/25396624
has title: In the java DBCP connection pool - what is an idle connection?
has body: A colleague at work insists that a DBCP idle connection is a connection that has lain unused for 30 minutes. I believe a dbcp idle connection is a connection that is in the pool available to be borrowed, and an active connection is one that is borrowed. Looking through the code I found no reference to 30 minutes or other magic values and a cursory glance through the code for assuring minidle does not show any such logic. If he is correct can you please back that up with a code or documentation reference. For the complete answer I would like it answered for both DBCP 1.1 and 1.6.
favorite count: 0
accepted answer: http://stackoverflow.com/a/25396934
type: Question
has comment: http://stackoverflow.com/comment/39611364
score: 3
has answer: http://stackoverflow.com/a/25396934
has comment: http://stackoverflow.com/comment/39610999
type: AnsweredQuestion
tagged with: connection-pooling
upvote count: 3
tagged with: java
tagged with: apache-commons-dbcp
answer count: 1
downvote count: 0

http://stackoverflow.com/q/25444923
score: 1
downvote count: 0
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25445028
favorite count: 0
type: Question
tagged with: dart-pub
has comment: http://stackoverflow.com/comment/39712779
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39712750
tagged with: dart
tagged with: java
has comment: http://stackoverflow.com/comment/39700082
tagged with: eclipse
has body: Since my attempt to set up a Dart project myself I think I miss something fundamental since I didn't succeeded. So I still need the help of the community. Coming from GWT I am used to a single application forming a single JS file which is ran and will augment a HTML element once it is recognized by the application. There will be usually two JS files, one for the user-frontend and the web applications backend application. I want a solution with an incremental build during development time (which I guess Dart offers when used in Dartium) I have an inhouse web framework that I want to be started and used to send the Dart files for the Dartium session. How this will integrate and interfere with the debug sessions? Update regarding web framework: The web framework is a component based rendering engine, including database and uses its own resource management including everything http related like setting the cache flags etc. Its about 1.5 MB with 1200+ tests. Its simply everything you need starting with a simple servlet. Its also using an embedded jetty. The relevance here is that I need to know how the debugger connects to Dartium and how it finds the files once an instance is running and delivered a html file containing dartium sources, so how can I start my own web server at a given port and still have dartium debug capabilities? Update regarding the former answers: I tried it but after two days gave up to learn more and do some other stuff. I just don't know why it is just not possible to add a simple file to the root package of my Dart module like the good old package.html (javadoc) fil. I then just add the Dart libaries to my project and the Dart plugin adds the required Dart nature to the project and creates a builder entry, done. Why do I have to do all the fuzz. Or even better why cant I just annotate my Module's main class to form a module and so I can replace the extra file completely? I guess the Dart plugin has a model of the Dart code already so discovery is…
has title: Dart: How to setup a project

http://stackoverflow.com/a/25470465
has comment: http://stackoverflow.com/comment/39748610
has comment: http://stackoverflow.com/comment/39748634
has comment: http://stackoverflow.com/comment/39748836
has body: The variable a1 and b3 is not initialized anywhere and that causes the NullPointerException. BTW the stack trace that you have posted is not relevant to the code that you have posted. The code below will help you understand the deadlock situation better. There are two objects, thread1 acquires lock on object1 and thread2 acquires lock on object2 and after 5 seconds thread1 is attempting to acquire lock on object2 which is held by thread2 and thread2 is attempting to acquire lock on object1 which is held by thread1 and here comes the circular dependency (Deadlock). Hope this helps. final Object object1 = new Object(); final Object object2 = new Object(); Thread thread1 = new Thread() { public void run() { synchronized (object1) { try { Thread.sleep(5 * 1000); synchronized (object2) { System.out.println("I am here"); } } catch (InterruptedException e) { e.printStackTrace(); } } } }; Thread thread2 = new Thread() { public void run() { synchronized (object2) { try { Thread.sleep(5 * 1000); synchronized (object1) { System.out.println("I am here"); } } catch (InterruptedException e) { e.printStackTrace(); } } } }; thread1.start(); thread2.start();
has comment: http://stackoverflow.com/comment/39748608
type: Answer
answers question: http://stackoverflow.com/q/25470402
score: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39748588
has comment: http://stackoverflow.com/comment/39748557

http://stackoverflow.com/comment/39779299
has text: Are you recreating the display lists every frame? If so, do you free the old ones?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25487328
type: Comment

http://stackoverflow.com/q/25487472
linked to: http://stackoverflow.com/q/21354725
possible better answer: http://stackoverflow.com/a/25487734
has comment: http://stackoverflow.com/comment/39780336
type: Question
tagged with: timer
has title: Update JTable automically
has body: How would a JTable update automatically based off of time? So every time the current time changes, the table updates automatically. Could some provide a snippet of code of how this may work in Java? To have the Table update after the time changes. Please and thank you in advance. package times; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; public class TableTimeChange { DefaultTableModel model2 = new DefaultTableModel(); String rowdata[] = new String[8]; Date[] date123 = new Date[8]; private SimpleDateFormat format = new SimpleDateFormat("HH:mm:dd:ss"); private JTable table = new JTable(getTableModel()); public TableTimeChange() { table.setPreferredScrollableViewportSize(table.getPreferredSize()); JFrame frame = new JFrame(); frame.add(new JScrollPane(table)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); Timer timer = new Timer(1000, new TimerListener()); timer.start(); frame.setVisible(true); } private TableModel getTableModel() { String[] cols = {"Time"}; String array1[] = { "12-12-2001 10:18:30 PM", "12-15-2001 10:18:54 PM"}; String array2[] = {"01-19-1989 01:18:27 AM", "01-19-2019 01:28:36 PM"}; String array3[] = {"12-05-1989 05:18:57 PM", "08-25-1989 09:18:27 PM"}; String array4[] = { "10-15-1985 09:18:17 AM", "10-25-1985 06:48:27 AM"}; String array5[] = {"06-10-2001 03:09:19 AM", "05-16-2011 03:29:10 AM"}; String array6[] = {"01-12-2000 09:00:08 PM", "11-22-2010 07:00:56 PM"}; String array7[] = { "07-19-1969 12:18:47 PM", "02-05-1969 01:18:17 AM"}; String array8[] = {"01-09-2010 10:09:50 AM", "12-09-2010 05:09:10 PM"}; rowdata[0] = array1[0]; rowdata[1] = array2[0]; row…
has comment: http://stackoverflow.com/comment/39780789
accepted answer: http://stackoverflow.com/a/25488992
has answer: http://stackoverflow.com/a/69825628
has comment: http://stackoverflow.com/comment/39780881
has comment: http://stackoverflow.com/comment/39781376
tagged with: swing
has answer: http://stackoverflow.com/a/25488992
has answer: http://stackoverflow.com/a/25487734
type: AnsweredQuestion
tagged with: jtable
answer count: 3
has comment: http://stackoverflow.com/comment/39779796
has comment: http://stackoverflow.com/comment/39780472
score: 0
tagged with: java

http://stackoverflow.com/a/25491369
upvote count: 3
downvote count: 0
score: 3
has body: Bar codes are not just simple numbers. The entire number contains a check-digit, which is generated from the other digits by an arithmetic procedure. Thus, not all numbers are valid bar codes. Different barcodes use different check-digit algorithms. You need to find out which algorithm is expected by the library you're using, and then generate barcodes that satisfy this requirement. So, for example, if the barcode is 8 digits you would generate random 7-digit numbers and append the correct calculated 8th digit to make a valid barcode. Note: A check-digit is the decimal equivalent of a parity bit. It allows software to detect if the code was read incorrectly in most cases. It isn't perfect, as there are some errors that would produce the same check digit, but it greatly reduces the likelihood of a mis-read.
type: Answer
answers question: http://stackoverflow.com/q/25491231

http://stackoverflow.com/comment/39752990
comment on: http://stackoverflow.com/a/25472363
score: 0
type: Comment
type: AnswerComment
has text: *How to get a card from top of the deck and `System.out.print` it's name and properties?

http://stackoverflow.com/a/25454087
answers question: http://stackoverflow.com/q/25454063
score: 1
type: AcceptedAnswer
has body: As long as statements are confirmed to execute in order by sequence, it is most likely that the instances/objects will be created in order OR will be allocated memory in order. Also,your code is not even valid as pointed by Kevin Krumwiede, you are missing datatype declaration for all the variables/references... public static final Integer A = new Integer(1); public static final Integer B = new Integer(2); public static final Integer C = new Integer(3); public static final Integer D = new Integer(4); public static final Integer E = new Integer(5); public static final Integer F = new Integer(6);
downvote count: 1
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25454063

http://stackoverflow.com/q/25460810
tagged with: arrays
answer count: 3
has body: I have a LinkedList &lt; Integer > with big size (3912984 or more) and I wanna copy these elements in a byte array. The integers are 0 or 1, so I don't need any change of size for array, I want just to copy elements one by one, exactly how they are. Of course, I know the simplest way is : for(int i = 0; i &lt; list.size(); i++) array[i] = (byte)(int) list.get(i); But this method is too slow and my program doesn't end before hours ! Can you know another way (faster, something like Buffer.BlockCopy() of .NET) or I have to change data structures?
has answer: http://stackoverflow.com/a/25460850
has answer: http://stackoverflow.com/a/25461669
type: Question
accepted answer: http://stackoverflow.com/a/25460850
has title: List of Integers into byte array
tagged with: java
tagged with: integer
tagged with: list
possible better answer: http://stackoverflow.com/a/58439326
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/58439326

http://stackoverflow.com/q/25407033
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39630148
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: Question
score: 0
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39632553
has comment: http://stackoverflow.com/comment/39630402
has body: How can I orient the mobile a page with an image that looks smaller when it's vertical, bigger (original size) when it's horizontal? The code and image <?xml version="1.0" encoding="utf-8"?> <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:src="@drawable/ball" /> See Image for better Understanding
tagged with: java
has title: How can I orient?

http://stackoverflow.com/a/25452997
has comment: http://stackoverflow.com/comment/39715649
upvote count: 1
has body: The DDL doesn't say that FL_CONCR is 1 char long. It says that FL_CONCR is 1 byte long. A character can take multiple bytes, based on how it is encoded. Change it to this: FL_CONCR VARCHAR2(1 CHAR) And it should work. If you don't want to re-create the table: ALTER TABLE TAB_NEGC MODIFY(FL_CONCR VARCHAR2(1 CHAR));
answers question: http://stackoverflow.com/q/25452761
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39715680
score: 1

http://stackoverflow.com/comment/39833787
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25515445
score: 0
has text: @Dakota you would need another screen (`GameScreen` or something similar), who's render method would include most of the code you currently have in `Game`'s render you would then (after a delay or something), call `setScreen` on game to that screen, from inside your `Splash` Screen. Check out the [tutorial on screens](https://github.com/libgdx/libgdx/wiki/Extending-the-simple-game) for more information

http://stackoverflow.com/a/25465159
answers question: http://stackoverflow.com/q/25464342
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: I would strongly discourage you from parsing those strings using regex or indexOf -trickery. Those are always bound to break at some time. Should your strings that really, really look like xml actually be xml, you could parse the values using xpath. Something like this: import java.io.IOException; import java.io.StringReader; 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.XPathFactory; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; public class A { public static void main(String[] args) throws Exception { XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); String xml1 = "&lt;xml&gt;&lt;car_dealer&gt;&lt;car_id&gt;2&lt;/car_id&gt;&lt;/car_dealer&gt;&lt;car&gt;&lt;car_id&gt;12345678&lt;/car_id&gt;&lt;/car&gt;&lt;/xml&gt;"; String xml2 = "&lt;xml&gt;&lt;car_dealer&gt;&lt;car_id&gt;2&lt;/car_id&gt;&lt;/car_dealer&gt;&lt;car&gt;&lt;car_type id_1=\"2\" id_2=\"32\"&gt;55555&lt;/car_type&gt;&lt;/car&gt;&lt;/xml&gt;"; Document doc1 = stringToDom(xml1); Document doc2 = stringToDom(xml2); XPathExpression expr1 = xpath.compile("//car/car_id/text()"); String carId = (String) expr1.evaluate(doc1, XPathConstants.STRING); XPathExpression expr2 = xpath.compile("//car/car_type/text()"); String carType = (String) expr2.evaluate(doc2, XPathConstants.STRING); System.out.println("***"); System.out.println("carId: " + carId); System.out.println("carType: " + carType); System.out.println("***"); /* prints *** carId: 12345678 carType: 55555 *** */ } public static Document stringToDom(String xmlSource) throws SAXException, ParserConfigurationException, IOException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocu…
type: Answer
accepted answer of: http://stackoverflow.com/q/25464342

http://stackoverflow.com/comment/39726952
score: 0
has text: @SpringLearner That's not true because if all these classes were wrapped in a `public class Foo { ... }` then `ExtendedA` would be a Nested class and those are permitted to be private, public, protected, or package private. http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
type: QuestionComment
comment on: http://stackoverflow.com/q/25458497
type: Comment

http://stackoverflow.com/a/45605776
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25398703
score: 11
answers question: http://stackoverflow.com/q/25398703
type: Answer
has comment: http://stackoverflow.com/comment/78198299
upvote count: 11
has body: A Maven assembly can easily be replaced Gradle's distribution plugin. The configuration consists of two parts. Configuring the distribution The first part of the configuration is the declaration of the contents of the distribution: apply plugin: 'distribution' distributions { main { baseName = project.name contents { into('lib/') { // Copy the following jars to the lib/ directory in the distribution archive from jar from configurations.runtimeClasspath dirMode = 0755 fileMode = 0644 } from('src/main/dist') { // Contents of this directory are copied by default dirMode = 0755 fileMode = 0644 } } } } This contents section is just an example. Depending on your project you probably want to do different things here. A description of the configuration options can be found in the Javadocs of the AbstractCopyTask and the interfaces it implements. Files in src/main/dist are automatically added to the distribution. Even if there is no correspondent from statement in the publication. The second path element must match the name of the distribution (main in my example). I listed the directory in my example because I need to set the fileMode and dirMode properties on the copied files. Filtering files Filtering files is also possible using one of the filter() methods defined in the AbstractCopyTask. The example below uses the ReplaceTokens filter. It replaces ant-style place holders formatted like this: @placeholder@. import org.apache.tools.ant.filters.ReplaceTokens contents { // contents section in distribution from('src/main/scripts') { filter(ReplaceTokens, tokens: [placeholder: 'replacement-string' ]) filteringCharset = 'UTF-8' } } This will replace the string @placeholder@ in all files copied from the src/main/scripts directory with "replacement-string" in the distribution archive. The Javadocs for ContentFilterable describe some alternative ways to filter files. Configuring the file archives The second part of the configuration allows to manage file format specific features …
type: AcceptedAnswer

http://stackoverflow.com/q/25414533
favorite count: 0
type: Question
has title: Generic hash codes in Java
has comment: http://stackoverflow.com/comment/39644841
tagged with: hashcode
has comment: http://stackoverflow.com/comment/39664217
has comment: http://stackoverflow.com/comment/39644988
has answer: http://stackoverflow.com/a/25414649
score: 4
answer count: 4
upvote count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25414623
tagged with: java
accepted answer: http://stackoverflow.com/a/25414615
has comment: http://stackoverflow.com/comment/39644876
has body: I am somewhat new to Java. Is there is a hashcode utility class that can generate a good hash code for a generic object with members of arbitrary types inside the class? Can I recursively step through the instance of a generic java object and accumulate a hash code that guarantees two equal objects of this class will always compute the same hash code? The context of this question is Android and the Objects.hashCode() etc is not available to me in the Java version I am using (and I have no option to migrate to a newer version). I am guessing the answer is no based on what I have seen so far.
has answer: http://stackoverflow.com/a/25414623
downvote count: 0
has answer: http://stackoverflow.com/a/25414615
has answer: http://stackoverflow.com/a/25414606

http://stackoverflow.com/q/25440453
tagged with: generics
linked to: http://stackoverflow.com/q/7451658
favorite count: 0
type: Question
tagged with: bounded-wildcard
has title: Java F-Bound types with generics
has comment: http://stackoverflow.com/comment/39692198
tagged with: functor
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25492568
upvote count: 1
has answer: http://stackoverflow.com/a/25492568
has comment: http://stackoverflow.com/comment/125165645
has comment: http://stackoverflow.com/comment/39720846
has comment: http://stackoverflow.com/comment/39720561
has comment: http://stackoverflow.com/comment/39692732
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39691951
score: 1
tagged with: java
has body: Is there any way to express f-bound types in java where at the call site, a generic response is returned? interface Functor&lt;T extends Functor&lt;T&gt;&gt; public &lt;B&gt; T&lt;B&gt; map(Function&lt;A, B&gt; fn); // won't compile because types don't match I can use f-bound types if the type never changes, but in the case of map, I need a new type. Is there a way to express this in java? What I am really looking for is any way that I can get something like higher kinds even though I know javac doesn't support higher kinded types. Lets say we have a List&lt;A&gt; and want this interface to return a List&lt;B&gt;. But don't want this interface to know anything about List.

http://stackoverflow.com/q/25492205
tagged with: java
has body: this is my first time trying to do this... I am trying to just get a link to my DB and then display a table to see if the link is established. For some reason it just doesn't work. Here is my code: package dbtest; import java.io.*; import com.healthmarketscience.jackcess.*; import java.util.logging.Level; import java.util.logging.Logger; public class DbTest { /** * @param args the command line arguments */ public static void main(String[] args) { try { Database db = DatabaseBuilder.open(new File("Users\\ou_snaaksie\\NetBeansProjects\\dbTest\\MOVIES.mdb")); Table tblMOVIES = db.getTable("tblMOVIES"); System.out.println(tblMOVIES.toString()); } catch (IOException ex) {Logger.getLogger(DbTest.class.getName()).log(Level.SEVERE, null, ex);} } } And the error I get: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at com.healthmarketscience.jackcess.impl.DatabaseImpl.&lt;clinit&gt;(DatabaseImpl.java:91) at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:170) at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:193) at dbtest.DbTest.main(DbTest.java:25) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 4 more Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds)
answer count: 1
has title: Reading an Access DB with Jackcess library
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25511187
upvote count: 0
type: UnansweredQuestion
score: -1
tagged with: jackcess
tagged with: netbeans

http://stackoverflow.com/q/25447215
tagged with: java
has answer: http://stackoverflow.com/a/25447468
tagged with: button
accepted answer: http://stackoverflow.com/a/25447441
has body: I'm trying to make my first Android application, and here is the problem i met: When i am tapping the Yes Button, the function onYesButtonClick() is not called. The function is supposed to change the visibility of the TextView with the id TextView1, but when i tap, nothing happens. Here is the activity_main.xml: &lt;TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="19dp" android:text="@string/q1" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/button1" android:layout_centerHorizontal="true" android:layout_marginTop="55dp" android:text="@string/hello_world" android:visibility="invisible" /&gt; &lt;Button android:id="@+id/button1" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/TextView01" android:layout_marginTop="22dp" android:layout_toLeftOf="@+id/textView1" android:onClick="onYesButtonClick" android:text="Yes" /&gt; &lt;Button android:id="@+id/button2" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/textView1" android:layout_toRightOf="@+id/textView1" android:onClick="onNoButtonClick" android:text="No" /&gt; and here is the MainActivity.java: public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onYesButtonClick(View view){ TextView textView = (TextView) findViewById(R.id.textView1); textView.setVisibility(android.view.View.VISIBLE); } public void onNoButtonClick(View view){ } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the a…
has comment: http://stackoverflow.com/comment/39704518
has title: Function is not getting called with the button in Android
type: Question
tagged with: findviewbyid
has answer: http://stackoverflow.com/a/25447441
has comment: http://stackoverflow.com/comment/39704247
has comment: http://stackoverflow.com/comment/39704248
has answer: http://stackoverflow.com/a/25447477
possible better answer: http://stackoverflow.com/a/25447468
has comment: http://stackoverflow.com/comment/39704280
tagged with: function
has comment: http://stackoverflow.com/comment/39704181
tagged with: android
linked to: http://stackoverflow.com/q/4153517
has comment: http://stackoverflow.com/comment/39704828
has comment: http://stackoverflow.com/comment/39704607
has comment: http://stackoverflow.com/comment/39704149
type: AnsweredQuestion
score: 0
answer count: 3

http://stackoverflow.com/a/25553136
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25535453
has comment: http://stackoverflow.com/comment/39929123
has comment: http://stackoverflow.com/comment/39924353
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39926458
has body: Since XPath can also supports ".." strings which can contain unescaped '-s, you could just use: ap.selectXPath("/a//b[text() = \"apple'banana\"]");
has comment: http://stackoverflow.com/comment/39926502

http://stackoverflow.com/comment/39894746
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25549579
type: QuestionComment
has text: That would work if we had fixed values, but in this case we are talking about situations where you don't know how many prefill fields you can have. One form can have only two fields another can have thousands (well sort of there are a few limits). But I can't hardcode x variables in the controller

http://stackoverflow.com/comment/39793266
comment on: http://stackoverflow.com/q/25493916
type: Comment
type: QuestionComment
has text: What happens in that new Window? Does it load the host page?
score: 0

http://stackoverflow.com/a/25541774
answers question: http://stackoverflow.com/q/25541481
accepted answer of: http://stackoverflow.com/q/25541481
has body: Found the question, use below code: Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); context.sendBroadcast(it); For the detail, check this link:
type: Answer
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25415691
tagged with: java
has answer: http://stackoverflow.com/a/25415806
accepted answer: http://stackoverflow.com/a/25415806
tagged with: regex
type: Question
has answer: http://stackoverflow.com/a/25415750
answer count: 2
possible better answer: http://stackoverflow.com/a/25415750
upvote count: 1
has comment: http://stackoverflow.com/comment/39647504
downvote count: 1
favorite count: 0
has body: I have an HTML string (in German) like this: Peter Goldberg Dr. , Brünner Straße 19, A-1210, Tel +43-1-1234567 (N) It consists of 3 parts: name of the person ("Peter Goldberg Dr.") the address of the person ("Brünner Straße 19, A-1210") and the tel no of the person or simply the rest of the string ("Tel +43-1-1234567 (N)") I need to split the whole string into these 3 components without the HTML list tags and . I am trying it with Pattern and Matcher classes, but I am doing something wrong for sure. Pattern myPattern = Pattern.compile(" .+,.+Tel.+ "); Matcher mat = myPattern.matcher(eingabe[0]); while (mat.find()) { System.out.println(mat.group(0)); } Could someone please help? Thanks a lot!!
has title: Extracting Tokens out of a String using REGEX in Java
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39790545
type: AnswerComment
has text: Turns out to be a checksum validation failure for cobertura-2.0.3.jar Works fine if I bypass my Repo Manager (Nexus) and download directly from Maven Central. The error occurs when I download via the Maven Central proxy I set up in Nexus. Nexus is computing the wrong checksum and corrupting the jar. Is this an error on Nexus' part or a Nexus config error on my part?
comment on: http://stackoverflow.com/a/25454623
score: 0
type: Comment

http://stackoverflow.com/comment/39880157
score: 2
type: Comment
type: AnswerComment
has text: This is the diagram that has been mentioned in Dietel and Dietel. Nowhere does it talk about bytecode verifier being a part of classloader!!Even this diagram is not clear regarding it.This diagram is the main reason for my confusion!!
comment on: http://stackoverflow.com/a/25541877

http://stackoverflow.com/q/25518499
type: UnansweredQuestion
tagged with: bytecode
tagged with: opcode
has answer: http://stackoverflow.com/a/25518699
score: 0
tagged with: java
answer count: 1
has title: Bytecode of Injection Location
type: Question
tagged with: code-injection
has body: I need to inject some bytecode into a method, but I'm a bit new to this. I've gotten it to work before by simply finding the RETURN Opcode and injecting there, but my new need is more specific: public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (!this.worldObj.isRemote) { if (this.field_70532_c == 0 &amp;&amp; par1EntityPlayer.xpCooldown == 0) { par1EntityPlayer.xpCooldown = 2; this.playSound("random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); par1EntityPlayer.onItemPickup(this, 1); par1EntityPlayer.addExperience(this.xpValue); //NEED TO INJECT HERE this.setDead(); } } } I've commented where I need to inject the bytecode. What Opcode should I be looking for for the injection?

http://stackoverflow.com/comment/39784266
comment on: http://stackoverflow.com/a/25470330
score: 0
has text: I don't have the unwrap method in JavaScriptObject. I have it in JSONObject, but it is private
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25464593
tagged with: jtable
has comment: http://stackoverflow.com/comment/39737925
tagged with: sql
tagged with: java
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25465472
favorite count: 0
score: -1
type: Question
has comment: http://stackoverflow.com/comment/39738255
has comment: http://stackoverflow.com/comment/39738007
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39737689
upvote count: 0
type: UnansweredQuestion
has title: add column to jtable dynamically on netbeans
has comment: http://stackoverflow.com/comment/39737474
linked to: http://stackoverflow.com/q/2443008
tagged with: swing
has body: my code is this : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { DefaultTableModel model=(DefaultTableModel)pl.getModel(); String urlBaseDonnes="jdbc:mysql://localhost:3306/test"; Connection con; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(ClassNotFoundException ex){ System.out.println(ex); } try{ con =DriverManager.getConnection(urlBaseDonnes,"root",""); try (Statement stmt = con.createStatement()) { ResultSet rs = stmt.executeQuery("SELECT * FROM news"); ResultSetMetaData rsMetaData = rs.getMetaData(); int numberOfColumns = rsMetaData.getColumnCount(); System.out.println("resultSet MetaData column Count=" + numberOfColumns); int j=0; pl.setModel(new javax.swing.table.DefaultTableModel(new Object [][] {},new String [] {"ddd","fgg","nl"})); // get the name of the column, and changing it for (int i = 1 ; i &lt;= numberOfColumns; i++) { ChangeName(pl,j,rsMetaData.getColumnName(i)); System.out.println(rsMetaData.getColumnName(i)); System.out.println(j); j= j+1; } String query="SELECT * FROM news"; rs=stmt.executeQuery(query); //Show the database while(rs.next()){ String id=rs.getString("id"); String titre=rs.getString("titre"); String contenu=rs.getString("contenu"); model.addRow(new Object[]{id,titre,contenu}); } rs.close(); } con.close(); System.out.println("close the database"); }catch(SQLException ex){ System.out.println(ex); } } My goal is to change the name of the columns dynamically when i change the name of my table, this code can change the name of the column but when it's come to showing the content of the database it doesn't work, also i can't add column, for exemple if i choose a table that have 4 column, i'll have an error. I tried to add column using a DefaultTableModel but it didn't work. could you please help me with the part of adding column dynamically ? and tell me why this code doesn't show what's on the database ? Thanks

http://stackoverflow.com/a/25408576
answers question: http://stackoverflow.com/q/25408330
has body: If you are looking to randomize anything in Java, a good place to start is the Random class. It provides pseudo-random value generation with a simple interface and is part of the standard library.
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39857436
comment on: http://stackoverflow.com/a/25501507
score: 0
type: Comment
has text: No, I'm not keen on editing this info the answer and therefore increasing it's visibility. It's really just meant for quick tests. You should also drop this approach and write your own TrustManager that uses e.g. a pinning technique for your certificate. Really nobody is required or should use the accept all approach.
type: AnswerComment

http://stackoverflow.com/a/25483181
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25476048
score: 0
answers question: http://stackoverflow.com/q/25476048
type: Answer
has body: Scanner in = new Scanner(System.in); After that use while (in.hasNext()) { /// do the operation }

http://stackoverflow.com/q/25407260
tagged with: jooq
has body: Say I am using a Java library that has the following method public static SomeInterface foo(); The interface SomeInterface has multiple implementations, some of which are protected within the library's package. One of these implementation is TheProtectedClass What would be the best way to check if the object returned by foo() is an instance of TheProtectedClass? My current plan is to create an Utils class that lives within my project but in the same package as the protected class. This Utils can refer to TheProtectedClass since it is in the same package and thus it can check if an object is instanceof TheProtectedClass. Any other ideas? EDIT: Some people are asking "why" so here is more context. I am using jOOQ and in some part of my code, I want to know if the Field instance that I have is an instance of Lower. Currently, I use field.getName().equals("lower") but this isn't as robust as I'd like it to be. I realize that since Lower is a protected class, it isn't part of the API and that it can change but I am ok with that.
has answer: http://stackoverflow.com/a/25407383
upvote count: 3
has comment: http://stackoverflow.com/comment/39790932
has comment: http://stackoverflow.com/comment/39630515
tagged with: java
has comment: http://stackoverflow.com/comment/39630731
has comment: http://stackoverflow.com/comment/39794037
has title: Check if object is instanceof a protected class
has answer: http://stackoverflow.com/a/25416215
favorite count: 0
has comment: http://stackoverflow.com/comment/39790707
type: Question
tagged with: instanceof
answer count: 2
has comment: http://stackoverflow.com/comment/39630948
linked to: http://stackoverflow.com/q/218744
has comment: http://stackoverflow.com/comment/39630536
has comment: http://stackoverflow.com/comment/39701037
accepted answer: http://stackoverflow.com/a/25416215
tagged with: protected
downvote count: 1
has comment: http://stackoverflow.com/comment/39630551
possible better answer: http://stackoverflow.com/a/25407383
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5181578
score: 2

http://stackoverflow.com/comment/39703402
has text: This will add space also after exactly ten letter words. Maybe add `(?!\\s)` at the end of your regex. Also we don't know how to handle `.` `!` `?` and other characters, for instance if `10charWord.` should be replaced with `10charWord .` or not. Or based on that how to handle `foo.................bar`?
type: AnswerComment
comment on: http://stackoverflow.com/a/25446895
score: 1
type: Comment

http://stackoverflow.com/comment/39761907
has text: In case this never gets reopened, here's my answer. https://gist.github.com/chris-martin/097f3bfd966c915ac0b0
comment on: http://stackoverflow.com/q/25477562
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39904948
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25499413
type: Comment
has text: can you tell me that how can i take time from user in a activity and how that time of that activity will be checked by the time get by system time in service....or there is no need to create activity.....

http://stackoverflow.com/a/25596865
score: 8
answers question: http://stackoverflow.com/q/25532338
has comment: http://stackoverflow.com/comment/40052849
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/80015925
accepted answer of: http://stackoverflow.com/q/25532338
has body: I think the simplest way to achieve what you want is to put a level directly on the appender-ref. This eliminates the need to have a named logger in your config, simplifying the configuration a little. Named loggers are still useful if you want to redirect log events for a certain package to a separate appender. <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%-5p %d{ABSOLUTE} [%t] %c - %m%n" /> <PatternLayout pattern="%-5p %d{ABSOLUTE} [%t] %c - %m%n" /> <AppenderRef ref="appFile" level="debug" /> <AppenderRef ref="errorFile" level="error" /> Threshold filters and filter combinations can be especially useful if you want to do more unusual filtering. For example, if you want to send only INFO and WARN level events to a certain appender, excluding TRACE/DEBUG, and also excluding ERROR and FATAL level events(!), you could do this: <PatternLayout pattern="%-5p %c %message %n" /> <ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="NEUTRAL"/> <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/40025947
has comment: http://stackoverflow.com/comment/80015629

http://stackoverflow.com/q/25428877
has comment: http://stackoverflow.com/comment/39671849
has comment: http://stackoverflow.com/comment/39672427
has answer: http://stackoverflow.com/a/25430031
has comment: http://stackoverflow.com/comment/39672093
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39670645
has comment: http://stackoverflow.com/comment/39672276
has title: Why does textview with weight have invalid height in case of text wrapping?
tagged with: android
has comment: http://stackoverflow.com/comment/39671892
tagged with: java
has comment: http://stackoverflow.com/comment/39670630
tagged with: textview
has comment: http://stackoverflow.com/comment/39672153
has comment: http://stackoverflow.com/comment/39670984
type: Question
has comment: http://stackoverflow.com/comment/39670738
has body: I have a dialog, which has a layout xml. Controls are vertically aligned, and in one "row" there is a textview and a seekbar. Textview has weight=1, and seekbar has weight=2. Now the problem is that if textview cannot fit, it is wrapped, but the height of the textview is not adjusted, and the second line is not visible. Layout xml: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > ....other controls..... <TextView android:id="@+id/textView_dialog_settings" android:layout_width="0px" android:layout_height="wrap_content" android:layout_weight="1" android:text="aaaaaaaaa bbbbbbbbbb cccccccccc" android:layout_gravity="center_vertical" android:paddingRight="20dp" android:textAppearance="?android:attr/textAppearanceMedium" /> <SeekBar android:id="@+id/seekbar_dialog_settings" android:layout_width="0px" android:layout_weight="2" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:max="8" android:progress="1" /> ....other controls.....
has comment: http://stackoverflow.com/comment/39672016
tagged with: android-wrap-content
tagged with: android-xml
has comment: http://stackoverflow.com/comment/39671782
answer count: 1
has comment: http://stackoverflow.com/comment/39671985
accepted answer: http://stackoverflow.com/a/25430031
has comment: http://stackoverflow.com/comment/39672218

http://stackoverflow.com/a/25455601
has body: String s = new String("a,b,c"); String[] split = s.split(",");
has comment: http://stackoverflow.com/comment/39720963
downvote count: 2
answers question: http://stackoverflow.com/q/25455574
upvote count: 1
has comment: http://stackoverflow.com/comment/39720905
type: Answer
score: -1

http://stackoverflow.com/q/25421486
tagged with: exception
tagged with: android
tagged with: java
has title: async task error while executing in background
has comment: http://stackoverflow.com/comment/39656865
has body: I am building an NFC android app in which it will read the NFC card and will show the card number..When I run the application and come on the screen for tapping the card ,While I tap the card progress bar for wait appears and then it gives me the error of aysnc task while running in doInbackground.Here is my HomeActivity class. package com.github.devnied.emvnfccard.activity; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.Collection; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Configuration; import android.nfc.NfcAdapter; import android.nfc.Tag; import android.nfc.tech.IsoDep; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.widget.DrawerLayout; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import com.github.devnied.emvnfccard.R; import com.github.devnied.emvnfccard.adapter.MenuDrawerAdapter; import com.github.devnied.emvnfccard.fragment.AboutFragment; import com.github.devnied.emvnfccard.fragment.ConfigurationFragment; import com.github.devnied.emvnfccard.fragment.IRefreshable; import com.github.devnied.emvnfccard.fragment.ViewPagerFragment; import com.github.devnied.emvnfccard.model.EmvCard; import com.github.devnied.emvnfccard.parser.EmvParser; import com.github.devnied.emvnfccard.provider.Provider; import com.github.devnied.emvnfccard.utils.AtrUtils; import com.github.devnied.emvnfccard.utils.ConstantUtils; import com.github.devnied.emvnfccard.utils.CroutonUtils…
tagged with: android-asynctask
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39656880
has comment: http://stackoverflow.com/comment/39656834
downvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/25421697
accepted answer: http://stackoverflow.com/a/25421697
has answer: http://stackoverflow.com/a/25421752
tagged with: jar
has comment: http://stackoverflow.com/comment/39657122
favorite count: 0
has comment: http://stackoverflow.com/comment/39657093
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/25421752

http://stackoverflow.com/a/25601833
upvote count: 2
has comment: http://stackoverflow.com/comment/55945606
downvote count: 0
has body: The problem was the template itself: At one font-tag the &lt;fontName&gt; property was missing: Does not work: &lt;font size="12" isBold="true" pdfFontName="Arial"/&gt; Does work: &lt;font fontName="Arial" size="12" isBold="true" pdfFontName="Arial" pdfEncoding="Identity-H" isPdfEmbedded="true"/&gt;
type: Answer
has comment: http://stackoverflow.com/comment/60905493
score: 2
answers question: http://stackoverflow.com/q/25548404

http://stackoverflow.com/comment/39740932
score: 0
comment on: http://stackoverflow.com/q/25466455
type: Comment
type: QuestionComment
has text: This is a very inefficient method to find out prime numbers. Use [Sieve of Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) or another method to spot them.

http://stackoverflow.com/comment/39780071
score: 0
comment on: http://stackoverflow.com/q/25487328
type: Comment
type: QuestionComment
has text: I thought you said everything was static. List contents are compiled *once* and do not change.

http://stackoverflow.com/q/25402448
type: AnsweredQuestion
score: 2
answer count: 3
downvote count: 0
tagged with: android-listview
has answer: http://stackoverflow.com/a/25402630
possible better answer: http://stackoverflow.com/a/25402630
tagged with: java
accepted answer: http://stackoverflow.com/a/25402755
has title: Listview with two xml's changing when scrolling
favorite count: 0
type: Question
has body: At the moment i'm working on a messaging page for my application. The problem is that i use two different xml's within a list view. Now i can get the data to display on the page in the correct order, however, when i scroll the data still appears in the correct order but in a different style. For example before scrolling the last message would use the messagesent.xml if i scroll up then scroll down that same message now has the message.xml style. The code i'm currently using is below. public class MessagingAdapter extends ArrayAdapter&lt;MessagingObject&gt; { private static final String userID = "USERID"; private static final int TYPE_ITEM1 = 0; private static final int TYPE_ITEM2 = 1; public String newid; public Context context; public ArrayList&lt;MessagingObject&gt; object = new ArrayList&lt;MessagingObject&gt;(); int type; public MessagingAdapter(Context context, int textViewResourceId, ArrayList&lt;MessagingObject&gt; objects) { super(context, textViewResourceId, objects); this.context = context; this.object = objects; } @Override public int getItemViewType(int position) { if (userID.equals(newid)) { type = TYPE_ITEM1; } else { type = TYPE_ITEM2; } return type; } @Override public int getViewTypeCount() { return 2; } @Override public View getView(int position, View convertview, ViewGroup parent) { MessagingObject i = object.get(position); newid = i.getMessageID(); LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertview = inflater.inflate(R.layout.messagesright_layout, null); if (convertview == null) { convertview = inflater.inflate(R.layout.messagesright_layout, null); } if (type == TYPE_ITEM1) { convertview = inflater.inflate(R.layout.messagesright_layout, null); TextView sentmessage = (TextView) convertview.findViewById(R.id.messagesent_text); sentmessage.setText(object.get(position).getMessage()); TextView senttime = (TextView) convertview.findViewById(R.id.messagesentTime); String senttimestring =…
tagged with: android-xml
tagged with: android
has answer: http://stackoverflow.com/a/25402641
has answer: http://stackoverflow.com/a/25402755
upvote count: 2

http://stackoverflow.com/a/28627150
has body: I had the same problem. I haven't found any solution, but I was able to use a self-signed certificate. I describe all the steps: Download the server certificate you want to connect, you can do it from your browser (in google chrome click right on the lock near the url of the page) Create a keystore with the following command (Remember password you entered) keytool -import -alias localhost -file certificate_path -keystore your_new_keystore I recommend you to use ClientManager instead of WebSocketContainer. This allows you to override the hostname verification. My code System.getProperties().put("javax.net.debug", "all"); //usefull to understand problems System.getProperties().put(SSLContextConfigurator.KEY_STORE_FILE, your_new_keystore_path); System.getProperties().put(SSLContextConfigurator.TRUST_STORE_FILE, your_new_keystore_path); System.getProperties().put(SSLContextConfigurator.KEY_STORE_PASSWORD, the_password_you_entered); System.getProperties().put(SSLContextConfigurator.TRUST_STORE_PASSWORD, the_password_you_enterede); ClientManager client = ClientManager.createClient(); SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator(new SslContextConfigurator()); sslEngineConfigurator.setHostVerificationEnabled(false); //skip host verification client.getProperties().put(ClientProperties.SSL_ENGINE_CONFIGURATOR, sslEngineConfigurator); client.connectToServer(you_class_with_ws_methods, your_ws_uri); you_class_with_ws_methods can be the same you use with WebSocketContainer Useful resources: https://tyrus.java.net/documentation/1.10/user-guide.html#d0e1128 https://blogs.oracle.com/PavelBucek/entry/securing_websocket_applications_on_glassfish
downvote count: 1
answers question: http://stackoverflow.com/q/25543627
score: 3
type: Answer
upvote count: 4

http://stackoverflow.com/q/25544079
has comment: http://stackoverflow.com/comment/39884046
tagged with: java
answer count: 1
tagged with: date
has comment: http://stackoverflow.com/comment/39883868
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39883871
has comment: http://stackoverflow.com/comment/39884037
has comment: http://stackoverflow.com/comment/39883821
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39884220
tagged with: date-format
has body: //fetch date and convert to date type String DateString = Integer.toString(getDay()) + "/" + Integer.toString(getMonth()) + "/" + Integer.toString(getYear()); DateFormat parser = new SimpleDateFormat("dd/MM/yyyy"); //current format of date Date date = (Date) parser.parse(DateString); //convert string to date //calculate next day Calendar cal = Calendar.getInstance(); cal.setTime(date); //set calendar time to chosen date cal.add(Calendar.DATE, 1); //add 1 day to calendar date //set object to next day parser.format(cal.getTime()); //set format to dd/MM/yyyy setDay(cal.get(cal.DAY_OF_MONTH)); setMonth(cal.get(cal.MONTH)); setYear(cal.get(cal.YEAR)); I set a date to 23 October 2002. I want to set it to the next day using the above method. It shows 24 September 2002 instead of 24 October 2002. Why is it adding 1 to the day and removing 1 from the month?
has comment: http://stackoverflow.com/comment/39883867
has title: Day and month incorrect when setting next day of date using Calendar
has answer: http://stackoverflow.com/a/25544106
tagged with: calendar
score: 1

http://stackoverflow.com/q/25543015
type: Question
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/39886017
has comment: http://stackoverflow.com/comment/39885642
tagged with: oracle-database
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/39886454
has comment: http://stackoverflow.com/comment/39884930
tagged with: javafx-2
has title: How to Achieve One Menubar for more then one scenes in javaFx
accepted answer: http://stackoverflow.com/a/25548506
has body: I am basically new to Java FX 2. Scenario: I have 3 Scenes and I want a way to add menu-bar such that I don't i don't want to explicitly remove the menu bar from previous scene and add it to new one. Like Some thing a Parent Scene or some way menu-bar is attached to Stage. I mean menu-bar is added just one time and always be present whatever scene is in front or not. If This is Possible How Can I do this. Here is the Default Example Provided by Oracle Docs of JavaFX http://docs.oracle.com/javafx/2/ui_controls/MenuSample.java.html public class Main extends Application { final ImageView pic = new ImageView(); final Label name = new Label(); final Label binName = new Label(); final Label description = new Label(); public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { stage.setTitle("Menu Sample"); Scene scene = new Scene(new VBox(), 400, 350); scene.setFill(Color.OLDLACE); MenuBar menuBar = new MenuBar(); // --- Graphical elements final VBox vbox = new VBox(); vbox.setAlignment(Pos.CENTER); vbox.setSpacing(10); vbox.setPadding(new Insets(0, 10, 0, 10)); makeContentsForVBox();// in this vBox area will be fill with name pic desrciption vbox.getChildren().addAll(name, binName, pic, description); // name is lable // --- Menu File Menu menuFile = new Menu("File"); MenuItem add = new MenuItem("Shuffle", new ImageView(new Image(getClass().getResourceAsStream("new.png")))); add.setOnAction(new EventHandler&lt;ActionEvent&gt;() { public void handle(ActionEvent t) { shuffle(); vbox.setVisible(true); } }); MenuItem clear = new MenuItem("Clear"); clear.setAccelerator(KeyCombination.keyCombination("Ctrl+X")); clear.setOnAction(new EventHandler&lt;ActionEvent&gt;() { public void handle(ActionEvent t) { vbox.setVisible(false); } }); MenuItem exit = new MenuItem("Exit"); exit.setOnAction(new EventHandler&lt;ActionEvent&gt;() { public void handle(ActionEvent t) { System.exit(0); } }); menuFile.getItems().addAll(add, clear, new SeparatorMenu…
upvote count: 3
has answer: http://stackoverflow.com/a/25548506
answer count: 1
has comment: http://stackoverflow.com/comment/39885697
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/39662082
type: QuestionComment
has text: Just tried again and it worked OK???? What did I do??
score: 0
comment on: http://stackoverflow.com/q/25423679
type: Comment

spring-mvc
tags question: http://stackoverflow.com/q/25533211
tags question: http://stackoverflow.com/q/25505028
tags question: http://stackoverflow.com/q/25470717
tags question: http://stackoverflow.com/q/25486352
tags question: http://stackoverflow.com/q/25477611
type: Tag
tags question: http://stackoverflow.com/q/25413027
tags question: http://stackoverflow.com/q/25536160
tags question: http://stackoverflow.com/q/25427876
tags question: http://stackoverflow.com/q/25521784
tags question: http://stackoverflow.com/q/25423321
tags question: http://stackoverflow.com/q/25509870
tags question: http://stackoverflow.com/q/25431922
tags question: http://stackoverflow.com/q/25514420
tags question: http://stackoverflow.com/q/25428852
tags question: http://stackoverflow.com/q/25496231
tags question: http://stackoverflow.com/q/25417721
tags question: http://stackoverflow.com/q/25491057
tags question: http://stackoverflow.com/q/25429928
tags question: http://stackoverflow.com/q/25537634
tags question: http://stackoverflow.com/q/25525746
tags question: http://stackoverflow.com/q/25398174
tags question: http://stackoverflow.com/q/25473192
tags question: http://stackoverflow.com/q/25410379
tags question: http://stackoverflow.com/q/25427684
tags question: http://stackoverflow.com/q/25416750
tags question: http://stackoverflow.com/q/25534644
tags question: http://stackoverflow.com/q/25431711
tags question: http://stackoverflow.com/q/25475023
tags question: http://stackoverflow.com/q/25425678
tags question: http://stackoverflow.com/q/25423421
tags question: http://stackoverflow.com/q/25444478
tags question: http://stackoverflow.com/q/25509483
tags question: http://stackoverflow.com/q/25451036
tags question: http://stackoverflow.com/q/25471937
tags question: http://stackoverflow.com/q/25471963
tags question: http://stackoverflow.com/q/25440502
tags question: http://stackoverflow.com/q/25527932
tags question: http://stackoverflow.com/q/25477423
tags question: http://stackoverflow.com/q/25501503
tags question: http://stackoverflow.com/q/25505486
tags question: http://stackoverflow.com/q/25506982
tags question: http://stackoverflow.com/q/25532419
tags question: http://stackoverflow.com/q/25544006
tags question: http://stackoverflow.com/q/25411616
tags question: http://stackoverflow.com/q/25448341
tags question: http://stackoverflow.com/q/25427688
tags question: http://stackoverflow.com/q/25480233
tags question: http://stackoverflow.com/q/25412778
tags question: http://stackoverflow.com/q/25442687
tags question: http://stackoverflow.com/q/25471239
tags question: http://stackoverflow.com/q/25414933
tags question: http://stackoverflow.com/q/25465805
tags question: http://stackoverflow.com/q/25435187
tags question: http://stackoverflow.com/q/25474555
tags question: http://stackoverflow.com/q/25502454
tags question: http://stackoverflow.com/q/25533928
tags question: http://stackoverflow.com/q/25402188
tags question: http://stackoverflow.com/q/25478867
tags question: http://stackoverflow.com/q/25501557
tags question: http://stackoverflow.com/q/25493382
tags question: http://stackoverflow.com/q/25546092
tags question: http://stackoverflow.com/q/25539987
tags question: http://stackoverflow.com/q/25462667
tags question: http://stackoverflow.com/q/25490027
tags question: http://stackoverflow.com/q/25515680
tags question: http://stackoverflow.com/q/25413093
tags question: http://stackoverflow.com/q/25548350
tags question: http://stackoverflow.com/q/25527656
tags question: http://stackoverflow.com/q/25394131
tags question: http://stackoverflow.com/q/25515104
tags question: http://stackoverflow.com/q/25514244
tags question: http://stackoverflow.com/q/25514588
tags question: http://stackoverflow.com/q/25546554
tags question: http://stackoverflow.com/q/25440143
tags question: http://stackoverflow.com/q/25518186
tags question: http://stackoverflow.com/q/25464500
tags question: http://stackoverflow.com/q/25398301
tags question: http://stackoverflow.com/q/25535069
tags question: http://stackoverflow.com/q/25433700

http://stackoverflow.com/comment/40947023
has text: awesome buddy!! Keep it up!
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25487190

http://stackoverflow.com/comment/47287471
type: Comment
comment on: http://stackoverflow.com/q/25407420
score: 0
has text: @Alexezio : I updated my question with the answer. it is working for me. Let me know, If you still have an issue.
type: QuestionComment

http://stackoverflow.com/a/25442249
upvote count: 2
has comment: http://stackoverflow.com/comment/39695318
downvote count: 0
has comment: http://stackoverflow.com/comment/39695301
answers question: http://stackoverflow.com/q/25442160
score: 2
type: Answer
has body: You don't need explicit Iterators to do this. Here's a simplified nested iteration with fast-enumeration: Map&lt;String, HashSet&lt;String&gt;&gt; remarksMap = new HashMap&lt;String, HashSet&lt;String&gt;&gt;(); for (String k: remarksMap.keySet()) { System.out.printf("%s%n", k); for (String v: remarksMap.get(k)) { System.out.printf("\t%s%n", v); } }

http://stackoverflow.com/a/25429215
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25428405
has body: You can use pattern matcher in java to get the address and the port information and by the way you can validate the input string as well. Pattern pattern = Pattern.compile(REGEX_FOR_IPADDRESS_WITH_PORT); Matcher matcher = pattern.matcher("127.0.0.1:80"); if (matcher.matches()) { System.out.printf("host = %s, port = %s%n", matcher.group(1), matcher.group(2)); } else { System.out.println("Invalid Ip Address"); } You can have multiple regular expression to validate V4 and V6 addresses. Hope this would help.

pst
tag name: pst
tags question: http://stackoverflow.com/q/25423005
type: Tag

http://stackoverflow.com/comment/39889012
comment on: http://stackoverflow.com/q/25547025
score: 3
type: QuestionComment
has text: What is `c`? Do you mean `SELECT c FROM Idioma c ...`?
type: Comment

http://stackoverflow.com/comment/39851478
score: 0
type: Comment
type: AnswerComment
has text: That's a good question---I don't know. I would like to try it. The problem is that I can no longer reproduce the issue (which is partly why I asked the original question). So, if I can reproduce the issue consistently, I will keep this option in mind.
comment on: http://stackoverflow.com/a/25462440

http://stackoverflow.com/comment/39767009
comment on: http://stackoverflow.com/q/25480357
type: Comment
type: QuestionComment
score: 0
has text: @mKorbel If the OP wants the file to be deleted when the first instance exists, that while not use `deleteOnExit`...the file can't be deleted while it's locked ... :P

http://stackoverflow.com/a/25535974
type: Answer
has comment: http://stackoverflow.com/comment/39869586
has comment: http://stackoverflow.com/comment/39870739
has comment: http://stackoverflow.com/comment/39870787
score: 0
answers question: http://stackoverflow.com/q/25535352
has comment: http://stackoverflow.com/comment/39870006
has comment: http://stackoverflow.com/comment/39870371
has comment: http://stackoverflow.com/comment/39870183
has body: Yes, I'd agree that "instance" and Object are the same thing. 1 : A a; // Declaring a reference variable of class A 2 : a = new A();// Instantiating an object of class A 3 : Object o = a; // a is also an object All instances in Java are also Objects, so they're the same thing. That's an is-a relationship. You can say that any instance in Java is-a Object. Objects are a type (class), and you can make instances of just type Object alone if you want. Object x = new Object(); Classes are also objects. 4 : Class&lt;A&gt; atype = a.getClass(); 5 : Object otype = atype; So objects (instances) have-a Class, and classes are objects too. I think this is why things are so murky, all these words bear a very close relationship. Note all the things on the left hand side are also called reference types.

http://stackoverflow.com/q/25540738
tagged with: java
answer count: 1
has title: I can't seem to get this inheritance to work
accepted answer: http://stackoverflow.com/a/25540867
type: Question
tagged with: setter
tagged with: inheritance
has answer: http://stackoverflow.com/a/25540867
type: AnsweredQuestion
score: 0
has body: I have a tabbed application. One of the tabs you can enter the name of the company and it should change it to whatever you typed into the other tab. Here are both classes. On this code its telling me to change About.setCompanyName(str); to static The error that I am seeing is "Cannot make a static reference to the non-static method SetCompanyName(String) from the type About" package CourseProject; import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.*; import javax.swing.*; public class Options extends JPanel{ private JLabel changeLabel; private JTextField changeName; private JButton setName; private JButton exitButton; public Options(){ GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NORTH; setBackground(Color.WHITE); super.setLayout(gridbag); c.insets = new Insets(10, 10, 10, 10); changeLabel = new JLabel("Change Company Name:"); changeName = new JTextField("", 10); setName = new JButton("Set New Name"); exitButton = new JButton("Exit"); c.gridx = 0; c.gridy = 0; c.gridwidth = 2; add(changeLabel, c); c.gridx = 0; c.gridy = 1; add(changeName, c); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; add(setName, c); setName.addActionListener(new setNameAction()); c.gridx = 1; c.gridy = 2; add(exitButton, c); exitButton.addActionListener(new exitApp()); exitButton.setSize(40,40); } class setNameAction implements ActionListener { public void actionPerformed(ActionEvent e) { String str; str = changeName.getText(); About.SetCompanyName(str); changeName.setText(""); } } class exitApp implements ActionListener { public void actionPerformed(ActionEvent e) { System.exit(0); } } } And here is "About" which contains my setter. It asks me to make the method and variable static but I know this wont work because I am wanting to change it package CourseProject; import j…

http://stackoverflow.com/a/25399719
type: AcceptedAnswer
type: Answer
has body: Did you do any research on basic command execution and file redirection inside (bash) shell scripts? Your question is a bit unclear, so by “input” and “output” I suppose you mean standard input and output. python tweet.py &gt; tweet.csv python translate.py &lt; tweet.csv &gt; translated.csv java -jar TextClean.jar &lt; translates.csv &gt; cleansed.csv If you don't care about the intermediate results you can chain those commands together in a pipe: python tweet.py | python translate.py | java -jar TextClean.jar &gt; cleansed.csv
score: 0
answers question: http://stackoverflow.com/q/25399536
accepted answer of: http://stackoverflow.com/q/25399536

http://stackoverflow.com/a/25476339
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25476178
accepted answer of: http://stackoverflow.com/q/25476178
has body: First add this Permission to the Manifest &lt;uses-permission android:name="android.permission.SET_WALLPAPER"&gt; Now for some code. imageview.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { WallpaperManager myWallpaperManager = WallpaperManager.getInstance(context); try { myWallpaperManager.setResource(GalImages[position]); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); Explantion : This will set that the Image will be clickable , when the image is clicked it will set the phone Wallpaper with the selected drawable. getApplicationContext() is the Context from the Activity. This changes will take place inside the Adapter. Activity add this variable int currentPosition;

http://stackoverflow.com/q/25550669
tagged with: android
tagged with: java
tagged with: email
has comment: http://stackoverflow.com/comment/39897033
has comment: http://stackoverflow.com/comment/39897288
has comment: http://stackoverflow.com/comment/39896460
type: Question
score: 0
type: UnansweredQuestion
answer count: 1
has title: JavaMail API getting NullpointerException
has comment: http://stackoverflow.com/comment/39898246
has comment: http://stackoverflow.com/comment/39900791
has body: I'am trying to send an eMail without useing an eMail client. So I tried the code given in some tutorials. But always, when I try sending my eMail, the sending fails with an NullPointerException on the transport.connect() Method. My code package com.example.app; import java.io.UnsupportedEncodingException; import java.util.List; import java.util.Properties; import javax.mail.AuthenticationFailedException; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import android.util.Log; public class GMail { final String emailPort = "587";// gmail's smtp port final String smtpAuth = "true"; final String starttls = "true"; final String emailHost = "smtp.gmail.com"; // final String fromUser = "****"; // final String fromUserEmailPassword = "****"; String fromEmail; String fromPassword; List&lt;String&gt; toEmailList; String emailSubject; String emailBody; Properties emailProperties; Session mailSession; MimeMessage emailMessage; public GMail() { } public GMail(String fromEmail, String fromPassword, List&lt;String&gt; toEmailList, String emailSubject, String emailBody) { this.fromEmail = fromEmail; this.fromPassword = fromPassword; this.toEmailList = toEmailList; this.emailSubject = emailSubject; this.emailBody = emailBody; emailProperties = System.getProperties(); emailProperties.put("mail.smtp.port", emailPort); emailProperties.put("mail.smtp.auth", smtpAuth); emailProperties.put("mail.smtp.starttls.enable", starttls); Log.i("GMail", "Mail server properties set."); } public MimeMessage createEmailMessage() throws AddressException, MessagingException, UnsupportedEncodingException { mailSession = Session.getInstance(emailProperties, null); emailMessage = new MimeMessage(mailSession); emailMessage.setFrom(new InternetAddress(fromEmail, fromEmail)); for (String toEmail : toEmailList) …
has answer: http://stackoverflow.com/a/25552967
has comment: http://stackoverflow.com/comment/39898169

http://stackoverflow.com/q/25510978
upvote count: 4
tagged with: hadoop
answer count: 2
has body: I'm setting Hadoop 2.5.0 on a single machine, I'm having problem with the datanode that is not running as shown by the jps command's output: $ jps 3404 Jps 2661 NodeManager 2606 ResourceManager 2484 NameNode When I try to run it manually I got this: $HADOOP_HOME/sbin/hadoop-daemon.sh start datanode starting datanode, logging to /home/arbi/Programs/hadoop-2.5.0/logs/hadoop-arbi-datanode-ElOued.out Then still nothing, here is the content of hadoop-arbi-datanode-ElOued.out: ulimit -a for user arbi core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 15862 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 15862 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited Also in http://oued.souf.dz:50070/dfshealth.html#tab-datanode there is no datanode that can be seen. And when I submit hadoop jobs I see the following exception: 14/08/26 17:41:59 WARN mapreduce.JobSubmitter: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 14/08/26 17:41:59 WARN hdfs.DFSClient: DataStreamer Exception org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /tmp/hadoop-yarn/staging/arbi/.staging/job_1409065677616_0001/job.jar could only be replicated to 0 nodes instead of minReplication (=1). There are 0 datanode(s) running and no node(s) are excluded in this operation. at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget(BlockManager.java:1471) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2791) at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:606) at org.apache.h…
type: UnansweredQuestion
has title: Datanode daemon not running on Hadoop 2.5.0
tagged with: hadoop-yarn
has answer: http://stackoverflow.com/a/25523532
downvote count: 0
has comment: http://stackoverflow.com/comment/39845404
tagged with: hdfs
score: 4
tagged with: java
has answer: http://stackoverflow.com/a/25605985
tagged with: mapreduce
linked to: http://stackoverflow.com/q/25554351
has comment: http://stackoverflow.com/comment/39843194
favorite count: 0
type: Question

http://stackoverflow.com/q/25422223
has title: How to invoke a progress bar by clicking a button in another frame?
tagged with: swing
has comment: http://stackoverflow.com/comment/39660383
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/39697640
linked to: http://stackoverflow.com/q/20600721
score: 0
has comment: http://stackoverflow.com/comment/39698498
tagged with: java
has body: I have two frames in my java program. One is for the credential window and another for the progress bar. When I click the login button the progress bar should also start working. This is my code package Javapkg; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.beans.*; import java.io.IOException; import java.util.Map; import java.util.Random; public class ProgressBarDemo extends JPanel implements ActionListener, PropertyChangeListener { private static final long serialVersionUID = 1L; JFrame frame; JPanel panel; JTextField userText; JPasswordField passwordText; JButton loginButton; JLabel userLabel; JLabel passwordLabel; JButton cancelButton; JButton startButton; private JProgressBar progressBar; // private JButton startButton; private JTextArea taskOutput; private Task task; class Task extends SwingWorker&lt;Void, Void&gt; { /* * Main task. Executed in background thread. */ public void Credential() { JFrame frame = new JFrame(); frame.setUndecorated(true); frame.setBackground(new Color(0, 0, 0, 0)); frame.setSize(new Dimension(400, 300)); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new JPanel() { private static final long serialVersionUID = 1L; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (g instanceof Graphics2D) { final int R = 220; final int G = 220; final int B = 250; Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B, 0), 0.0f, getHeight(), new Color(R, G, B, 255), true); Graphics2D g2d = (Graphics2D) g; g2d.setPaint(p); g2d.fillRect(0, 0, getWidth(), getHeight()); Font font = new Font("Serif", Font.PLAIN, 45); g2d.setFont(font); g2d.setColor(Color.lightGray); g2d.drawString("Get Credential", 60, 80); } } }; frame.setContentPane(panel); frame.setLayout(new FlowLayout()); frame.placeComponents(panel); } public void placeComponents(JPanel panel) { panel.setLayout(null); userLabel = new JLabel("User"); userLabel.setBounds(40, 100, 80, 25);…
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/39661601
linked to: http://stackoverflow.com/q/5621338
type: Question
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39660098
tagged with: powershell

http://stackoverflow.com/comment/39713635
comment on: http://stackoverflow.com/q/25451420
has text: If you're trying to get the _local variable_ named "foo_Bar" at runtime, you can't do that. No way, no how.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25470853
has comment: http://stackoverflow.com/comment/39762961
has comment: http://stackoverflow.com/comment/39749139
tagged with: java
tagged with: database
tagged with: sqlite
has comment: http://stackoverflow.com/comment/39839400
favorite count: 0
has comment: http://stackoverflow.com/comment/39750681
type: Question
score: 2
has comment: http://stackoverflow.com/comment/39749699
answer count: 0
upvote count: 2
has title: Java and SQLite: avoid database locking errors
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39749327
downvote count: 0
has body: Scenario: I am trying to write a program that can read and write to an SQLite database. The application can be opened by multiple computers connected by a network/shared folder with the db file (so that multiple people can add/read the data at once). Problem: Whenever I try to edit the database with more than 1 window open, the 'database is locked' error inevitably comes up (they can simultaneously read it fine). I am closing every resultSet as soon as possible but the connection is kept open the whole time. So essentially, I would like to know when the database is locked/unlocked, and if it is possible to only lock the database when updating and unlock it at other times. My code to connect to the database is: try { //Create and/or connect to the database Class.forName("org.sqlite.JDBC"); //c is a global Connection variable c = DriverManager.getConnection("jdbc:sqlite:" + dbLocation); c.setAutoCommit(false); } catch ( Exception e ) { //print the error message if there is an exception System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.exit(0); } The connection is maintained throughout the time the application is run and closed c.close(); when the application interface is closed Thanks :)
has comment: http://stackoverflow.com/comment/39749880
has comment: http://stackoverflow.com/comment/39750707

http://stackoverflow.com/a/25471372
answers question: http://stackoverflow.com/q/25471319
has body: As stated above in the comment section, Arrays start with index 0, thus if you have an array with 3 elements, the index are 0..1..2 and not 1..2..3 All you have to do is change the String tmpVal = returnValue.toString().split("~")[3]; to: String tmpVal = returnValue.toString().split("~")[2]; As that will obtain the 3rd element instead of the fourth element as you've been trying to do. You may also check out this question
score: 0
type: Answer

http://stackoverflow.com/q/25477073
has body: final Button Btn = (Button) findViewById(R.id.Btn); Btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(),"Some text here"+ Wynik,Toast.LENGTH_SHORT).show(); But then I'm recived this error Error:(87, 69) error: local variable Wynik is accessed from within inner class; needs to be declared final Wynik is in my @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); int Wynik; And lower in code but in this same class Wynik = 70*RT/100 + tspocz; My final Button is under that code (I'm makeing this app in Android Studio) if that have a matter.
type: AnsweredQuestion
has title: How to declare var like a final if this var was defined in method in Android Studio
tagged with: android
tagged with: java
favorite count: 0
tagged with: android-studio
type: Question
accepted answer: http://stackoverflow.com/a/25477144
has answer: http://stackoverflow.com/a/25477144
upvote count: 0
tagged with: final
score: -2
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/39760538

http://stackoverflow.com/comment/39678872
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25417098
has text: No even if Box is next to fruit, it cannot see fruit's type t.

http://stackoverflow.com/comment/39806401
has text: Hi all.The scenario is i will be getting a .bin file and to load this into a Device i need to put it into a location where the tftp server is mounted in PC where the web application is running. in order to access the mount point i need always root permission.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25501568

http://stackoverflow.com/comment/39742025
type: AnswerComment
has text: @JohnMerlino See the link in my first comment. Both sequences are used.
type: Comment
comment on: http://stackoverflow.com/a/25466975
score: 0

http://stackoverflow.com/a/25508333
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39819024
accepted answer of: http://stackoverflow.com/q/25508309
has comment: http://stackoverflow.com/comment/39818843
answers question: http://stackoverflow.com/q/25508309
has body: You can use: String repl = input.replaceAll("[^ ]", "-"); OR: String repl = input.replaceAll("\\S", "-"); Here \\S will anything but a white-space whereas [^ ] will match anything but a space.
downvote count: 0

http://stackoverflow.com/a/45280632
type: Answer
has body: You must give the correct name of font for the PDF exporter. Your fonts are presents into the embedded fonts jar. You don't need to put them again into the classes directory ;-) There is the correct fonts.xml content for pdf exporter (perhaps the names are case sensitive, be careful) : <?xml version="1.0" encoding="UTF-8"?> fonts/Arial/ARIAL.TTF fonts/Arial/ARIAL.TTF fonts/Arial/ARIALBD.TTF fonts/Arial/ARIALBD.TTF fonts/Arial/ARIALI.TTF fonts/Arial/ARIALI.TTF fonts/Arial/ARIALBI.TTF fonts/Arial/ARIALBI.TTF Cp1252 true I hope this help. Regards, T.
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25548404
has comment: http://stackoverflow.com/comment/139134695
downvote count: 0

http://stackoverflow.com/comment/39661313
type: Comment
has text: oh my godness!!! It works perfect :-) thank you so much. I completely overlooked it. I'm a beginner and thankful for each help.
comment on: http://stackoverflow.com/a/25422874
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39843302
comment on: http://stackoverflow.com/q/25521220
has text: @ManishL, so what should the code to remove the view be? `removeView(?)`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39608954
score: 0
type: AnswerComment
has text: Thank you very much! I believe this is exactly what I'm looking for. I'm going to let the questions sit overnight before choosing an answer so I can gather a little more information. I will select an answer tomorrow. Thanks again!
comment on: http://stackoverflow.com/a/25395230
type: Comment

http://stackoverflow.com/q/25393018
has answer: http://stackoverflow.com/a/29926780
type: Question
linked to: http://stackoverflow.com/q/7598422
linked to: http://stackoverflow.com/q/19307657
type: UnansweredQuestion
tagged with: java
has body: I am trying to run multiple Map/Reduce tasks in Hadoop. After searching on google, I went with method 2 as described at http://cloudcelebrity.wordpress.com/2012/03/30/how-to-chain-multiple-mapreduce-jobs-in-hadoop/ : use JobControl. I got the following error: /examples2/format/Dictionary.java:100: error: no suitable method found for addJob(org.apache.hadoop.mapreduce.Job) jbcntrl.addJob(job); ^ method JobControl.addJob(org.apache.hadoop.mapred.jobcontrol.Job) is not applicable (actual argument org.apache.hadoop.mapreduce.Job cannot be converted to org.apache.hadoop.mapred.jobcontrol.Job by method invocation conversion) As described at Is it better to use the mapred or the mapreduce package to create a Hadoop Job?, there are two different API's, which seem to misaligned here. After looking further, I found JobControl and JofConf.setMapperClass() error. They say that using the mapreduce package org.apache.hadoop.mapreduce.lib.jobcontrol.JobControl' instead of 'org.apache.hadoop.mapred.jobcontrol.JobControl should solve it. Only problem is: I am using this. When I take a look at this particular file (hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/jobcontrol/JobControl.java in the sourcecode), I see it is using import org.apache.hadoop.mapred.jobcontrol.Job; instead of import org.apache.hadoop.mapreduce.Job; Which seems to me to be causing the error (correct?). Is there any way, other than reverting code back to mapred, to get around this? Or any other way of running multiple M/R jobs? Update: I got method 1 from http://cloudcelebrity.wordpress.com/2012/03/30/how-to-chain-multiple-mapreduce-jobs-in-hadoop/ to work, but I am still interested in the answer for the problem.
has answer: http://stackoverflow.com/a/29912026
tagged with: mapreduce
tagged with: job-control
has answer: http://stackoverflow.com/a/58543878
tagged with: hadoop
answer count: 3
score: 0
has title: Hadoop jobcontrol

http://stackoverflow.com/a/25446227
upvote count: 2
downvote count: 0
has body: Declare and initialize an int variable to 0 outside the processing loop. Increment it while processing whenever you replace a s with an S. As a side note, it is obviously out of the scope of this question, but using the + operator for repetitive String concatenation is highly inefficient. You should use a StringBuilder instead.
answers question: http://stackoverflow.com/q/25446189
type: Answer
score: 2

http://stackoverflow.com/comment/39854615
type: Comment
score: 4
has text: Did you try anything?
comment on: http://stackoverflow.com/q/25527977
type: QuestionComment

http://stackoverflow.com/comment/39820172
has text: @dic19 how can i make that happen ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25508668

http://stackoverflow.com/comment/39892427
type: AnswerComment
comment on: http://stackoverflow.com/a/25529154
has text: That shouldn't be a problem. The html/JS is also packaged in a bundle, so you can update them the same way.
score: 0
type: Comment

http://stackoverflow.com/comment/39843050
score: 0
comment on: http://stackoverflow.com/q/25521257
type: Comment
type: QuestionComment
has text: have a loot at OpenSessionInView filter

http://stackoverflow.com/q/25545313
has comment: http://stackoverflow.com/comment/39886731
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39887210
has comment: http://stackoverflow.com/comment/39918898
score: 2
has title: get Generated key for jdbc execute batch
downvote count: 0
tagged with: java
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39899300
has body: I would like to fetch all generated keys for storing arraylist values in database in jdbc batch updation and I would like to set generated value in pmu.setId(); I am using Mysql Database and driver mysql-connector-java 5.1.14 My code is : ps1 = con.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); for (PostMessageUsers pmu : pmuList) { ps1.setLong(1, pm.getMessageid()); ps1.setLong(2, pmu.getAtomByReceivedBy().getId()); ps1.setLong(3, pmu.getAtomBySentBy().getId()); ps1.setLong(4, pmu.getAtomByAuthor().getId()); ps1.addBatch(); if (++batchCount % BATCH_SIZE == 0) { ps1.executeBatch(); res = ps.getGeneratedKeys(); if (res.next()) { pmu.setId((long) res.getInt(1)); } } } int postMessageUsers[] = ps1.executeBatch(); } I am able to get gererated id inside if (++batchCount % BATCH_SIZE == 0) { But I would like to know how to get gererated id for last int postMessageUsers[] = ps1.executeBatch(); If above statement executes how can i get generated id for this.
favorite count: 0
has comment: http://stackoverflow.com/comment/39886285
type: Question
upvote count: 2

http://stackoverflow.com/q/25413497
tagged with: java
has answer: http://stackoverflow.com/a/25413652
accepted answer: http://stackoverflow.com/a/25413652
has body: How do you tell JAXB to use the @XmlRootElement annotation of data wrapped in a @XmlElementWrapper collection? I know you can use @XmlElement to name each, individual item but I'm curious to see if there is a way to just have it automatically pick it up for me. For example: @XmlElementWrapper (name = "records") private List&lt;?&gt; records; Will Produce: &lt;records&gt; &lt;records ...&gt; &lt;child_with_proper_name ... /&gt; &lt;/records&gt; But let's say the List contains objects of: @XmlRootElement (name = "my_element") I want to generate this: &lt;records&gt; &lt;my_element&gt; &lt;child_with_proper_name /&gt; &lt;/my_element&gt; &lt;/records&gt; Without doing this: @XmlElementWrapper (name = "records") @XmlElement (name = "my_element") private List&lt;?&gt; records; It seems like it should know to pick up the @XmlRootElement name, but it does not do that.
answer count: 1
tagged with: jaxb
favorite count: 0
type: Question
score: 2
upvote count: 2
type: AnsweredQuestion
has title: JAXB @XmlElementWrapper to use @XmlRootElement of wrapped object
downvote count: 0

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

http://stackoverflow.com/comment/39800474
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25498525
has text: cant you send just a string?

http://stackoverflow.com/comment/39756548
type: QuestionComment
score: 1
has text: @BoristheSpider In the question that I've attached there is a Swing example. It also has link to `How to Use Swing Timers doc`. Is that not a valid example? Isn't that something to start with?
comment on: http://stackoverflow.com/q/25474760
type: Comment

http://stackoverflow.com/q/25414017
has title: Combining Arrays with 2 dimensions
tagged with: java
downvote count: 2
answer count: 1
favorite count: 0
type: Question
has body: I need a little with aligning my arrays. Would I need more Vectors and then do an add row. My first column are checkboxes. Row 0 should be L that have array1 Row 1 should R that have array2 Row3 should be S that have array3 String array1[] = { dateString1, "10:18:17 PM"}; String array2[] = {"08:09:110 AM", "10:00:33 AM"}; String array3[] = {"09:00:561 PM", "07:12:19 AM"}; String array4[] = { dateString1, "10:18:17 PM"}; String array5[] = {"08:09:101 AM", "10:00:33 AM"}; String array6[] = {"09:00:561 PM", "07:12:19 AM"}; String array7[] = { dateString1, "10:18:17 PM"}; String array8[] = {"08:09:1011 AM", "10:00:33 AM"}; String[] p = {"L", "S", "R", "T", "D", "C", "L", "R"}; boolean[] t3; Desire output: L dateString1 10:18:17 PM S 08:09:110 AM 10:00:33 AM R 09:00:561 PM 7:12:19 AM so on…
accepted answer: http://stackoverflow.com/a/25414180
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/25414180
type: AnsweredQuestion

http://stackoverflow.com/q/25393873
has title: Activity crash when I reload it
score: 0
type: UnansweredQuestion
tagged with: java
answer count: 1
has body: I'm trying to do an activity that saves with sharedpreferences a int that you choose in a spinner and I'm trying to make that when the user click in a menu the activity reload with the different value of the sharedpreferences int (previously chosed in the spinner), but when the user reload the app it crashes with this message: 08-19 19:02:56.145: D/AndroidRuntime(23142): Shutting down VM 08-19 19:02:56.145: W/dalvikvm(23142): threadid=1: thread exiting with uncaught exception (group=0x4164bd40) 08-19 19:02:56.146: E/AndroidRuntime(23142): FATAL EXCEPTION: main 08-19 19:02:56.146: E/AndroidRuntime(23142): Process: com.example.fluviales, PID: 23142 08-19 19:02:56.146: E/AndroidRuntime(23142): java.lang.NullPointerException 08-19 19:02:56.146: E/AndroidRuntime(23142): at com.example.fluviales.Home_fragment$1$1.run(Home_fragment.java:49) 08-19 19:02:56.146: E/AndroidRuntime(23142): at android.os.Handler.handleCallback(Handler.java:733) 08-19 19:02:56.146: E/AndroidRuntime(23142): at android.os.Handler.dispatchMessage(Handler.java:95) 08-19 19:02:56.146: E/AndroidRuntime(23142): at android.os.Looper.loop(Looper.java:136) 08-19 19:02:56.146: E/AndroidRuntime(23142): at android.app.ActivityThread.main(ActivityThread.java:5086) 08-19 19:02:56.146: E/AndroidRuntime(23142): at java.lang.reflect.Method.invokeNative(Native Method) 08-19 19:02:56.146: E/AndroidRuntime(23142): at java.lang.reflect.Method.invoke(Method.java:515) 08-19 19:02:56.146: E/AndroidRuntime(23142): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 08-19 19:02:56.146: E/AndroidRuntime(23142): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 08-19 19:02:56.146: E/AndroidRuntime(23142): at dalvik.system.NativeStart.main(Native Method) The weird thing to me is that if I reload the activity using Intent intent = getIntent(); finish(); startActivity(intent); the activity crash, but if I close the app in the multitask and the re-open it the code works! Here is my Ma…
linked to: http://stackoverflow.com/q/5185015
type: Question
has answer: http://stackoverflow.com/a/25394189
tagged with: android-fragments
tagged with: android

http://stackoverflow.com/comment/39658774
comment on: http://stackoverflow.com/q/25422011
score: 0
type: Comment
has text: Which version of Java you are working on?
type: QuestionComment

http://stackoverflow.com/comment/39890877
comment on: http://stackoverflow.com/q/25547895
type: Comment
has text: Yes the index is created for both (createdAt and temporary)!
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39884494
comment on: http://stackoverflow.com/a/25543075
type: Comment
has text: +some in memory db -- It is a solution. So, now I have +2 (smart) votes for using in-memory DB. And 0! votes for writing mockups for database-related stuff (factory, dao). Very strange. Cause mostly people claim dependency injection to be the answer for "how to actually write test code".
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39767817
comment on: http://stackoverflow.com/q/25480708
score: 0
type: Comment
has text: your getting a timeout because you havent configured the companys proxy in your java code. The mentioned url is the web-proxy. read here for more info: http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol
type: QuestionComment

http://stackoverflow.com/comment/39717508
score: 0
type: QuestionComment
has text: I think I see 1001 threads in your code
type: Comment
comment on: http://stackoverflow.com/q/25453917

http://stackoverflow.com/q/25410012
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39635993
has body: I have a class as follows public class GenericObjectBuilder { private Class&lt;?&gt; classType; public GenericObjectBuilder(Class&lt;?&gt; classType) { this.classType = classType; } } I want to be able to add a method (eg getObject) to this class that will return an object of type '?', so that the constructor will determine the return type of this method. Eg GenericObjectBuilder gc1 = new GenericObjectBuilder(String.class); String value = gc1.getObject(); GenericObjectBuilder gc2 = new GenericObjectBuilder(Integer.class); Integer value = gc2.getObject(); I cannot use proper generics in this scenario. For example I cannot do GenericObjectBuilder&lt;String&gt; gc1 = new GenericObjectBuilder&lt;&gt;(); String value = gc1.getValue(); Is this possible using the constructor argument?
has comment: http://stackoverflow.com/comment/39636145
score: 1
has comment: http://stackoverflow.com/comment/39635973
tagged with: java
has comment: http://stackoverflow.com/comment/39635964
answer count: 1
downvote count: 0
has title: Safe method return type for unknown generic during construction
upvote count: 1
tagged with: methods
has comment: http://stackoverflow.com/comment/39636053
tagged with: generics
has comment: http://stackoverflow.com/comment/39635871
has comment: http://stackoverflow.com/comment/39636256
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39636023
has comment: http://stackoverflow.com/comment/39636069
has answer: http://stackoverflow.com/a/25410880

http://stackoverflow.com/comment/39640182
type: Comment
has text: I added this issue with jetbrains: http://youtrack.jetbrains.com/issue/IDEA-128837
type: QuestionComment
comment on: http://stackoverflow.com/q/25406294
score: 1

http://stackoverflow.com/comment/39832101
comment on: http://stackoverflow.com/q/25515064
has text: Use different comparators for different class types, or make your BeanComparator generic. I'm guessing it's strongly typed to String
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39793779
comment on: http://stackoverflow.com/a/25493170
has text: could you please provide the code in pastebin ?.. I am new to android...And thanks for reply...
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39617276
type: Comment
has text: i had no idea to do that in a simple way...
comment on: http://stackoverflow.com/q/25400055
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39623907
comment on: http://stackoverflow.com/q/25403699
type: Comment
type: QuestionComment
has text: A better explanation of the 2nd output would help to give you a solution.
score: 0

http://stackoverflow.com/comment/39753587
score: 2
type: Comment
has text: Does the phrase "element at index 3 of a sparse array" make any sense to you? According to your definitions, it doesn't make sense because a sparse array cannot generally be implemented such that an index corresponds to a location within a structure.
comment on: http://stackoverflow.com/a/25472967
type: AnswerComment

svn
tags question: http://stackoverflow.com/q/25403075
tags question: http://stackoverflow.com/q/25528969
tags question: http://stackoverflow.com/q/25423505
tags question: http://stackoverflow.com/q/25390200
tags question: http://stackoverflow.com/q/25442664
type: Tag
tags question: http://stackoverflow.com/q/25406182
tags question: http://stackoverflow.com/q/25421573
tag name: svn
tags question: http://stackoverflow.com/q/25396395

http://stackoverflow.com/a/25473060
answers question: http://stackoverflow.com/q/25472281
score: 4
accepted answer of: http://stackoverflow.com/q/25472281
has comment: http://stackoverflow.com/comment/104022132
has comment: http://stackoverflow.com/comment/136241612
type: Answer
upvote count: 4
has body: You could use the Java Deep-Cloning Library to make deep copies of objects. It is really useful when you can't (or don't want) to make your classes serializable. The use is straight-forward: Cloner cloner = new Cloner(); MyClass clone = cloner.deepClone(o); // clone is a deep-clone of o
has comment: http://stackoverflow.com/comment/114984284
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39767427
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25449042
score: 0
has text: Sorry for not stating the version at the beginning. Could you suggest anything about how to assign value to 'user' object for play 1.2.5 version? @Moebius

velocity
tags question: http://stackoverflow.com/q/25539104
tags question: http://stackoverflow.com/q/25431007
tags question: http://stackoverflow.com/q/25490396
tags question: http://stackoverflow.com/q/25527144
tags question: http://stackoverflow.com/q/25449797
tag name: velocity
type: Tag
tags question: http://stackoverflow.com/q/25448447

http://stackoverflow.com/comment/39809842
type: Comment
type: QuestionComment
score: 0
has text: i got Solution sdf.setTimeZone(TimeZone.getTimeZone("UTC")); i have to remove this thats it
comment on: http://stackoverflow.com/q/25503018

http://stackoverflow.com/comment/39821619
type: AnswerComment
has text: when i do the alert on url is coming a success.
type: Comment
comment on: http://stackoverflow.com/a/25478872
score: 0

http://stackoverflow.com/a/25442486
has comment: http://stackoverflow.com/comment/39696463
has comment: http://stackoverflow.com/comment/39985267
has comment: http://stackoverflow.com/comment/39987413
downvote count: 0
answers question: http://stackoverflow.com/q/25442323
has comment: http://stackoverflow.com/comment/39985965
has comment: http://stackoverflow.com/comment/39985470
has comment: http://stackoverflow.com/comment/39985935
has comment: http://stackoverflow.com/comment/39988202
has comment: http://stackoverflow.com/comment/39985212
has comment: http://stackoverflow.com/comment/39987124
has comment: http://stackoverflow.com/comment/39990764
has comment: http://stackoverflow.com/comment/39985531
has comment: http://stackoverflow.com/comment/39991461
has comment: http://stackoverflow.com/comment/39985915
has comment: http://stackoverflow.com/comment/39960150
type: Answer
has comment: http://stackoverflow.com/comment/39959891
score: 11
has comment: http://stackoverflow.com/comment/39696256
upvote count: 11
has body: No, there is no state that's being shared between different threads so the situation you described can not happen. If instead st was a member variable of that class, instead of being passed as an argument, and was incremented - that's a different story. How it works now is that st will be put on the execution stack, each thread has it's own execution stack and they don't share stuff from there. Therefore each thread has it's own value of st. When it's a member variable of a class it's in memory (single value) and all threads would try to use it (the same one). @Edit: well I guess it is possible if you call the method several times with the same value :-))
has comment: http://stackoverflow.com/comment/39696053
has comment: http://stackoverflow.com/comment/39695913
has comment: http://stackoverflow.com/comment/39696322
has comment: http://stackoverflow.com/comment/39991178

http://stackoverflow.com/comment/39852010
score: 0
has text: Yes when I execute it from eclipse it works. So I think jar doesn't contain the folder and this is the problem
comment on: http://stackoverflow.com/q/25526479
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25478659
has comment: http://stackoverflow.com/comment/39763590
has title: Simplifying code in a class hierarchy
linked to: http://stackoverflow.com/q/9245408
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25478794
type: Question
accepted answer: http://stackoverflow.com/a/25478739
has comment: http://stackoverflow.com/comment/39763572
tagged with: static
linked to: http://stackoverflow.com/q/10594052
has answer: http://stackoverflow.com/a/25478739
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/25478794
has comment: http://stackoverflow.com/comment/39763559
tagged with: class
type: AnsweredQuestion
answer count: 2
has body: At the top of my class hierarchy is the class Mammal. Each instance of Mammal is required to statically initialize itself. (The example is silly, I know. If you are curious, I am using Android fragments and I cannot override their constructors) For example: public abstract class Mammal{ private static initialize(int a, String b, ...){ ... } } public class Dog extends Mammal{ public static Dog newInstance(int a, String b, ...){ Dog dog = new Dog(); initialize(a, b, ...); } } public class Cat extends Mammal{ public static Cat newInstance(int a, String b, ...){ Cat cat = new Cat(); initialize(a, b, ...); return cat; } } The classes could continue indefinitely. I have looked into calling a subclass constructor from a superclass but I cannot figure out how to apply it to a static context. Thanks in advance!
upvote count: 0
linked to: http://stackoverflow.com/q/891824

http://stackoverflow.com/comment/39674563
type: Comment
has text: ClearLag is open-sourced. (I contribute to the project as well.) Just clone it, add handlers and recompile. Working around it is too much work to bare with. However if you do insist so, [Joiner's answer does the trick](http://stackoverflow.com/a/25420280/3622940).
score: 0
comment on: http://stackoverflow.com/q/25413725
type: QuestionComment

http://stackoverflow.com/a/25471169
answers question: http://stackoverflow.com/q/25471022
downvote count: 1
upvote count: 0
type: Answer
score: -1
has body: Try to use Access-Control-Allow-Origin with the concrete domain instead of *.

http://stackoverflow.com/a/25544579
accepted answer of: http://stackoverflow.com/q/25525477
answers question: http://stackoverflow.com/q/25525477
type: Answer
has body: OK, found out what I was missing, it was just a way of creating the branch and send it to the data in the http: var branch = { protectedBranch:"some_branch", newBranch:"some_branch", commitId: "some_commit", commiter:"some_commiter" } $scope.retry = function() { $http({ url : "rest/branches", method : "POST", data : branch, headers : { "Content-Type" : "application/json; charset=utf-8", "Accept" : "application/json" } }).success(function(data) { $scope.items = data; }).error(function(data) { alert('err'); }); hope it will be help to others.
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39624685
score: 0
has text: Did you try a virus scan? (Sorry for the thought.)
comment on: http://stackoverflow.com/q/25404145
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25465147
has title: Method call is ambigous with varargs operator
has answer: http://stackoverflow.com/a/25465251
has comment: http://stackoverflow.com/comment/39741419
tagged with: variadic-functions
answer count: 4
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39739134
possible better answer: http://stackoverflow.com/a/25465207
tagged with: scjp
upvote count: 2
accepted answer: http://stackoverflow.com/a/25466287
has answer: http://stackoverflow.com/a/25465207
has body: The code below produces the syntax error: The method f(int[]) is ambiguous for the type C My code: public class C{ public static void f(int... i) { System.out.println("a"); } public static void f(Integer... i) { System.out.println("b"); } public static void main(String[] args) { f(new Integer(2)); } } If I use array notation [] instead of the ... and call the function properly with f(new Integer[]{3,4,5}), the compiler can correctly decide which method do I want to use. What is the reason the compiler cannot decide which function to call with ...?
downvote count: 0
has answer: http://stackoverflow.com/a/25466287
has comment: http://stackoverflow.com/comment/39738423
has answer: http://stackoverflow.com/a/25465180
score: 2
tagged with: overloading
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25516797
answer count: 3
has body: I use hibernate, spring mvc, and eclipse. In my eclipse console, the hibernate sql displays in the form of: Hibernate: insert into some_table (fieldname1, fieldname2, fieldname3, fieldname4) values (?, ?, ?, ?) How can I get the console to print out the values that are being inserted in the place of the question marks? I am committed to using slf4j and logback for the logging in my app. Here is my logback.xml: <?xml version="1.0" encoding="UTF-8"?> true <jmxConfigurator/> %-5level %logger{0} - %msg%n <!--<logger name="org.hibernate" level="debug"/> --> <logger name="mypackagename.myappname" level="debug"/> <logger name="org.hibernate.SQL" additivity="false" level="DEBUG" /> <logger name="org.hibernate.type" additivity="false" level="TRACE" /> <appender-ref ref="console"/>
has comment: http://stackoverflow.com/comment/39835514
downvote count: 0
score: 23
upvote count: 23
favorite count: 0
type: Question
tagged with: slf4j
has answer: http://stackoverflow.com/a/25534301
accepted answer: http://stackoverflow.com/a/25534301
has title: logging hibernate parameter values using logback and slf4j
has answer: http://stackoverflow.com/a/42192816
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25517234
possible better answer: http://stackoverflow.com/a/25517234
tagged with: logback
tagged with: eclipse
type: AnsweredQuestion

http://stackoverflow.com/comment/39655327
has text: I copied the plugin in the eclipse/plugins folder and then I added the plugin to the build path and gave me the above error. I have to add a plugin that I'm creating now, but before adding the plugin that I'm creating I tried with a plugin from the template (a plugin with sample view), to see if I'm able to run it on a project.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25406231

http://stackoverflow.com/comment/39867537
has text: Thanks for your help on this one! Your answer was right, however due to the programming language had to mark kjones answer as the correct one. Thanks again.
comment on: http://stackoverflow.com/a/25527206
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25434401
has comment: http://stackoverflow.com/comment/39681646
score: 2
type: AnsweredQuestion
upvote count: 3
answer count: 2
has title: ProcessBuilder does not work?
tagged with: runtime.exec
tagged with: java
downvote count: 1
has body: I'm trying add a key register on windows using ProcessBuilder. Before I tried Runtime.getRuntime.exec() and doesn't work also. I'm trying this. ProcessBuilder p = new ProcessBuilder("reg add HKCU\\Software\\Microsoft\\Windows /v mykey /t REG_SZ /d " + "key_value"); try { p.start(); } catch (IOException ex) { Logger.getLogger(Registro.class.getName()).log(Level.SEVERE, null, ex); } The exception is: GRAVE: null java.io.IOException: Cannot run program "reg add HKCU\Software\Microsoft\Windows /v mykey /t REG_SZ /d key_value": CreateProcess error=2, O sistema não pode encontrar o arquivo especificado at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042) at br.com.iguana.keys.Registro.addChavesRegistro(Registro.java:50) at br.com.iguana.keys.Registro.main(Registro.java:158) Caused by: java.io.IOException: CreateProcess error=2, O sistema não pode encontrar o arquivo especificado at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.&lt;init&gt;(ProcessImpl.java:386) at java.lang.ProcessImpl.start(ProcessImpl.java:137) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023) ... 2 more Any idea ?
has comment: http://stackoverflow.com/comment/39681140
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39684014
tagged with: processbuilder
has answer: http://stackoverflow.com/a/25434592
possible better answer: http://stackoverflow.com/a/25434592
has answer: http://stackoverflow.com/a/25435106
tagged with: windows
accepted answer: http://stackoverflow.com/a/25435106
has comment: http://stackoverflow.com/comment/39681380
has comment: http://stackoverflow.com/comment/39681283

http://stackoverflow.com/comment/39878691
type: QuestionComment
has text: Hey thanks. When I type your command using Admin Rights, the App starts on my PC. As when my friend does it, it won't work. So you mean the Self-Contained Application should work without Java even beeing installed on the User's PC? Can you give me a hint or something how I can "package the jre with the application"? @Kao what kind of information? I got Netbeans 8.0 with JavaFX installed from the latest JDK. Also I am using the Scene Builder to Design my Apps.
score: 0
comment on: http://stackoverflow.com/q/25534421
type: Comment

http://stackoverflow.com/q/25545431
type: AnsweredQuestion
tagged with: stored-procedures
has title: Execute MSSQL stored procedure in Mule CE 3.5 (Anypoint)
accepted answer: http://stackoverflow.com/a/25547100
tagged with: sql
tagged with: java
has answer: http://stackoverflow.com/a/25547100
answer count: 1
favorite count: 0
type: Question
has body: I got an error message when I execute a MSSQL stored procedure in Mule CE 3.5 (anypoint IDE). ******************************************************************************** Message : Query type must me '[STORE_PROCEDURE_CALL]' but was 'DDL' (java.lang.IllegalArgumentException). Message payload is of type: String Code : MULE_ERROR--2 -------------------------------------------------------------------------------- Exception stack is: 1. Query type must me '[STORE_PROCEDURE_CALL]' but was 'DDL' (java.lang.IllegalArgumentException) org.mule.module.db.internal.processor.AbstractDbMessageProcessor:164 (null) 2. Query type must me '[STORE_PROCEDURE_CALL]' but was 'DDL' (java.lang.IllegalArgumentException). Message payload is of type: String (org.mule.api.MessagingException) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/cur...) Here is my code. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.5.0" 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-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd"&gt; &lt;db:generic-config name="db2_Database_Configuration" url="jdbc:sqlserver://localhost:17…
score: 0
tagged with: mule
upvote count: 1
downvote count: 1
tagged with: sql-server

http://stackoverflow.com/q/25547025
tagged with: sql
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39889072
tagged with: jpa
has title: "org.hibernate.QueryException: Unable to resolve path..." error with parametrized queries on JPA
downvote count: 0
tagged with: mysql
favorite count: 0
type: Question
score: 5
has body: I'm having a poblem on the first argument of the following method with the parametrized SQL query: lista = miDao.find("SELECT c FROM Idioma WHERE c.palabra =:param", o1 , entityManager); where: String o1= "playa"; List&lt;Object&gt; lista; The table "Idioma" has 3 columns "palabra", "idioma" and "wordId". The method is expected to look for the word "playa" within the column "palabra" and calls to the following Dao method: @SuppressWarnings("unchecked") public &lt;T&gt; List&lt;T&gt; find(String queryString, Object param, EntityManager em) { Query query = em.createQuery(queryString); query.setParameter( "param" , param); return query.getResultList(); } When I run the program I'm "rollbacked" with: Unable to resolve path [c.palabra], unexpected token [c] [SELECT c FROM com.aprendeidiomas.entity.Idioma WHERE c.palabra =:param] I'm sure I have a problem with my parametrized sql query. Even though I have red a lot of documents, I cannot solve my error. Could you pleas tell me what is wrong with my parametrized query? Thank you very much in advance.
upvote count: 5
possible better answer: http://stackoverflow.com/a/25547067
accepted answer: http://stackoverflow.com/a/25547137
has comment: http://stackoverflow.com/comment/39889012
has answer: http://stackoverflow.com/a/25547067
has comment: http://stackoverflow.com/comment/39889152
has answer: http://stackoverflow.com/a/25547137
type: AnsweredQuestion
answer count: 2

http://stackoverflow.com/q/25467233
tagged with: jersey
has title: convert a simple maven project to a webapp
answer count: 1
has comment: http://stackoverflow.com/comment/39745992
tagged with: maven
accepted answer: http://stackoverflow.com/a/25469079
has comment: http://stackoverflow.com/comment/39742399
type: AnsweredQuestion
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/39746978
tagged with: java
tagged with: eclipse
type: Question
has body: I created a simple maven project using just jpa persistence as a framework, and now I have to make this same project a webapp using jersey, but I don't know the procedure I'll have to follow !
has answer: http://stackoverflow.com/a/25469079

database
tags question: http://stackoverflow.com/q/25491362
tags question: http://stackoverflow.com/q/25470853
tags question: http://stackoverflow.com/q/25413758
tags question: http://stackoverflow.com/q/25488626
tags question: http://stackoverflow.com/q/25424510
tags question: http://stackoverflow.com/q/25539648
tags question: http://stackoverflow.com/q/25483206
tags question: http://stackoverflow.com/q/25483867
tags question: http://stackoverflow.com/q/25414994
tags question: http://stackoverflow.com/q/25401827
tags question: http://stackoverflow.com/q/25420598
tags question: http://stackoverflow.com/q/25518139
tags question: http://stackoverflow.com/q/25499389
tags question: http://stackoverflow.com/q/25402162
type: Tag
tags question: http://stackoverflow.com/q/25481582
tags question: http://stackoverflow.com/q/25525508
tags question: http://stackoverflow.com/q/25484733
tags question: http://stackoverflow.com/q/25536284
tags question: http://stackoverflow.com/q/25443336
tags question: http://stackoverflow.com/q/25421914
tags question: http://stackoverflow.com/q/25476186
tags question: http://stackoverflow.com/q/25545836
tags question: http://stackoverflow.com/q/25486649
tags question: http://stackoverflow.com/q/25472055
tags question: http://stackoverflow.com/q/25407188
tags question: http://stackoverflow.com/q/25422226
tags question: http://stackoverflow.com/q/25529298
tags question: http://stackoverflow.com/q/25421865
tags question: http://stackoverflow.com/q/25428983
tag name: database

http://stackoverflow.com/a/25511362
answers question: http://stackoverflow.com/q/25510707
has comment: http://stackoverflow.com/comment/39825854
type: Answer
has comment: http://stackoverflow.com/comment/39834169
has comment: http://stackoverflow.com/comment/39831235
has comment: http://stackoverflow.com/comment/39826438
has comment: http://stackoverflow.com/comment/39825949
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25510707
has body: You could pass the name to Info's constructor @Override public Info[] search(short length) { Info[] infolist = new Info[length]; for (int i = 0; i &lt; infolist.length; i++) { infolist[i] = new Info("New Name"); } return infolist; }
has comment: http://stackoverflow.com/comment/39827264

http://stackoverflow.com/comment/39707893
has text: Show the code of object that you are trying to write/to read.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25447804
type: Comment

http://stackoverflow.com/q/25444875
has body: I want to create more than one source folder in a java project programmatically.Now I am able to create one source folder with the java project .But if I give more than one like /src/main/java &amp; /src/test/java . It is creating like above picture. I am using below code for creating source folders in java project. for (String srcPath : projectSrcPath.split("\\s+")) { final IClasspathEntry[] buildPath = { JavaCore.newSourceEntry(project.getFullPath().append(srcPath)), JavaRuntime.getDefaultJREContainerEntry() }; javaProject.setRawClasspath(buildPath, project.getFullPath().append("bin"), null); createFolder(project.getFullPath().append(srcPath)); } Can anyone please tell me what is wrong I am doing here?
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/25445029
type: Question
has title: How to create more than one source folders programmatically
type: UnansweredQuestion
answer count: 1
tagged with: eclipse-plugin
score: 0

spring
tags question: http://stackoverflow.com/q/25550344
tags question: http://stackoverflow.com/q/25543868
tags question: http://stackoverflow.com/q/25492986
tags question: http://stackoverflow.com/q/25405095
tags question: http://stackoverflow.com/q/25505028
tags question: http://stackoverflow.com/q/25513781
tags question: http://stackoverflow.com/q/25470717
tags question: http://stackoverflow.com/q/25419369
tags question: http://stackoverflow.com/q/25486352
tags question: http://stackoverflow.com/q/25477611
tags question: http://stackoverflow.com/q/25403911
tags question: http://stackoverflow.com/q/25413027
tags question: http://stackoverflow.com/q/25438152
tags question: http://stackoverflow.com/q/25536160
tags question: http://stackoverflow.com/q/25521784
tags question: http://stackoverflow.com/q/25423321
tags question: http://stackoverflow.com/q/25489301
tags question: http://stackoverflow.com/q/25509870
tags question: http://stackoverflow.com/q/25490563
tags question: http://stackoverflow.com/q/25431922
tags question: http://stackoverflow.com/q/25514420
tags question: http://stackoverflow.com/q/25515059
tags question: http://stackoverflow.com/q/25417721
tags question: http://stackoverflow.com/q/25491057
tags question: http://stackoverflow.com/q/25476762
tag name: spring
tags question: http://stackoverflow.com/q/25394140
tags question: http://stackoverflow.com/q/25537533
tags question: http://stackoverflow.com/q/25503061
tags question: http://stackoverflow.com/q/25418459
tags question: http://stackoverflow.com/q/25529283
tags question: http://stackoverflow.com/q/25405065
tags question: http://stackoverflow.com/q/25531841
tags question: http://stackoverflow.com/q/25530400
tags question: http://stackoverflow.com/q/25398174
tags question: http://stackoverflow.com/q/25410144
tags question: http://stackoverflow.com/q/25410379
tags question: http://stackoverflow.com/q/25427684
tags question: http://stackoverflow.com/q/25533616
tags question: http://stackoverflow.com/q/25416750
tags question: http://stackoverflow.com/q/25427493
tags question: http://stackoverflow.com/q/25513525
tags question: http://stackoverflow.com/q/25418116
tags question: http://stackoverflow.com/q/25522643
tags question: http://stackoverflow.com/q/25502412
tags question: http://stackoverflow.com/q/25534644
tags question: http://stackoverflow.com/q/25430610
tags question: http://stackoverflow.com/q/25542095
tags question: http://stackoverflow.com/q/25431711
tags question: http://stackoverflow.com/q/25462416
tags question: http://stackoverflow.com/q/25550494
tags question: http://stackoverflow.com/q/25425678
tags question: http://stackoverflow.com/q/25550061
tags question: http://stackoverflow.com/q/25421540
tags question: http://stackoverflow.com/q/25540502
tags question: http://stackoverflow.com/q/25522139
tags question: http://stackoverflow.com/q/25453922
tags question: http://stackoverflow.com/q/25445577
tags question: http://stackoverflow.com/q/25394264
tags question: http://stackoverflow.com/q/25423421
tags question: http://stackoverflow.com/q/25444478
tags question: http://stackoverflow.com/q/25500982
tags question: http://stackoverflow.com/q/25509483
tags question: http://stackoverflow.com/q/25393096
tags question: http://stackoverflow.com/q/25473648
tags question: http://stackoverflow.com/q/25451036
tags question: http://stackoverflow.com/q/25499854
tags question: http://stackoverflow.com/q/25423936
tags question: http://stackoverflow.com/q/25471638
tags question: http://stackoverflow.com/q/25491391
tags question: http://stackoverflow.com/q/25497203
tags question: http://stackoverflow.com/q/25402160
tags question: http://stackoverflow.com/q/25391806
tags question: http://stackoverflow.com/q/25471937
tags question: http://stackoverflow.com/q/25481604
tags question: http://stackoverflow.com/q/25542968
tags question: http://stackoverflow.com/q/25408818
tags question: http://stackoverflow.com/q/25448734
tags question: http://stackoverflow.com/q/25436658
tags question: http://stackoverflow.com/q/25477423

http://stackoverflow.com/q/25407352
tagged with: mysql
has comment: http://stackoverflow.com/comment/39658827
accepted answer: http://stackoverflow.com/a/25474793
downvote count: 1
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25407843
possible better answer: http://stackoverflow.com/a/25407843
has body: I'm tring read the data from reg form and insert it to a db, this part should add the item but it doesn't work. Do you have a recommendation ? if ("/RegForm".equals(url)) { request.getRequestDispatcher("/index.jsp").forward(request, response); return; } else if ("/Signup".equals(url)) { //dddddddd try { // Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/deneme", "root", ""); Statement stmt = conn.createStatement(); // Execute SQL query String sql1 = "INSERT INTO students (name, id, `gpa`) VALUES ("+ request.getParameter("st_name") +","+ request.getParameter("st_id") +","+ request.getParameter("st_gpa") +")"; stmt.executeUpdate(sql1); } catch (Exception se) { //Handle errors for JDBC } request.getRequestDispatcher("/register_action.jsp").forward(request, response); return; } ps: i'm really not familiar using java in web apps, just trying to learn.
has comment: http://stackoverflow.com/comment/39919428
has title: Cannot insert a data to table on servlet
has comment: http://stackoverflow.com/comment/39919533
has comment: http://stackoverflow.com/comment/39631882
upvote count: 1
has comment: http://stackoverflow.com/comment/39630816
has answer: http://stackoverflow.com/a/25474793
tagged with: servlets
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25247569
score: 0
has comment: http://stackoverflow.com/comment/39630868
tagged with: java
has comment: http://stackoverflow.com/comment/39644902

http://stackoverflow.com/comment/39777629
score: 0
has text: Do you need to do this in Java? (as noted by your tags)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25486539

http://stackoverflow.com/comment/39753147
type: Comment
comment on: http://stackoverflow.com/q/25472956
type: QuestionComment
has text: Good for you. But the people trying to help you don't.
score: 0

http://stackoverflow.com/q/25410312
has body: I am trying to extract data from an old website. I have a dropdown list with town names. I am trying to extract town name using regex and insert to the database. I tried >.*< but it comes with no match. I am very new to the regex so I don't know what is going on. Sample data is below. I want the name just before the closing tag. " ABERCROMBIE " " ABERDEEN " " ABRAMS RIVER " " ACACIAVILLE "
tagged with: regex
has answer: http://stackoverflow.com/a/25411161
has comment: http://stackoverflow.com/comment/39636502
has answer: http://stackoverflow.com/a/25410367
answer count: 2
score: 1
tagged with: java
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39638483
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39646528
has comment: http://stackoverflow.com/comment/39636619
has title: Extract data with regex
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39637425

http://stackoverflow.com/q/25467703
has body: I am currently making an app for android and I have a problem where the UI on a new activity that I start from the main one does not show up. I have no idea what the problem is. Here is my second activity's layout xml file: &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/TableLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.tabcards.android.Search" &gt; &lt;TableRow android:id="@+id/tableRow1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" &gt; &lt;ScrollView android:id="@+id/scrollView" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" &gt; &lt;TableLayout android:id="@+id/tableScrollView" android:layout_width="match_parent" android:layout_height="wrap_content" android:stretchColumns="yes" android:padding="5dp" android:background="@color/gray"&gt; &lt;/TableLayout&gt; &lt;/ScrollView&gt; &lt;/TableRow&gt; Here is my acitiviy's code: public class Search extends ActionBarActivity { TableLayout tableScrollView; String[] JSONExceptions = { "type", "em", "user_id", "id", "profilepic", "bg"}; String value; JSONObject jObject; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); Bundle extras = getIntent().getExtras(); if (extras != null) { value = extras.getString("id"); } System.out.println(value); tableScrollView = (TableLayout) findViewById(R.id.tableScrollView); Thread thread = new Thread(new Runnable() { @Override public void run() { try { jObject = getJson("http://www.tabcards.com/req/androidapi/L2o30H8JlFMtFYHW3KLxkts20ztc5B…
has comment: http://stackoverflow.com/comment/39743362
type: AnsweredQuestion
score: 0
has title: Android GUI does not show up
tagged with: java
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/39743444
has comment: http://stackoverflow.com/comment/39743696
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/39752464
accepted answer: http://stackoverflow.com/a/25468081
has comment: http://stackoverflow.com/comment/39743657
has answer: http://stackoverflow.com/a/25468081
has comment: http://stackoverflow.com/comment/39743878
tagged with: android
has comment: http://stackoverflow.com/comment/39752488
has comment: http://stackoverflow.com/comment/39743653

http://stackoverflow.com/a/25549857
answers question: http://stackoverflow.com/q/25549733
score: 0
has body: I guess drawSplash is called each time the text changes. If you only want to draw a random String on e.g. initialize make a own function for list = items[r.nextInt(3+1)]; which gets only called once
type: Answer

http://stackoverflow.com/comment/39642679
type: Comment
type: AnswerComment
has text: I'm just going to go back to teaching myself python for now I guess. I did read that however, it is over my head.
score: 0
comment on: http://stackoverflow.com/a/25412845

http://stackoverflow.com/q/25508143
tagged with: java
has answer: http://stackoverflow.com/a/25508308
answer count: 1
has title: Problems plotting user data in achartengine with data which is a changeable value from a table
type: Question
tagged with: graph
tagged with: charts
accepted answer: http://stackoverflow.com/a/25508308
tagged with: android
tagged with: achartengine
type: AnsweredQuestion
score: 0
has body: I'm using achartengine to plot a graph in my app. I declare points in a table in table.xml which is connected to Table.java. Now should my graph get this points and use them. My graph is coded in Graph.java and gets called through Graphdisplay.java. EDIT2: I changed the code a bit. First of all I added the code from Graphdisplay.java into the onCreate method of Graph.java and deleted Graphdisplay.java. Second I added some get and set methods like here in the first answer in Graph.java and get the data from Table.java in the onCreate method. Third I put the get method in the GraphicalView Graph.java: public class Graph extends Activity{ //only for x1 for now public double ds_x1; public Double getX1(){return this.ds_x1;} public void setX1(Double ds_x1){this.ds_x1=ds_x1;} protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.graph); //getting the data from Table.java ds_x1 = getIntent().getExtras().getDouble("s_x1"); Graph line = new Graph(); final GraphicalView gView = line.getView(getApplicationContext()); LinearLayout layout = (LinearLayout) findViewById(R.id.chart); layout.addView(gView); } public GraphicalView getView(Context context) { Double d_x1 = getX1(); ArrayList&lt;Double&gt; xList = new ArrayList&lt;Double&gt;(); double x1 = d_x1; xList.add(x1); double x2 = 2; xList.add(x2); double x3 = 3; xList.add(x3); ArrayList&lt;Double&gt; yList = new ArrayList&lt;Double&gt;(); double y1 = 1; yList.add(y1); double y2 = 2; yList.add(y2); double y3 = 3; yList.add(y3); XYSeries series = new XYSeries("List"); for (int i = 0; i &lt; xList.size(); i++) { series.add(i, xList.get(i), yList.get(i)); } XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); dataset.addSeries(series); XYSeriesRenderer renderer = new XYSeriesRenderer(); XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer(); return ChartFactory.getLineChartView(context, dataset, mRenderer); } } Table.java: Now Double not Strings Edit…

http://stackoverflow.com/comment/39858436
type: Comment
comment on: http://stackoverflow.com/q/25515158
type: QuestionComment
has text: possible duplicate of [Resolving javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed Error?](http://stackoverflow.com/questions/9619030/resolving-javax-net-ssl-sslhandshakeexception-sun-security-validator-validatore)
score: 0

http://stackoverflow.com/a/25398614
score: -1
has body: as the trace suggests ... the Rails boot Bundler.require line is failing and than exit-ing. that is likely caused by some gems not being bundled right in the .war (try to reproduce with an empty app and the same Gemfile ... if there's no local gem :path references it would be worth reporting)
upvote count: 0
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/25397928
has comment: http://stackoverflow.com/comment/39622903
has comment: http://stackoverflow.com/comment/39615756
has comment: http://stackoverflow.com/comment/39619385
type: Answer
accepted answer of: http://stackoverflow.com/q/25397928

http://stackoverflow.com/comment/39733103
type: AnswerComment
comment on: http://stackoverflow.com/a/25462027
score: 0
type: Comment
has text: Why should I create Controller instance?? And how would I initialize c_buttons?? I am just assigning c_buttons to the other class's method, which is returning array of buttons!!

http://stackoverflow.com/comment/39776864
score: 0
type: Comment
type: AnswerComment
has text: @DaoWen I do not think you understand my problem correctly because I didn't tell clearly because of my english. Anyway let it go
comment on: http://stackoverflow.com/a/25477884

http://stackoverflow.com/comment/39941113
type: Comment
has text: Exactly! After invoking onchange event of each dropdown and putting a wait of 1 sec for script to complete, it works fine.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25571039

http://stackoverflow.com/q/25408818
has title: Hibernate/JPA audit intercptor does not trigger on query updates
has comment: http://stackoverflow.com/comment/39636479
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39653538
has body: I have an audit interceptor very similar to this : http://www.mkyong.com/hibernate/hibernate-interceptor-example-audit-log/ Whenever i do in my service method: User user = this.userRepository.findOne(id); user.setX(x); user.setY(y); I get an audit just fine! works perfect. But when i use a query from whithin the respository like so: UserRepository { @Query("UPDATE User u SET u.password = ?2 WHERE u.id = ?1 ") @Modifying public void updatePassword(Long userId, String encodedPassword); } The interceptor is not being called, I really want to use this audit interceptor in case i use updates as well as standard pojo sets. how can i achieve it? Thanks
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39635083
tagged with: jpa
has comment: http://stackoverflow.com/comment/70966802
tagged with: spring
has comment: http://stackoverflow.com/comment/70894209
score: 3
upvote count: 3
answer count: 0
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: spring-data

http://stackoverflow.com/comment/39692958
has text: I have no plan how to do this.. dont know the package of the widget., could u write a answere?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25426505
score: 0

http://stackoverflow.com/q/25403207
has body: I need to write a font file of format .ttf to response.I tried to use response.getoutputstream() and while calling the url.....it received a file of same size and content as far as i see.But it is not working as a font file.here is the code i used....i would really appreciate your help. File file = new File(SubsettedSavedPath); if (file.exists()) { response.addHeader("19.file", "exist"); // out.println("file exist&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;"); BufferedReader reader = new BufferedReader(new FileReader(file)); String line = null; StringBuilder stringBuilder = new StringBuilder(); String ls = System.getProperty("19.line.separator"); response.addHeader("20.reading File", "Started"); while ((line = reader.readLine()) != null) { stringBuilder.append(line); stringBuilder.append(ls); } String str = stringBuilder.toString(); response.setContentType("font/ttf"); OutputStream out = response.getOutputStream(); out.write(str.getBytes()); // out.write(str.getBytes()); // out.flush(); response.addHeader("21.byte returned", "successful"); out.close(); }
favorite count: 0
has answer: http://stackoverflow.com/a/25403331
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25403574
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has title: Send a font file through response
linked to: http://stackoverflow.com/q/858980
has comment: http://stackoverflow.com/comment/39622610
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39623178

http://stackoverflow.com/q/25423170
upvote count: 1
has answer: http://stackoverflow.com/a/25423306
accepted answer: http://stackoverflow.com/a/25423306
has body: Is there any java code, which can make a java program pause in eclipse debugger, just like breakpoint? Then I can check the information of debugger, like values, stack. Someone may misunderstand my question. I often write code for debugging like this if(some_condition){ print_log(); abort(); } In Visual Studio, I write abort() function. When I run a program in debug mode, abort() function can make the program pause and I can check the debugger.Is there some function in java like abort() in C++?
favorite count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39659935
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39661290
tagged with: eclipse
linked to: http://stackoverflow.com/q/7194326
has comment: http://stackoverflow.com/comment/39659970
has title: How to pause a java program in eclipse by code
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39659951

http://stackoverflow.com/comment/39637391
type: Comment
type: AnswerComment
has text: Sorry for late response, and it is working, thank you.
score: 0
comment on: http://stackoverflow.com/a/25410146

http://stackoverflow.com/q/25487209
has body: First of all this is not a question about how to implement an interface in Java, or about an error with interfaces. This is a question about the right way to do it, depending on the situation. First of all i would like to apologize if this is not the correct "stack" to post this question, please let me know and i'll move it to another one. Let's begin. What i'm trying to guess is which is the best way to implement an interface in Java. Let's say we have a class A like: public Class A { public A(){} public void fooA() {} } And an interface public interface MyListener { public void fooListener(); } Inside fooA() I'm making use of interface B this way: ... something.setFooListener(/**Doubts here**/) .... What should we type inside setFooListener(...) Options are (As far as i know): A) Define the behavior inside the setFooListener function: new MyListener.fooListener() { /** Implementation of fooListener() **/ } Pros: Easy and readable as you're reading the function. You can access directly to FINAL variables defined in fooA(). Cons: If your implementation is long enough it would end up in a lack of readability and a too long function. If you're implementing the interface in a few places on the same class you are going to repeat a lot of code. B) Create an inner class implementing the interface: private class MyListenerImplementation implements MyListener { private String var1; private int var2; public MyListenerImplementation() {/** constructor **/} public void fooListener() { /** Do logic here **/ } } Pros: You can keep a reference to the object MyListenerImplementation. You can define variables, functions and everything as it's an object like any other one. Cleaner code. Cons: Maybe needs more memory. Maybe creating unnecessary classes C) Hold a variable with a reference to the interface implementation private MyListener.FooListener myListenerVar = new MyListener.FooListener() { /** Logic goes here **/ }; Pros: I actually can't sees anyone comparing to B, but a lot o…
type: AnsweredQuestion
score: 0
tagged with: oop
has comment: http://stackoverflow.com/comment/39779565
upvote count: 1
has comment: http://stackoverflow.com/comment/39791101
tagged with: java
answer count: 1
downvote count: 1
has title: How should i implement an interface in Java? [Code-Correctness]
favorite count: 0
has comment: http://stackoverflow.com/comment/39791164
accepted answer: http://stackoverflow.com/a/25487656
type: Question
has comment: http://stackoverflow.com/comment/39779205
tagged with: interface
has answer: http://stackoverflow.com/a/25487656
tagged with: correctness

http://stackoverflow.com/q/25526917
has body: jMeter is used for load testing. The sequence of action is following: request login page. request some specific page. The View Results Tree is used to see requests/responses details. In the request login userName and password are sent via POST HTTP request. In the response I can see the following: Thread Name: User Threads Configuration 1-1 Sample Start: 2014-08-27 18:38:39 NOVT Load time: 23 Latency: 8 Size in bytes: 24979 Headers size in bytes: 425 Body size in bytes: 24554 Sample Count: 1 Error Count: 0 Response code: 200 Response message: OK Response headers: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Set-Cookie: JSESSIONID=ET5cR1buk+HURt6IqumsMaEb; Path=/ P3P: CP="CAO PSA OUR" X-XSS-Protection: 0 X-Powered-By: JSP/2.2 Expires: Sat, 6 May 1995 12:00:00 GMT Cache-Control: no-store, no-cache, must-revalidate Cache-Control: post-check=0, pre-check=0 Pragma: no-cache Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Date: Wed, 27 Aug 2014 11:38:39 GMT First of all I cannot see all cookies that should be received. When I login manually via login page in browser I can see more than 7 cookies in the response. What am I doing wrong? And next: How to apply jMeter all cookies that have been receive during login request, for sending them in the next request? Obviously at first, I have to see cookies in the loging response.
tagged with: jmeter
score: 0
type: UnansweredQuestion
answer count: 1
has title: Using cookies in jMeter Tests
type: Question
tagged with: testing
tagged with: cookies
tagged with: java
has answer: http://stackoverflow.com/a/25532625

http://stackoverflow.com/q/25534133
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39866694
has body: problem description: Modify these files to be able to interactively ask the user to supply the advertisement message to be shown. The user types in the message to be displayed and presses the ENTER key. Accept the message that the user entered. Show the message that the user requested as the advertisement message, repeatedly with a pause of 1 second between displays. If the user presses ENTER again (while the previous message is being displayed), the program should ask the user for a new (modified) message. The user types in a new message and presses the ENTER key. The advertisement display should now change to show the new message display, repeatedly with a pause of 1 second between displays. Exit the program when the user enters n (case-insensitive). If I use the following code, the first time I enter a message it works properly and when I hit enter, the repeated printing of the message is interrupted correctly and I am prompted to enter a new message. however, when I click enter the repeated printing is not interrupted because the main method has completed: import java.util.Scanner; class Advertisement extends Thread { private boolean done = false; String message = ""; public void run() { Thread myThread = Thread.currentThread(); while (!isDone()) { System.out.println("Please enter the advertisement message to be displayed (enter 'n' to exit):"); Scanner sc2 = new Scanner(System.in); message = sc2.nextLine(); if (message.equalsIgnoreCase("n")) { done = true; System.out.println("User Stopped the Message Output"); continue; } while (!(myThread.isInterrupted())) { try { System.out.print("** " + message + " **"); myThread.sleep(1000); } catch (InterruptedException e) { System.out.println("Exception caught: " + e.getMessage()); break; } } } }// end of 'run()' .. /** * @return the done */ public boolean isDone() { return done; } } import java.util.Scanner; public class TestAdvt2 { public static void main (String[] args) { Advertisement advt = new Advertisement(); advt.…
type: Question
has title: Keeping Scanner running/listening in main method (two threads)
has answer: http://stackoverflow.com/a/25534670
tagged with: multithreading
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25534670
type: AnsweredQuestion

http://stackoverflow.com/a/25545052
has body: You can't open a port below 1024, if you don't have root privileges and from the code you posted in your comment, you seem to be trying to open port 100 which confirms my theory. You need to use a port which is higher than 1024, if you're running the code under a non-root user.
downvote count: 0
has comment: http://stackoverflow.com/comment/60915876
has comment: http://stackoverflow.com/comment/64243604
answers question: http://stackoverflow.com/q/25544849
score: 73
type: Answer
upvote count: 73

http://stackoverflow.com/comment/39681208
type: AnswerComment
score: 0
type: Comment
has text: Right before the `Group By`
comment on: http://stackoverflow.com/a/25434342

http://stackoverflow.com/comment/39895798
score: 0
comment on: http://stackoverflow.com/q/25550344
type: QuestionComment
type: Comment
has text: How did you set up your project and whats the hierarchy? Where is your configuration for beans. Post related files and code.

http://stackoverflow.com/comment/39782703
score: 0
comment on: http://stackoverflow.com/a/25488526
type: Comment
has text: No-one said wrapping non-runtime exceptions into the appropriate subclass of `RuntimeException` is wrong. But the emphasis is on "the appropriate subclass". And only do it if the condition isn't recoverable on that level. A lot of conditions are recoverable.
type: AnswerComment

http://stackoverflow.com/q/25548586
downvote count: 0
upvote count: 1
duplicate of: http://stackoverflow.com/q/2618272
has comment: http://stackoverflow.com/comment/39892201
score: 1
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/2618272
favorite count: 0
type: Question
has body: Say I have a ListView in android and its adapter is bound to an arraylist holding two elements. However I find a question that when I start the activity in which the ListView is located,the getView method of the arrayAdapter is called for many times (at least 4 times).However my arraylist only holds 2 elements.And actually only two elements appear on the screen finnaly. So here is my question:why the getView method is called much more times than it should be? public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { View rowView=convertView; if(rowView==null) { Log.d("rowview==null is true", Integer.toString(childPosition)); } else{ Log.d("rowview==null is false", Integer.toString(childPosition)); } There are about 4 Log in LogCat .From my point of view ,it should be 2. Any help is appreciated.
has answer: http://stackoverflow.com/a/25548732
type: UnansweredQuestion
has title: Why getVIew method of ListView is called many times in android
answer count: 1

http://stackoverflow.com/q/25501976
possible better answer: http://stackoverflow.com/a/25502228
has answer: http://stackoverflow.com/a/25518479
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25518479
answer count: 2
tagged with: java
downvote count: 0
score: 6
has title: How to disable F10 default action in window (show window menu)?
tagged with: swing
favorite count: 0
has answer: http://stackoverflow.com/a/25502228
type: Question
has comment: http://stackoverflow.com/comment/39806851
tagged with: key-bindings
has comment: http://stackoverflow.com/comment/39807339
has comment: http://stackoverflow.com/comment/39806854
upvote count: 6
has body: The default action of F10 is to show the menu of the window. However, I would like to disable this feature. UPDATED: Background: I would like to implement a special behavior in a JTextField if the user presses any key. Unfortunately, the JTextField don't get the event when F10 is pressed because it is catched by the window (and the menu is shown). Does anyone know how to disable this key binding in the window? I tried to disable it in the root pane but without success: frame.getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0), "none"); I searched a lot but found no solution for this issue. Maybe one of you knows an answer. UPDATE2 Here a code example to reproduce this behavior: public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame.setDefaultLookAndFeelDecorated(true); final JTextField edit = new JTextField(); edit.setEditable(false); edit.addKeyListener(new KeyAdapter() { @Override public void keyReleased(final KeyEvent ke) { edit.setText(KeyEvent.getKeyText(ke.getKeyCode())); } }); final JFrame frame = new JFrame("DEMO"); frame.setSize(320, 240); frame.getContentPane().add(edit); frame.setVisible(true); } }); } Plase note: There is a different behavior according to whether "setDefaultLookAndFeelDecorated" is set to true or false. Thanks in advance :)
has comment: http://stackoverflow.com/comment/39807361
has comment: http://stackoverflow.com/comment/39806909

http://stackoverflow.com/comment/39788220
type: Comment
score: 0
has text: I have changed my code but still the result is same
comment on: http://stackoverflow.com/q/25490596
type: QuestionComment

http://stackoverflow.com/a/25511778
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25511592
has body: create a Asyntask class public class SendRequest extends AsyncTask&lt;Void, Void, Void&gt; { private Context context; private String url; private String token; private String uid; public SendRequest(Context context, String token, String uid) { // TODO Auto-generated constructor stub this.context = context; this.token = token; this.uid = uid; url = "http://" + context.getResources().getString(R.string.url) + "/xyz.php"; } @Override protected Void doInBackground(Void... arg0) { List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("token", token)); params.add(new BasicNameValuePair("user_id", uid)); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); try { httppost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { Log.e("e", "error1"); e.printStackTrace(); } catch (IOException e) { Log.e("e", "error2"); e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { //after http request } } And call this in you activity like new SendRequest(par1, par2, par3).execute();
has comment: http://stackoverflow.com/comment/39829651

http://stackoverflow.com/q/25549670
possible better answer: http://stackoverflow.com/a/25550101
has title: Find if url refers to existing object
has body: i have a lot of URL to show it on client. But i have to choose urls that to existing objects (in my situation - images). Do somebody know how can i get if my url refer to image that was not deleted from storage?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25550056
accepted answer: http://stackoverflow.com/a/25550056
answer count: 2
upvote count: 1
downvote count: 1
tagged with: url
has comment: http://stackoverflow.com/comment/39894859
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25550101
score: 0

http://stackoverflow.com/q/25447055
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39710349
has title: Need to send control from Action Class to JSP
score: 1
tagged with: java
tagged with: action
tagged with: struts
type: Question
has answer: http://stackoverflow.com/a/25490310
has body: My code flow is as follows: When the user is selecting a particular year from a dropdown, the control goes to Javascript which takes the selected year and pass a particular URL. function ModelForYear() { var url = "modelforyear.do"; var e = document.getElementById("yearId"); var year = e.options[e.selectedIndex].text; url = url + "?yearId=" + year ; document.location.href = url; } This URL is mapped to an action class for doing some calculation and setting a variable value. However, after the calculation, I want my control to go back to the calling JSP page without resetting the selected year(Specifically the control should go back not as a new request but part of same request). I am using return mapping.findForward("searchLabelData"); but it is going to jsp as a new request it seems Could anyone help please....
type: UnansweredQuestion
answer count: 1
downvote count: 0
tagged with: jsp
tagged with: javascript

http://stackoverflow.com/comment/39782528
comment on: http://stackoverflow.com/q/25488982
type: Comment
score: 1
type: QuestionComment
has text: Which array are you referring to?

http://stackoverflow.com/comment/39656713
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25421118
has text: If you want to be able to work with any db server you'll have to use long as I have with android and sqlite. If you want to use some of the functionality of the db timestamp with timezone will do a lot of work for you. We currently use joda as a library from Java 7
type: AnswerComment

http://stackoverflow.com/q/25486767
has comment: http://stackoverflow.com/comment/39778790
has comment: http://stackoverflow.com/comment/39778226
has comment: http://stackoverflow.com/comment/39778099
has answer: http://stackoverflow.com/a/25487103
score: 1
tagged with: java
has body: I have a folder in my projects war folder, So its running fine in development mode . But when i try to run the same application on my localHost. It says "FileNotFound". I use this path which works for development mode: String filePath = "mydata/"; Now what path I will be using when running on tomcat? I also tried to put the folder in Tomcat Bin Folder and using same filePath,But no luck! Please guide. Code: @SuppressWarnings("serial") public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService { String filePath = "./cdata/"; public CountryDTO getCountryDataFromFile(String selectedCountry) { Gson mydata = new Gson(); CountryDTO dto = null; System.out.println("test"); try { String line; File f = new File(filePath + selectedCountry + ".txt"); BufferedReader jsonReader = new BufferedReader(new FileReader(f)); ///RPC call void getJSONDataFromFile(String mAdministrativeArea, AsyncCallback asyncCallback); //Client Side , from where my code is been called mAdministrativeAreaA.addValueChangeHandler(new ValueChangeHandler(){ @Override public void onValueChange(ValueChangeEvent&lt;String&gt; changedSubRegion) { mAdministrativeArea= changedSubRegion.getValue(); System.out.println("going to rpc"); addrService.getJSONDataFromFile(mAdministrativeArea, new AsyncCallback&lt;CountryDTO&gt;() { @Override public void onSuccess(CountryDTO json) { json.setFmt( selectedCountry.getFmt() ); GUIfromFormat(json, ResultType.STATE_OR_PROVINCE); }
answer count: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39779138
has comment: http://stackoverflow.com/comment/39778524
has comment: http://stackoverflow.com/comment/39778507
favorite count: 0
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/39779333
has title: How to access a folder in a project which is running on tomcat
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39778280
has comment: http://stackoverflow.com/comment/39778187

http://stackoverflow.com/a/25457885
upvote count: 1
answers question: http://stackoverflow.com/q/25457814
accepted answer of: http://stackoverflow.com/q/25457814
score: 1
type: Answer
has body: If you create a Stack.java class file in your package ( say com.example.app ) as: public class Stack{} Then from another file main if you want to use both the java.util.Stack and your own class you will have an ambiguous reference error in the imports or in usage: import java.util.Stack; import com.example.app.Stack; public class Main{ Stack stack; } If you actually want to use both of them in your main file you can resolve the ambiguity as: java.util.Stack javaStack; com.example.app.Stack myStack;
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39839007
type: QuestionComment
score: 0
has text: option 3 was your closest bet to having something working... but instead of `id="id"` it should have been `param="id"`
comment on: http://stackoverflow.com/q/25510040
type: Comment

http://stackoverflow.com/comment/39869537
comment on: http://stackoverflow.com/q/25529188
type: Comment
score: 0
type: QuestionComment
has text: I have had issues using the `@Rule` based PowerMock approach combined with both JUnitParams and Mockito mock. The rule based approach combined with just JUnitParams seems to work. Try removing the `private RequestContext contextoRequest = mock(RequestContext.class);` Do you have both powermock rule agent and xstream jars?

http://stackoverflow.com/q/25536328
has answer: http://stackoverflow.com/a/25536477
has comment: http://stackoverflow.com/comment/39870205
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25536365
score: -2
has body: The object that is created by the constructor in the following code can be called multiple times. Have I written the code badly by doing so I hope it is written to the proper conventions import java.util.Scanner; /** * this class uses the scanner to take input from the keyboard * test if the input is a variable of type double if it is store in a * variable called numOne then take next input test again for type double * store in variable numTwo, then add the two variables together in the form * of variable answer and return to the screen. The user then is asked for * continuation as Y/N then appropriate action is taken */ public class Calc { /** * this constructer does not throw InputMismatchException */ public Calc() { Scanner in = new Scanner(System.in); // create scanner object System.out.println("please enter 1st " + "number then press enter" + "\nthen enter 2nd number then " + "press enter again"); /*test for a double returns true */ boolean myBool = in.hasNextDouble(); /*the actual test for a double*/ if(myBool == false) { System.out.println("wrong format"); /** * call constructer and instantiate as new object * by creating a new object i hope to have overwriten * the original object stored in memory there by getting * around the problem of hasNextDouble not allowing the * scanner to advance */ Calc c = new Calc(); } else { // 1st else double numOne = in.nextDouble(); // keyboard input /*test for a double returns true */ boolean myBool2 = in.hasNextDouble(); /*the actual test for a double*/ if(myBool2 == false) { System.out.println("wrong format start again"); /** * call constructer and instantiate as new object * there by removing need for InputMismatchException */ Calc c = new Calc(); } else { // 2nd else double numTwo = in.nextDouble(); // keyboard input double answer = numOne + numTwo; // the maths for(int i = 0; i&lt;35; i++) { // print pattern System.out.print("*"); } System.out.println("\n**** " + "Your 1st number is " + numOne + " ****"); System.out.pri…
has answer: http://stackoverflow.com/a/25536437
has comment: http://stackoverflow.com/comment/39870222
has comment: http://stackoverflow.com/comment/39891640
upvote count: 0
has comment: http://stackoverflow.com/comment/39870391
downvote count: 2
answer count: 3
has title: Is this code wrong to call the same constructor more than once
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/39888247
has comment: http://stackoverflow.com/comment/39888714
has comment: http://stackoverflow.com/comment/39888258
type: Question

http://stackoverflow.com/comment/39712987
type: QuestionComment
comment on: http://stackoverflow.com/q/25451719
type: Comment
score: 0
has text: " " will print a space in the screen

http://stackoverflow.com/q/25415384
type: AnsweredQuestion
has title: Get rid of jfreechart chartpanel unnecessary space
answer count: 2
downvote count: 0
tagged with: swing
has body: I am trying to get a JFreeChart ChartPanel to remove unwanted extra space between the edge of the panel and the graph itself. To best illustrate, here's a SSCCE (with JFreeChart installed): public static void main(String[] args) { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 1; gbc.weighty = 1; gbc.gridy = 1; gbc.gridx = 1; panel.add(createChart("Sales", Chart_Type.DOLLARS, 100000, 115000), gbc); gbc.gridx = 2; panel.add(createChart("Quotes", Chart_Type.DOLLARS, 250000, 240000), gbc); gbc.gridx = 3; panel.add(createChart("Profits", Chart_Type.PERCENTAGE, 40.00, 38.00), gbc); JFrame frame = new JFrame(); frame.add(panel); frame.setSize(800, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private static ChartPanel createChart(String title, Chart_Type type, double goal, double actual) { double maxValue = goal * 2; double yellowToGreenNum = goal; double redToYellowNum = goal * .75; DefaultValueDataset dataset = new DefaultValueDataset(actual); JFreeChart jfreechart = createChart(dataset, Math.max(actual, maxValue), redToYellowNum, yellowToGreenNum, title, type); ChartPanel chartPanel = new ChartPanel(jfreechart); chartPanel.setBorder(new LineBorder(Color.red)); return chartPanel; } private static JFreeChart createChart(ValueDataset valuedataset, Number maxValue, Number redToYellowNum, Number yellowToGreenNum, String title, Chart_Type type) { MeterPlot meterplot = new MeterPlot(valuedataset); meterplot.setRange(new Range(0.0D, maxValue.doubleValue())); meterplot.addInterval(new MeterInterval(" Goal Not Met ", new Range(0.0D, redToYellowNum.doubleValue()), Color.lightGray, new BasicStroke(2.0F), new Color(255, 0, 0, 128))); meterplot.addInterval(new MeterInterval(" Goal Almost Met ", new Range(redToYellowNum.doubleValue(), yellowToGreenNum.doubleValue()), Colo…
tagged with: jfreechart
favorite count: 0
tagged with: chartpanel
type: Question
has answer: http://stackoverflow.com/a/25455273
tagged with: java
accepted answer: http://stackoverflow.com/a/25416067
has answer: http://stackoverflow.com/a/25416067
linked to: http://stackoverflow.com/q/5048852
possible better answer: http://stackoverflow.com/a/25455273
score: 2
upvote count: 2

http://stackoverflow.com/q/25432265
answer count: 2
has answer: http://stackoverflow.com/a/25432738
linked to: http://stackoverflow.com/q/22519982
tagged with: swing
has answer: http://stackoverflow.com/a/25432853
accepted answer: http://stackoverflow.com/a/25432853
has title: Java add combobox in JTable in for loop
tagged with: jcombobox
tagged with: jtable
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/25432381
possible better answer: http://stackoverflow.com/a/25432738
tagged with: java
has body: I have a table that displays the data: ID, NAME, CATEGORY, COMPANY. Data is retrieved from the database. I would like to add a ComboBox to the column CATEGORY. So as to be able to choose any category that they are in the database. List&lt;Item&gt; item; JTable itemTable = new JTable(); JScrollPane itemScroll = new JScrollPane(); DefaultTableModel itemmodel = new DefaultTableModel(); itemmodel.setRowCount(0); item = model.getItem(); for (Item ite : item) { itemmodel.addRow(new Object[] { ite.getId(), ite.getName(), ite.getCategory(), ite.getCompany() }); } item.clear(); Then I add the data to the JFrame properly and everything displays. I read the documentation, but I do not know how to use the examples in my case. To display the same categories have separate jTable and data downloading via tablemodel.setRowCount(0); category = model.getCategory(); for (Category cat: categoryList) { tablemodel .addRow(new Object[] { cat.getId(), cat.getName() }); } categoryList.clear();
linked to: http://stackoverflow.com/q/2531193
type: Question
linked to: http://stackoverflow.com/q/7350445

http://stackoverflow.com/q/25474261
has title: executeUpdate(String sql) Method in Statement Class with a insert query which has ON DUPLICATE KEY UPDATE
type: AnsweredQuestion
tagged with: netbeans
score: 0
has body: I'm executing an insert query in my net beans java application. public boolean Update(){ String sql="insert into customer(cNic,cName,cAddress,cTp,cEmail,creditLimit,CustomerStatus)" + "values('"+cs.getcNic()+"','"+cs.getcName()+"','"+cs.getcAddress()+"','"+cs.getcTp()+"'" + ",'"+cs.getcEmail()+"','"+cs.getCreditLimit()+"',0) " + "ON DUPLICATE KEY UPDATE cName=VALUES(cName), cAddress=VALUES(cAddress), " + "cTp=VALUES(cTp), cEmail=VALUES(cEmail), \n" + "creditLimit=VALUES(creditLimit),CustomerStatus=0;"; try { Statement stmt=dbConn.createStatement(); int rslt =stmt.executeUpdate(sql); if(rslt==1){ return true; } else{ return false; } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex, "DB_CONNECTION ERROR", JOptionPane.ERROR_MESSAGE); return false; } } This method works well for new rows. But when I add a row (which has a primary key already in the table) the stmt.executeUpdate(sql) method returns 2. But the data has been updated in the table. But I can't check whether the insertion has been done successfully. In normal cases if the execution is success it returns 1. Is there a way to execute this query in net beans and to know whether it has been updated correctly.
answer count: 2
tagged with: sql
possible better answer: http://stackoverflow.com/a/25476674
tagged with: mysql
accepted answer: http://stackoverflow.com/a/25474474
type: Question
has answer: http://stackoverflow.com/a/25474474
tagged with: java
has answer: http://stackoverflow.com/a/25476674

http://stackoverflow.com/a/72266056
has body: Exact same issue here, just needed to set a new "App Password" in Bitbucket: https://bitbucket.org/account/settings/app-passwords/ That solved it.
type: Answer
answers question: http://stackoverflow.com/q/25440889
score: 0

http://stackoverflow.com/a/25403380
downvote count: 0
type: Answer
has body: Regarding your v1 for loops, your local variable, once it has exited its scope, it will be marked for GC as free to be collected, so every once in a while the GC will kick in and collect that memory. For your v2 for loops, those empty loops won't be 'optimized away' by the compiler**, only after multiple calls, because the JIT triggers AFTER a certain piece of code has been executed many times [1] Regarding your saw tooth pattern, ruakh has a very nice explanation about it [2] : If I'm not mistaken, part of the reason for this is that the monitor itself is forcing the application to create temporary objects that contain information about the state of garbage-collection and memory usage. ** It is possible that they may never be removed because those empty loops are well known as being used as a waiting mechanism.* [1] Java: how much time does an empty loop use? - Simone Gianni's answer [2] Why does an empty Java program consume memory?
score: 2
answers question: http://stackoverflow.com/q/25402947
upvote count: 2

http://stackoverflow.com/comment/39631407
comment on: http://stackoverflow.com/q/25407527
score: 0
has text: Well how is your server code sending back the malformed response? That would be where you'd fix it.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25476881
type: Answer
answers question: http://stackoverflow.com/q/25476421
upvote count: 2
has body: 1) Your int is too big, because the Integer.parseInt() function only takes a signed int as an argument. 0xFF010000 == 4294901760 // your number 0x7FFFFFFF == 2147483647 // maximum signed Integer Value You can fix this easily by using parseLong instead 0xFFFFFFFF == 4294967295 // RGBA color format maximum Long.MAX_VALUE == 9223372036854775807L // maximum signed Long value Implemented in your code it would look like this: public int getColorCodeAsInt() { return (int)Long.parseLong(colorCode, 16); } 2) As Alexander pointed out in his answer, don't include the "0x"-bit, the 'x' will mess up the parser. ---EDIT--- Thanks to Alexander I came up with another solution, you could always do this: public int getColorCodeAsInt() { // this would return hex value 0xFFFFFFF8; return (Integer.parseInt("FFFFFFF", 16) * 16) // first 7 digits + Integer.parseInt("8", 16); // last digit } This works because the datatype int itself actually can contain RGBA data.
has comment: http://stackoverflow.com/comment/39760318
accepted answer of: http://stackoverflow.com/q/25476421
score: 1
has comment: http://stackoverflow.com/comment/39760378
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39760363
downvote count: 1
has comment: http://stackoverflow.com/comment/39760433
has comment: http://stackoverflow.com/comment/39760500

http://stackoverflow.com/comment/40228434
comment on: http://stackoverflow.com/a/25652440
type: AnswerComment
has text: @DominicA., just because you can set those options, they do not mean that they are respected by JGSS. Those props are available to [MIT Kerberos](http://web.mit.edu/kerberos/krb5-devel/doc/admin/conf_files/krb5_conf.html#libdefaults). Your DNS setup seems to be fine. What you can do now is to contact security-dev@openjdk mailing list Weijun Wang is quite fast in answering those kind of questions. Here is the creation of the [GSS context](http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/file/828c4fedd29f/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java#l95).
score: 1
type: Comment

http://stackoverflow.com/a/51850679
score: 0
answers question: http://stackoverflow.com/q/25493742
has body: This solution worked for me , BTW it made deploy slower due to downloading extra repositories. Jasper Library download forbidden when running maven: mvn package Sorry Can i post some one answer from other question ( here is the solution ) Please add below repository in your pom.xml, jasperreports http://jasperreports.sourceforge.net/maven2 jaspersoft-third-party http://jaspersoft.artifactoryonline.com/jaspersoft/t‌​hird-party-ce-artifa‌​cts/
type: Answer

http://stackoverflow.com/comment/39794629
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25495168
has text: What does profiler say?

http://stackoverflow.com/a/25516104
type: Answer
has body: your method must return an int value but at your last else block you are not returning anything. return a default value there, for instance return 0 or throw an exception which says invalid input. And also; To compare two strings you must use its equals method. change nums == "yes" to "yes".equals(nums) and lets == "yes" to "yes".equals(lets)
has comment: http://stackoverflow.com/comment/39833924
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39854435
has comment: http://stackoverflow.com/comment/39835006
answers question: http://stackoverflow.com/q/25516057
score: 1

http://stackoverflow.com/a/25541834
has body: You should be able to do: String[] parts = my.split(" "); byte[] bytes = new byte[parts.length]; for(int i = 0; i &lt; parts.length; i++) { bytes[i] = Byte.parseByte(parts[i]); } System.out.println(Arrays.toString(bytes)); [16, 12, 12, -119, 102, 105, -110, 52, -89, 80, -122, -68, 114, 20, -92, -28, -121, 38, 113, 61] Be sure to look over the API for the Byte class, notably Byte.parseByte().
accepted answer of: http://stackoverflow.com/q/25541645
has comment: http://stackoverflow.com/comment/39880323
type: Answer
answers question: http://stackoverflow.com/q/25541645
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/39690957
type: Comment
comment on: http://stackoverflow.com/q/25439652
score: 0
has text: What is inside the file? Can you open and post (an extract)? I guess it contains simply some *compatibility* information on how to set chmod programmatically, if the files are downloaded by hand (where these information may get lost) instead of using git where the information is held inside the files itself.
type: QuestionComment

http://stackoverflow.com/a/26553590
upvote count: 2
type: Answer
score: 2
has body: These libraries are in the Oracle JDK 8u20 for sure. Here's my advice for you: Make sure you download Oracle JDK form Oracle site. Create some really small project with using missed classes without any other libraries and try to compile it with newly downloaded JDK (try to use simple console commands to compile and run it, that's how you will be sure your IDE does not mess up with libraries). If previous step succeed try to link just tested JDK to your project, pay close attention to IDE settings and make sure you link it properly. Good luck!
answers question: http://stackoverflow.com/q/25403962
downvote count: 0

http://stackoverflow.com/comment/39779796
has text: Do you mean like [this](http://stackoverflow.com/a/21355134/2587435)?
score: 0
comment on: http://stackoverflow.com/q/25487472
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25549233
answer count: 3
tagged with: android-listview
score: 1
tagged with: java
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25549340
type: Question
tagged with: onscrolllistener
favorite count: 0
has title: Show the ActionBar while scrolling up on a ListView
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/30246874
has comment: http://stackoverflow.com/comment/39893580
has answer: http://stackoverflow.com/a/25549416
has body: I have a ListView and when I scroll down or up I can detect this using this solution: listView.setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if(listView.getFirstVisiblePosition() == 0) getActionBar().show(); else getActionBar().hide(); } }); This way works and the ActionBar shows when the scroll comes back to the first item of the list. I would ALSO like to show the ActionBar again when I begin to scroll up within the list. EDIT: this is the last way and it works not always.. sometimes the actionbar disappears and never comes back: private int mPreviousFirst; ... listView.setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if(prevVisibleItem != firstVisibleItem){ if (firstVisibleItem &lt; mPreviousFirst) getActionBar().show(); else getActionBar().hide(); mPreviousFirst = firstVisibleItem; } } }); i'm close but something goes wrong :(

http://stackoverflow.com/comment/39879667
comment on: http://stackoverflow.com/q/25528837
has text: net.sf.jadclipse_3.3.0.jar - this is the eclipse jar file that I am using.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25456964
type: Answer
has body: You are declaring an array but you initialize it to null in this line: int [] indivIntPrices = null; indivIntPrices is now a null pointer. You are then trying to access this array two lines later indivIntPrices[x] = ... which is not going to work because the variable is not pointing to an array. To solve this, allocate a new array of integers with the same size as the input array: int [] indivIntPrices = new int[tempIndivPrices.length];
upvote count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39723953
answers question: http://stackoverflow.com/q/25456924

http://stackoverflow.com/q/25542849
has comment: http://stackoverflow.com/comment/39881933
has comment: http://stackoverflow.com/comment/39916519
has comment: http://stackoverflow.com/comment/39882994
has comment: http://stackoverflow.com/comment/39881941
has body: I do not think this kind of OOP pattern exist in C#.net and C++. So what is the name of this pattern or feature. I encountered this when programming Android, is this a feature of Java too or not? Note : I know @Override is specific for android compiler/ide only. Foo bar = new Foo(){ @Override public void fighters(){ //some stuff } }; Is this somekind of Lambda thing? Thanks!
tagged with: lambda
answer count: 1
has comment: http://stackoverflow.com/comment/39881990
linked to: http://stackoverflow.com/q/94361
has comment: http://stackoverflow.com/comment/39882843
accepted answer: http://stackoverflow.com/a/25542888
has comment: http://stackoverflow.com/comment/39881956
type: Question
has answer: http://stackoverflow.com/a/25542888
type: AnsweredQuestion
score: 0
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39882158
has title: Android instantiating and overriding pattern
has comment: http://stackoverflow.com/comment/39882305

http://stackoverflow.com/a/25533530
score: 0
has comment: http://stackoverflow.com/comment/39867214
answers question: http://stackoverflow.com/q/25530482
has body: The error is because you have configured the Listener Port incorrectly. You have set the JMS Destination in the Listener Port configuration to be the QCF when it should be the destination: JMSDestination jms/RECEIVER_QUEUE_CONN_FACTORY_QA Fix the Listener Port configuration to point to the JMS Destination that you have created and the listener port should start.
type: Answer
has comment: http://stackoverflow.com/comment/39868441

http://stackoverflow.com/comment/39716389
has text: I agree with @markspace. If you're restricting yourself because of perceived MVC requirements, then you'd be "penny wise but pound foolish".
comment on: http://stackoverflow.com/a/25452145
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/q/25474814
tagged with: apk
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25474882
has answer: http://stackoverflow.com/a/25475044
has title: read and write to a file in apk
tagged with: http://stackoverflow.com/tag/xml
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/3760626
has body: There is a file strings.xml: <?xml version="1.0" encoding="utf-8"?> 0 need to read a variable named "param" and change it to another int variable or read and write to a file located in this APK, for example /assets/config.txt?
type: Question
tagged with: android
tagged with: java

http://stackoverflow.com/comment/39859179
type: QuestionComment
score: 0
has text: it must change the system volume level. Therefore you can try to access that data through some api. Look at this http://stackoverflow.com/questions/4211439/getting-the-system-audio-levels-in-java
comment on: http://stackoverflow.com/q/25530237
type: Comment

http://stackoverflow.com/comment/39823350
type: Comment
type: QuestionComment
has text: @McDowell, thank you for providing your opinion, as well as for confirming that `UTF-16LE` and `UTF-16BE` are indeed valid names and that there exist some instances in which they may be used. I wonder if you might comment more directly to the issue I raised regarding the BOM, specifically the tension between your characterization and the Unicode Byte Order mark FAQ, and provide some reference to back up your opinions? (The reference you gave merely confirmed that these encoding names are valid in at least some instances, but made no reference to byte order marks with XML.) Thanks.
comment on: http://stackoverflow.com/q/25477854
score: 0

http://stackoverflow.com/q/25441693
answer count: 1
has title: Google Directory Service query with space and wildcard: behavior not matching expectations
has body: I ran into some unexpected behavior when trying to combine whitespaces in a Directory Service API search query with a wildcard character: Code Directory ds = new GoogleDirectoryServiceManager().getDirectoryService("admin@randomdomain.com"); Directory.Users usersClient = ds.users(); String lastNameBuffer = term; StringBuilder sb = new StringBuilder(); if(term.contains(" ")){ sb.append("\'"); sb.append(lastNameBuffer); sb.append("*\'"); }else{ sb.append(lastNameBuffer); sb.append("*"); } queryString = "familyName:" + sb.toString(); users = usersClient.list() .setDomain("randomdomain.com") .setQuery(queryString) .setMaxResults(MAX_DIRECTORY_RESULTS) .setFields("users(name,primaryEmail,thumbnailPhotoUrl)") .execute(); I added the single quotes to search through the directory with the spaces. Following is an extract from the Google Directory API: Surround with single quotes ' if the query contains whitespace. Escape single quotes in queries with \', for example 'Valentine\'s Day'. Input "johns" --> Returns all users with Johnson name (familyName: johns*) GOOD "van bur" --> Does not return any users (familyName: 'van bur*') NOT GOOD "van buren" --> Returns all users with Van Buren name (familyName: 'van buren*') GOOD tl;dr Is it not possible to combine a search query with spaces with a wildcard? Or does the wildcard symbol (*) have to be escaped? What query do I need to use to successfully return a list of users in case #2?
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25480934
tagged with: google-app-engine
tagged with: java
tagged with: google-directory-api
score: 2
upvote count: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25480934

http://stackoverflow.com/comment/39887986
comment on: http://stackoverflow.com/a/25546409
has text: Okay..thanks for answering and what is `1.0` here with `Color.web("0x0001FF", 1.0)`.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25548158
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25554923
has body: I have a ListView to show some information, and I created a custom CellFactory: each cell has a label, an image and a small button. I want the user to be able to remove a list row by clicking on that small button. The list is displayed correctly, but the handler associated to the button is never called... public class ListViewCell extends ListCell&lt;SessionExercise&gt; { @Override public void updateItem(SessionExercise exercise, boolean empty) { ... FXMLLoader listItemLoader = new FXMLLoader(); listItemLoader.setLocation(getClass(). getResource("/view/SimpleExerciseListItem.fxml")); try { listItemLoader.load(); } catch (IOException e) { throw new RuntimeException(e); } SimpleExerciseListItemController listItemController = (SimpleExerciseListItemController) listItemLoader.getController(); ... this.setGraphic(listItemController.getAnchorPane()); } And in my SimpleExerciseListItemController class: public class SimpleExerciseListItemController implements Initializable { @Override public void initialize(URL url, ResourceBundle rb) { btnRemove. setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { System.out.println("You clicked the remove button!"); ... } }); } } I've also tried setOnMouseClicked(new EventHandler()) instead of setOnAction(new EventHandler()), but nothing is printed to the console...
tagged with: handler
tagged with: java
tagged with: javafx
answer count: 1
has title: JavaFX custom list cell with button: handler not called
type: Question
has answer: http://stackoverflow.com/a/25554923
tagged with: handle
tagged with: event-handling

http://stackoverflow.com/a/25441377
downvote count: 0
upvote count: 1
has body: Setting the Scanner's delimiter to '#' or '/' causes the line separators \n (whatever it is on your system) to remain in the data. So, some next() method call will eventually produce a String value with a leading \n, which is bound to happen for all IDs from the second one up, if the line structure is aligned with the '#' signs. The code you have for parsing is extremely complex. I'd advocate to read lines (\n-delimited) and handle one line at a time, using String[] tokens = line.split( "/" ); and assigning the strings to the destination fields of one object. Avoid the many lists - this only confuses matters.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25441190

http://stackoverflow.com/comment/39788432
type: QuestionComment
has text: yes, i sure. But the problem is solved. Thank's.
score: 0
comment on: http://stackoverflow.com/q/25462371
type: Comment

http://stackoverflow.com/comment/39808652
has text: @user3663765 Welcome and glad to hear it helped you :)
type: Comment
comment on: http://stackoverflow.com/a/25502471
type: AnswerComment
score: 1

http://stackoverflow.com/a/25440109
downvote count: 0
type: Answer
upvote count: 1
has body: Try keeping the jar files inside /WEB-INF/lib
score: 1
answers question: http://stackoverflow.com/q/25434855

http://stackoverflow.com/comment/39818729
has text: A request exists from the time the web browser sends it to the web server until the web server (via the servlet) has made its response. Are you sure the attribute is accessed within the scope?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25507607

http://stackoverflow.com/a/25429261
has body: Very close, but a couple of things you missed: First and foremost the permission needs to be in the manifest: &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt; Second, define your service in the manifest: &lt;service android:name="com.example.service_m.ServiceCode" android:exported="false" android:label="ServiceCode" /&gt; Also you might need enabled on the receiver: android:enabled="true" One last thing, try logging instead of toast for your debug, usually a bit more useful :) Log.i("Service Starter", "Hello WOrld"); Hope that helps.
type: Answer
answers question: http://stackoverflow.com/q/25428340
score: 0

http://stackoverflow.com/comment/39652613
has text: Have you looked at [Wakelock](http://developer.android.com/reference/android/os/PowerManager.WakeLock.html)? Also, this [SO Question](http://stackoverflow.com/a/14757159/3033053) may be helpful
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25418951
score: 2

http://stackoverflow.com/comment/39644988
comment on: http://stackoverflow.com/q/25414533
type: Comment
type: QuestionComment
score: 0
has text: Sure - but beware of (tools that / writing) hash code algorithms that generate hashes on mutable values.

jtable
tags question: http://stackoverflow.com/q/25438423
tags question: http://stackoverflow.com/q/25448611
tags question: http://stackoverflow.com/q/25524506
tags question: http://stackoverflow.com/q/25418029
tags question: http://stackoverflow.com/q/25503075
tag name: jtable
tags question: http://stackoverflow.com/q/25480011
tags question: http://stackoverflow.com/q/25440479
tags question: http://stackoverflow.com/q/25546235
tags question: http://stackoverflow.com/q/25483611
tags question: http://stackoverflow.com/q/25404056
tags question: http://stackoverflow.com/q/25492353
tags question: http://stackoverflow.com/q/25475515
tags question: http://stackoverflow.com/q/25501217
tags question: http://stackoverflow.com/q/25487472
tags question: http://stackoverflow.com/q/25535112
tags question: http://stackoverflow.com/q/25523036
tags question: http://stackoverflow.com/q/25407161
tags question: http://stackoverflow.com/q/25424027
tags question: http://stackoverflow.com/q/25501703
tags question: http://stackoverflow.com/q/25516235
tags question: http://stackoverflow.com/q/25395999
tags question: http://stackoverflow.com/q/25426232
type: Tag
tags question: http://stackoverflow.com/q/25516824
tags question: http://stackoverflow.com/q/25463238
tags question: http://stackoverflow.com/q/25501746
tags question: http://stackoverflow.com/q/25473472
tags question: http://stackoverflow.com/q/25519336
tags question: http://stackoverflow.com/q/25464593
tags question: http://stackoverflow.com/q/25422005
tags question: http://stackoverflow.com/q/25432265
tags question: http://stackoverflow.com/q/25530004
tags question: http://stackoverflow.com/q/25464432
tags question: http://stackoverflow.com/q/25482245
tags question: http://stackoverflow.com/q/25410736
tags question: http://stackoverflow.com/q/25438803

http://stackoverflow.com/a/25491485
type: Answer
upvote count: 2
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25491163
has body: You will have null pointer exceptions because you're assuming that in every iteration of the for loop, the desired nodes have children elements: String name = elem.getElementsByTagName("Name") .item(0).getChildNodes().item(0).getNodeValue(); In the above code, you are accessing the first child of a Name element which is a text node (e.g. ABC), and then getting its children nodes, which will cause an exception since there no children elements inside the text node. Likewise, Integer speed = Integer.parseInt(elem.getElementsByTagName("Connect") .item(0).getChildNodes().item(0).getNodeValue()); will cause an exception in one of the iterations of the loop where elem corresponds to Connect itself. You can try the following code instead: if (node.getNodeType() == Node.ELEMENT_NODE) { System.out.println(i); Element elem = (Element) node; // Get the value of the ID attribute. // String ID = // node.getAttributes().getNamedItem("ID").getNodeValue(); // Get the value of all sub-elements. NodeList nameNodes = elem.getElementsByTagName("Name"); for(int j = 0; j &lt; nameNodes.getLength(); j++) { Node nameNode = nameNodes.item(j); staffList.add(new staff(nameNode.getTextContent())); } NodeList speedNodes = elem.getElementsByTagName("Speed"); for(int j = 0; j &lt; speedNodes.getLength(); j++) { Node speedNode = speedNodes.item(j); connectList.add(new connect(Integer.parseInt(speedNode.getTextContent()))); } } P.S.: Try to use class names that start with an uppercase.
score: 2
accepted answer of: http://stackoverflow.com/q/25491163
has comment: http://stackoverflow.com/comment/39787859

http://stackoverflow.com/comment/39754866
comment on: http://stackoverflow.com/q/25473192
has text: Ok, cool so classpath sync problems are out of the question.
score: 0
type: Comment
type: QuestionComment

string
tags question: http://stackoverflow.com/q/25522340
tags question: http://stackoverflow.com/q/25533622
tags question: http://stackoverflow.com/q/25533978
tags question: http://stackoverflow.com/q/25447390
type: Tag
tags question: http://stackoverflow.com/q/25534425
tags question: http://stackoverflow.com/q/25429815
tags question: http://stackoverflow.com/q/25548421
tags question: http://stackoverflow.com/q/25401800
tags question: http://stackoverflow.com/q/25428405
tags question: http://stackoverflow.com/q/25465028
tags question: http://stackoverflow.com/q/25544423
tags question: http://stackoverflow.com/q/25477294
tags question: http://stackoverflow.com/q/25510402
tags question: http://stackoverflow.com/q/25496766
tags question: http://stackoverflow.com/q/25497325
tags question: http://stackoverflow.com/q/25528710
tags question: http://stackoverflow.com/q/25490979
tags question: http://stackoverflow.com/q/25514062
tags question: http://stackoverflow.com/q/25477134
tags question: http://stackoverflow.com/q/25448057
tags question: http://stackoverflow.com/q/25446633
tags question: http://stackoverflow.com/q/25492100
tags question: http://stackoverflow.com/q/25407920
tags question: http://stackoverflow.com/q/25435266
tags question: http://stackoverflow.com/q/25541684
tags question: http://stackoverflow.com/q/25501753
tags question: http://stackoverflow.com/q/25491183
tags question: http://stackoverflow.com/q/25414607
tags question: http://stackoverflow.com/q/25483116
tags question: http://stackoverflow.com/q/25529446
tags question: http://stackoverflow.com/q/25393482
tags question: http://stackoverflow.com/q/25548390
tags question: http://stackoverflow.com/q/25455760
tags question: http://stackoverflow.com/q/25550092
tags question: http://stackoverflow.com/q/25420136
tags question: http://stackoverflow.com/q/25408969
tags question: http://stackoverflow.com/q/25523584
tags question: http://stackoverflow.com/q/25447303
tags question: http://stackoverflow.com/q/25506386
tags question: http://stackoverflow.com/q/25496253
tags question: http://stackoverflow.com/q/25459014
tags question: http://stackoverflow.com/q/25395108
tags question: http://stackoverflow.com/q/25521190
tags question: http://stackoverflow.com/q/25463796
tags question: http://stackoverflow.com/q/25466848
tags question: http://stackoverflow.com/q/25389891
tags question: http://stackoverflow.com/q/25452940
tags question: http://stackoverflow.com/q/25415370
tags question: http://stackoverflow.com/q/25400055
tags question: http://stackoverflow.com/q/25428768
tags question: http://stackoverflow.com/q/25427880
tags question: http://stackoverflow.com/q/25411193
tags question: http://stackoverflow.com/q/25392163
tags question: http://stackoverflow.com/q/25445024
tags question: http://stackoverflow.com/q/25430369
tags question: http://stackoverflow.com/q/25502308
tags question: http://stackoverflow.com/q/25496881
tags question: http://stackoverflow.com/q/25489102
tags question: http://stackoverflow.com/q/25460775
tags question: http://stackoverflow.com/q/25486539
tags question: http://stackoverflow.com/q/25537357
tags question: http://stackoverflow.com/q/25505536
tags question: http://stackoverflow.com/q/25503907
tags question: http://stackoverflow.com/q/25389880
tags question: http://stackoverflow.com/q/25534014
tags question: http://stackoverflow.com/q/25540723
tags question: http://stackoverflow.com/q/25473810
tags question: http://stackoverflow.com/q/25445169
tags question: http://stackoverflow.com/q/25451227
tags question: http://stackoverflow.com/q/25458431
tags question: http://stackoverflow.com/q/25499184
tags question: http://stackoverflow.com/q/25449739
tags question: http://stackoverflow.com/q/25437906
tag name: string
tags question: http://stackoverflow.com/q/25481690
tags question: http://stackoverflow.com/q/25449706
tags question: http://stackoverflow.com/q/25399798
tags question: http://stackoverflow.com/q/25525140
tags question: http://stackoverflow.com/q/25464342

initialization
tags question: http://stackoverflow.com/q/25411503
tags question: http://stackoverflow.com/q/25398698
tag name: initialization
tags question: http://stackoverflow.com/q/25449313
type: Tag
tags question: http://stackoverflow.com/q/25434380
tags question: http://stackoverflow.com/q/25541152
tags question: http://stackoverflow.com/q/25400964
tags question: http://stackoverflow.com/q/25411623
tags question: http://stackoverflow.com/q/25411815

http://stackoverflow.com/comment/39894830
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25544387
has text: For better help sooner, please post a [Minimal Complete Example](http://stackoverflow.com/help/mcve) that demonstrates the problem.
score: 1

http://stackoverflow.com/comment/39688458
has text: @afzalex: Unfortunately, I can't show more code, even though I know that limits people from helping me.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25435838
type: QuestionComment

http://stackoverflow.com/a/27134570
answers question: http://stackoverflow.com/q/25422632
score: 0
type: Answer
has body: I created a repository with a boilerplate AndEngine + Box2d for Android Studio config (as of AS version 1.0 RC). https://github.com/mutexkid/andengine-androidstudio . Tested on OSX 10.10.

http://stackoverflow.com/comment/39662196
score: 0
has text: Well im just using the one class,but its not exactly short but I cant cut it down otherwise it wouldn't run, is it okay to post the class still or would that be too much?
comment on: http://stackoverflow.com/q/25423977
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25490800
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39792515
score: 0
tagged with: java
answer count: 2
tagged with: release
has comment: http://stackoverflow.com/comment/39786211
tagged with: maven
has answer: http://stackoverflow.com/a/25497887
type: Question
has body: I'm using the maven-war plugin. I've also looked at the maven-versions plugin. In neither case do I see how to give a different name to a snapshot build than a release build. I've seen examples using profiles but the docs seem to indicate that the use of profiles in the pom.xml is not a good idea. How should this be done?
has comment: http://stackoverflow.com/comment/39800808
accepted answer: http://stackoverflow.com/a/25497887
has title: In maven, how to name war file different in release than in snapshot build
possible better answer: http://stackoverflow.com/a/25491580
has comment: http://stackoverflow.com/comment/39792508
has answer: http://stackoverflow.com/a/25491580

http://stackoverflow.com/q/25518222
tagged with: configuration
tagged with: http://stackoverflow.com/tag/c
tagged with: hadoop
score: 0
has answer: http://stackoverflow.com/a/25564955
tagged with: java
has body: As title, in JAVA API, there are several methods in org.apache.hadoop.conf.Configuration to get details about what we have configure in hdfs configurion files. Such as hdfs-site.xml, core-site.xml. But I want to get this by using C API, libhdfs.so. could any body help me ?
answer count: 1
tagged with: hdfs
has title: How to get hdfs configuration info by using libhdfs.so
type: Question
type: UnansweredQuestion

http://stackoverflow.com/q/25518851
tagged with: weblogic
tagged with: jnlp
has answer: http://stackoverflow.com/a/30206746
accepted answer: http://stackoverflow.com/a/30206746
type: AnsweredQuestion
downvote count: 0
upvote count: 1
score: 1
tagged with: java
answer count: 1
has body: My Jnlp file code is &lt;resources&gt; &lt;j2se version="1.6.0+" java-vm-args="-PermSize=128m -MaxPermSize=256m -Dweblogic.MaxMessageSize=200000000 -Dweblogic.CompleteMessageTimeout=300" initial-heap-size="256m" max-heap-size="1024m" /&gt; &lt;jar href="Example.jar" main="true"/&gt; &lt;/resources&gt; But,-Dweblogic.MaxMessageSize=200000000 -Dweblogic.CompleteMessageTimeout=300" is not setting for weblogic... Can you please help?
has title: How to pass Weblogic JMS maxmessage size argument in jnlp vm-args?
tagged with: jms
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39862082
has comment: http://stackoverflow.com/comment/39846266

http://stackoverflow.com/comment/39752135
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25465472
has text: @Sam Right after that statement I gave you the two line of code you need to create the model and add it to the table so that your looping code will update the model in the table. I don't know how to be more specific.

merge
type: Tag
tags question: http://stackoverflow.com/q/25395518
tag name: merge
tags question: http://stackoverflow.com/q/25452866
tags question: http://stackoverflow.com/q/25521775

http://stackoverflow.com/q/25406365
accepted answer: http://stackoverflow.com/a/25406567
tagged with: java
tagged with: jdbc
has answer: http://stackoverflow.com/a/25406567
has comment: http://stackoverflow.com/comment/39630642
has body: Say I have a small inventory based software in Java connected to a SQL Server database. SQL server is not installed on that place where it is to be deployed and those people hav nothing to do with databases. We know that it takes a lot of time to install SQL Server. Simply speaking, I need a light software which can be installed easily and provide JDBC connectivity to my Java application.
type: AnsweredQuestion
score: 0
has title: JDBC connection to remote server without installing SQL Server
has comment: http://stackoverflow.com/comment/39629454
tagged with: sql
linked to: http://stackoverflow.com/q/358318
answer count: 1
type: Question
tagged with: sql-server

http://stackoverflow.com/comment/39661063
type: QuestionComment
has text: @Smutje yes I understand that. This is certainly good way of programming. however, I need to write codes for mathematical formulas, and using loops within loops within loops... is very natural . also using attributes such as i,j,k makes it very similar to the actual formulas. thus structuring my code takes a very long time
type: Comment
comment on: http://stackoverflow.com/q/25423743
score: 0

http://stackoverflow.com/comment/39598446
type: QuestionComment
has text: There's no method like that in Java SDK. You should create yours.
score: 3
type: Comment
comment on: http://stackoverflow.com/q/25389924

http://stackoverflow.com/comment/39611305
has text: You still need to return 0, when both are null. But maybe the problem is the non-null case. There is a lot of `||`. that can probably also go both ways and become inconsistent.
type: Comment
comment on: http://stackoverflow.com/a/25396501
type: AnswerComment
score: 1

http://stackoverflow.com/a/25436871
upvote count: 1
score: 1
has body: &lt;view android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/replyView" class="com.firext.android.activities.work.reply.ui.ReplyView" /&gt; Here is where you are attempting to instantiate an abstract class. You cannot use ReplyView here. Rather you should do something like &lt;com.firext.android.activities.work.reply.ui.YesNoReplyView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/replyView" /&gt; Note that you can use your custom view's name directly as a tag. Edit: After looking more closely at your code, you seem to need something more dynamic than this. At the moment, I don't have any good suggestions for you. Perhaps you should start a new question regarding your design. Be sure to include details about your specific requirements. Also, you can probably simplify your custom view classes by using a XML layout rather than overriding initializeComponents().
type: Answer
accepted answer of: http://stackoverflow.com/q/25435178
answers question: http://stackoverflow.com/q/25435178
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25445951
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39701971
has answer: http://stackoverflow.com/a/25446295
has comment: http://stackoverflow.com/comment/39701935
upvote count: 1
favorite count: 0
has body: I implemented a Camera.PreviewCallback in my android app to grab frames from the textureview and it works fine. i would like to know to to keep repeating this callback when a button is pressed down. My code is below: This is the code for the Camera.PreviewCallback: Camera.PreviewCallback previewCallback = new Camera.PreviewCallback() { @Override public void onPreviewFrame(byte[] data, Camera camera) { ByteArrayOutputStream out = new ByteArrayOutputStream(); Camera.Parameters parameters = camera.getParameters(); Size size = parameters.getPreviewSize(); YuvImage image = new YuvImage(data, parameters.getPreviewFormat(),size.width, size.height, null); image.compressToJpeg(new Rect(0, 0, image.getWidth(), image.getHeight()), 90, out); byte[] imageBytes = out.toByteArray(); Bitmap images = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length); rev = new ArrayList&lt;Bitmap&gt;(); rev.add(images); } }; This is the code to handle Button press down: button.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: mCamera.setPreviewCallback(previewCallback); break; case MotionEvent.ACTION_UP: // End break; } return false; } }); Again how do i make the callback repeat when the button is pressed down.Thanks
type: Question
has comment: http://stackoverflow.com/comment/39702074
tagged with: android-camera
linked to: http://stackoverflow.com/q/17439252
tagged with: android
tagged with: ontouchlistener
type: AnsweredQuestion
has title: Repeat a callback on Button Hold down
accepted answer: http://stackoverflow.com/a/25446295
score: 1
tagged with: java

http://stackoverflow.com/q/25457324
answer count: 5
has answer: http://stackoverflow.com/a/25457403
has title: don't repeat random number in java
linked to: http://stackoverflow.com/q/4897410
tagged with: java
has answer: http://stackoverflow.com/a/25457438
has answer: http://stackoverflow.com/a/25457513
score: -1
has body: How could I make my code does not repeat any number generated randomly, was looking in the forum but can not find any examples that I can easily understand. import java.util.*; public class Lottery { public static void main(String[] args) { int n[] = {37}; Random rd = new Random(); for (int i = 0; i &lt; n.length;i++){ for (int j=0; j &lt;6;j++) { System.out.println(rd.nextInt(n[i])+1); } } } }
duplicate of: http://stackoverflow.com/q/4897410
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39724030
downvote count: 2
accepted answer: http://stackoverflow.com/a/25457403
upvote count: 1
has answer: http://stackoverflow.com/a/25457414
has answer: http://stackoverflow.com/a/25457401
possible better answer: http://stackoverflow.com/a/25457401
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39724032

http://stackoverflow.com/comment/39769640
comment on: http://stackoverflow.com/q/25481934
type: QuestionComment
type: Comment
has text: In short - read [this](http://stackoverflow.com/a/2770692/2071828).
score: 0

http://stackoverflow.com/comment/40362586
type: Comment
has text: I think you would help others greatly if you inform us about what eventually was the cause of your problem and how you fixed it. This way your question can be used for future reference.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25447374

http://stackoverflow.com/a/25546021
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39939097
accepted answer of: http://stackoverflow.com/q/25544629
has comment: http://stackoverflow.com/comment/59524867
downvote count: 1
answers question: http://stackoverflow.com/q/25544629
has comment: http://stackoverflow.com/comment/40210806
has body: Where are you setting these parameters? You should set them via admin console: Servers &gt; Server Types &gt; WebSphere application servers &gt; server_name. Then, click Java and process management &gt; Process definition &gt; Java virtual machine And either put them in the: Generic JVM arguments using -Dparameter=value or Custom Properties defining parameter as name and value as value UPDATE When I've pasted your variables, it contained following invisible chars instead of -D and got the same exception: â€“Dsecurityresource However when I went to : C:\IBM\WebSphere\AppServer85\profiles\AppSrv1\config\cells\cellName\nodes\nodeBame\servers\server1 and manually fixed entry in the server.xml file, server started correctly. &lt;jvmEntries xmi:id="JavaVirtualMachine_1183121908656" .... genericJvmArguments="-Xquickstart -Dsecurityresource=/web/sharedLibraries/security_config.xml -DConfig=/web/properties/Config.ini" ...&gt; So please open that file with text editor and fix the - char before first D.
score: 10
type: Answer
has comment: http://stackoverflow.com/comment/59659144
has comment: http://stackoverflow.com/comment/59540479
has comment: http://stackoverflow.com/comment/39988192
upvote count: 11
has comment: http://stackoverflow.com/comment/39940464
has comment: http://stackoverflow.com/comment/39999438

http://stackoverflow.com/comment/39759429
comment on: http://stackoverflow.com/q/25475972
score: 0
type: Comment
type: QuestionComment
has text: @usar I tried GridLayout, BoxLayout and BorderLayout. It does not change the behaviour.

http://stackoverflow.com/q/25502222
has comment: http://stackoverflow.com/comment/39845500
has comment: http://stackoverflow.com/comment/39918664
has comment: http://stackoverflow.com/comment/39846043
has comment: http://stackoverflow.com/comment/39812437
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/39812304
has comment: http://stackoverflow.com/comment/39812359
upvote count: 1
has answer: http://stackoverflow.com/a/25579704
tagged with: jsch
has body: I'm trying to connect to SFTP server using jsch library. This is how I do: public class SFTPConnection { private String sftpHost; private String sftpUser; private String sftpPass; private String sftpWorkDir; private Session session = null; private Channel channel = null; private ChannelSftp channelSftp = null; static final String SFTPHOST = "prod-sftp.host.ru"; static final String SFTPUSER = "user"; static final String SFTPPASS = "pass"; static final String SFTPWORKINGDIRINC = "/dir/Port_Increment/"; static final String SFTPWORKINGDIRFULL = "/dir/Port_All_Full/"; public SFTPConnection(String sftpHost, String sftpUser, String sftpPass, String sftpWorkDir) throws JSchException, SftpException { this.sftpHost = sftpHost; this.sftpUser = sftpUser; this.sftpPass = sftpPass; this.sftpWorkDir = sftpWorkDir; JSch jsch = new JSch(); session = jsch.getSession(this.sftpUser, this.sftpHost, 3232); session.setPassword(this.sftpPass); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); channel = session.openChannel("sftp"); channel.connect(); channelSftp = (ChannelSftp) channel; channelSftp.cd(this.sftpWorkDir); } public SFTPConnection() throws JSchException, SftpException { sftpWorkDir = SFTPWORKINGDIRINC; JSch jsch = new JSch(); session = jsch.getSession(SFTPUSER, SFTPHOST, 3232); session.setPassword(SFTPPASS); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); channel = session.openChannel("sftp"); channel.connect(); channelSftp = (ChannelSftp) channel; channelSftp.cd(SFTPWORKINGDIRINC); } public static void main(String[] args) { try { SFTPConnection con=new SFTPConnection(); } catch (JSchException e) { e.printStackTrace(); } catch (SftpException e) { e.printStackTrace(); } } } This code works on my machine, but now I need to deploy it on another server with high security level. And this is…
has comment: http://stackoverflow.com/comment/40041620
has comment: http://stackoverflow.com/comment/39815864
has comment: http://stackoverflow.com/comment/39812396
has comment: http://stackoverflow.com/comment/39840280
tagged with: sftp
answer count: 3
has title: SFTP connection error: connection timeout
tagged with: java
has comment: http://stackoverflow.com/comment/39812787
has answer: http://stackoverflow.com/a/36690841
downvote count: 3
has comment: http://stackoverflow.com/comment/39812565
has comment: http://stackoverflow.com/comment/39841849
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25660572

http://stackoverflow.com/a/25419865
type: Answer
has comment: http://stackoverflow.com/comment/39703099
score: 0
has comment: http://stackoverflow.com/comment/39656348
answers question: http://stackoverflow.com/q/25410608
has body: What kind of library do you want to add? If it's some java libraries (i.e. a jar) you want to change classpath instead. cf. How to setup classpath in Netbeans? You probably don't need to change library path unless you are using some custom native library (with a .dll in windows) cf. Including Native Library in Netbeans
has comment: http://stackoverflow.com/comment/39703680

http://stackoverflow.com/a/25410682
has comment: http://stackoverflow.com/comment/39637326
has comment: http://stackoverflow.com/comment/39638863
answers question: http://stackoverflow.com/q/25410416
score: 1
has comment: http://stackoverflow.com/comment/39637874
has comment: http://stackoverflow.com/comment/39637636
has comment: http://stackoverflow.com/comment/39637458
has body: The laggy effect comes only if you are testing on an emulator or an old device.try closing the drawer before the intent is called like this case 1: Intent intent1 = new Intent(this, SecondActivity.class); mDrawerLayout.closeDrawer(mDrawerList); startActivity(intent1); finish(); break;
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/25447297
upvote count: 1
type: AcceptedAnswer
has body: I suspect you should replace if (matcher.matches()) with if (matcher.find()) or while (matcher.find()) if you're iterating over multiple possible matches. Matcher.matches will match the entire input from start to end with your Pattern. In your case, you probably want to find one or more instances of your Pattern within the input.
type: Answer
accepted answer of: http://stackoverflow.com/q/25447222
downvote count: 0
answers question: http://stackoverflow.com/q/25447222
score: 1

http://stackoverflow.com/q/25414210
has comment: http://stackoverflow.com/comment/39734136
has comment: http://stackoverflow.com/comment/39752728
downvote count: 0
has comment: http://stackoverflow.com/comment/39679309
has comment: http://stackoverflow.com/comment/39670365
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39767490
has comment: http://stackoverflow.com/comment/39678418
answer count: 1
has comment: http://stackoverflow.com/comment/39748516
has comment: http://stackoverflow.com/comment/39672648
has answer: http://stackoverflow.com/a/25467576
has body: I am attempting to connect my android app to my backend endpoints (in Google's App Engine) so that I can store my java objects in Google's datastore. However when I try to initialize the PersistenceManagerFactory object, I get the error seen at the end of this post - The PersistenceManagerFactory class must define a static method. I am trying to initialize the object using the following code, and note: I do have the library in the classpath. public static PersistenceManagerFactory InitializePersistanceManagerClass(){ Properties properties = new Properties(); properties.setProperty("javax.jdo.PersistenceManagerFactoryClass", "org.datanucleus.api.jdo.JDOPersistenceManagerFactory"); properties.setProperty("javax.jdo.option.ConnectionURL", "appengine"); properties.setProperty("javax.jdo.option.NontransactionalRead", "true"); properties.setProperty("javax.jdo.option.NontransactionalWrite", "true"); properties.setProperty("javax.jdo.option.RetainValues", "true"); properties.setProperty("datanucleus.appengine.autoCreateDatastoreTxns", "true"); properties.setProperty("datanucleus.appengine.singletonPMFForName", "true"); PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(properties); return pmf; } There is no line number listed in the error, however I am 90% sure the problem lies in the code above, or the class that I am using for the persistenceManagerFactory. The error when this code runs appears below. Any ideas? I really don't understand what the problem is.... 08-23 09:10:31.826 7932-7932/com.myApp.myModule E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.myApp.myModule, PID: 7932 javax.jdo.JDOFatalInternalException: The PersistenceManagerFactory class must define a static method PersistenceManagerFactory getPersistenceManagerFactory(Map props). The class "org.datanucleus.jdo.JDOPersistenceManagerFactory" defines a non-static getPersistenceManagerFactory(Map props) method. at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(…
linked to: http://stackoverflow.com/q/4185382
has comment: http://stackoverflow.com/comment/39668530
has comment: http://stackoverflow.com/comment/39733593
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39733128
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/39906896
tagged with: android
has comment: http://stackoverflow.com/comment/39749726
has comment: http://stackoverflow.com/comment/39751986
has comment: http://stackoverflow.com/comment/40013343
has title: The PersistenceManagerFactory class must define a static method?
has comment: http://stackoverflow.com/comment/39668858
has comment: http://stackoverflow.com/comment/39947238
has comment: http://stackoverflow.com/comment/39733114
has comment: http://stackoverflow.com/comment/39716903
tagged with: datanucleus

http://stackoverflow.com/a/60884094
score: 1
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25447590
has body: If you are using Eclipse Neon, try this: 1) Add the maven plugin in the properties section of the POM: &lt;properties&gt; &lt;java.version&gt;1.8&lt;/java.version&gt; &lt;maven-jar-plugin.version&gt;3.1.1&lt;/maven-jar-plugin.version&gt; &lt;/properties&gt; 2) Force update of project snapshot by right clicking on Project Maven -> Update Project -> Select your Project -> Tick on the 'Force Update of Snapshots/Releases' option -> OK

http://stackoverflow.com/a/25508644
upvote count: 1
score: 1
has body: You can try putting your DatePicker in a ContentPanel, and set the panel layout as FitLayout, so the DatePicker would take the panel size. Then you just need to set the panel as collapsible and its property "hideCollapseTool" to false. This will show your DatePicker inside the ContentPanel and you will be able to collapse it using the collapse button on the panel's header. An example: DatePicker miDatePicker = new DatePicker(); ContentPanel miPanel= new ContentPanel(); // new panel miPanel.setLayout(new FitLayout()); // set layout (so DatePicker resize inside) miPanel.setAnimCollapse(false); // set animation (optional) miPanel.setHeading("Choose a date"); // set a header text miPanel.setCollapsible(true); // allow panel to collapse miPanel.setHideCollapseTool(false); // show the collapse button miPanel.setBorders(true); // show border of panel miPanel.add(miDatePicker); Hope this helps!
type: Answer
answers question: http://stackoverflow.com/q/25451515
has comment: http://stackoverflow.com/comment/39843063
has comment: http://stackoverflow.com/comment/39854505
downvote count: 0

http://stackoverflow.com/comment/39740003
type: Comment
has text: can you give me the correct code???
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25465919

http://stackoverflow.com/comment/39743378
comment on: http://stackoverflow.com/q/25467722
type: QuestionComment
type: Comment
has text: How many multiples are you supposed to print?
score: 0

http://stackoverflow.com/comment/39824377
type: QuestionComment
score: 0
has text: You must give the JPanel that is being added to the CardLayout-using container a layout manager of its own. BoxLayout won't magically work on this JPanel unless you set the layout with BoxLayout yourself.
comment on: http://stackoverflow.com/q/25495223
type: Comment

http://stackoverflow.com/comment/39675910
has text: Is it something like this question? http://stackoverflow.com/questions/6293268/save-data-to-sqlite-from-json-object-using-hashmap-in-android
type: AnswerComment
comment on: http://stackoverflow.com/a/25431144
score: 0
type: Comment

http://stackoverflow.com/comment/39693058
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25441076
has text: possible duplicate of [How to view hierarchical package structure in Eclipse package explorer](http://stackoverflow.com/questions/3915961/how-to-view-hierarchical-package-structure-in-eclipse-package-explorer)
score: 0

http://stackoverflow.com/comment/39736022
type: AnswerComment
has text: @rayryeng After I saved the image I want to access and print its grey levels (0..255) How would I do that? Thanks
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25463098

http://stackoverflow.com/comment/39829209
type: Comment
type: QuestionComment
score: 4
has text: How about this? http://stackoverflow.com/a/3793669/1687499
comment on: http://stackoverflow.com/q/25513763

http://stackoverflow.com/comment/70678967
score: 0
comment on: http://stackoverflow.com/a/37683728
type: Comment
type: AnswerComment
has text: Cool. To bad I don't have the correct rights there... xxxxis missing the Overall/RunScripts permission

http://stackoverflow.com/comment/39649875
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25416661
has text: It should pass Activity to the method too, findViewById is a method in Activity
type: Comment

http://stackoverflow.com/comment/39869717
has text: Yeah it worked... just not the way I wanted it thou :/
score: 0
comment on: http://stackoverflow.com/a/25479746
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25404931
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25405085
linked to: http://stackoverflow.com/q/395030
accepted answer: http://stackoverflow.com/a/25405085
favorite count: 0
type: Question
tagged with: for-loop
downvote count: 0
answer count: 1
has body: I'm trying to load jsonObjects into object entities from a REST responses but when I try to cast the abstract object array into real objects I get the exception: EntityAbstract[] cannot be cast to Feed[] Feed extends EntityAbstract so they are in the same family, and when I debug the returning entities they are instances of Feed, and not EntityAbstract - so I don't see why I'm not allowed to do the cast. This is the cast method declaration (returning value) public EntityAbstract[] fetchEntities (Class entityClass) throws Exception {} And when I retreive the entities I try to; for (Feed feed : (Feed[]) ((NewsService) service).getResponse().fetchEntities(Feed.class)) {} And this throws the exception. What am I supposed to do in order to hint the correct returning array?
has comment: http://stackoverflow.com/comment/39626021
has title: Cannot cast abstract class into actual object
tagged with: object
type: AnsweredQuestion
tagged with: abstract-class

http://stackoverflow.com/comment/39703680
type: AnswerComment
score: 0
has text: Dont worry ^^. Anyway, I definitely agree with you, but as far as there is no other alternative, we are stuck on this..
comment on: http://stackoverflow.com/a/25419865
type: Comment

http://stackoverflow.com/q/25499835
score: 0
has answer: http://stackoverflow.com/a/25503230
tagged with: sql
has comment: http://stackoverflow.com/comment/39803064
tagged with: java
tagged with: hibernate
has body: My database table looks like: ID ACCESSID ENTITYGUID NAME NAMEID OWNERGUID TIMECREATED VALUEID VALUETYPE I want to only retrieve a list with two fields, name AND valueId, not the whole record. I'm attempting this as follows: via projections: public void getAllEntityMetadata(int GUID) { Criteria c = session.createCriteria(RevMetadata.class) .add(Restrictions.eq("entityGUID", GUID)) .setProjection(Projections.property("name")) .setProjection(Projections.property("nameId")); List&lt;RevMetadata&gt; m = (List&lt;RevMetadata&gt;) (RevMetadata) c.list(); for (RevMetadata item : m) { System.out.println("-&gt; All entity metadata for GUID: " + item.getName() + " : " + item.getValueId()); } } I get the error: Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to wakiliproject.Persistence.RevMetadata at wakiliproject.Persistence.PersistRevMetadata.getAllEntityMetadata(PersistRevMetadata.java:112) at wakiliproject.HomeController.showMetastring(HomeController.java:492) ... 40 more Via query by example, I'm only getting the output below but no data. No error gets called: public void getAllEntityMetadataEg(int GUID) { RevMetadata m = new RevMetadata(); m.setEntityGUID(GUID); Example e = Example.create(m); Criteria c = session.createCriteria(RevMetadata.class).add(e); for (Iterator it = c.list().iterator(); it.hasNext();) { RevMetadata item = (RevMetadata) it.next(); System.out.println("-&gt; All entity metadata for GUID: " + item.getName() + " : " + item.getValueId()); } } The output: Hibernate: select this_.id as id1_4_0_, this_.accessId as accessId2_4_0_, this_.entityGUID as entityGU3_4_0_, this_.name as name4_4_0_, this_.nameId as nameId5_4_0_, this_.ownerGUID as ownerGUI6_4_0_, this_.timeCreated as timeCrea7_4_0_, this_.valueId as valueId8_4_0_, this_.valueType as valueTyp9_4_0_ from METADATA this_ where (this_.accessId=? and this_.entityGUID=? and this_.nameId=? and this_.ownerGUID=? and this_.timeCreated=? and this_.valueId=?) None of the approaches…
linked to: http://stackoverflow.com/q/12618489
possible better answer: http://stackoverflow.com/a/25503230
type: Question
has title: How to query a database table for a list of record with only two data objects
accepted answer: http://stackoverflow.com/a/25502471
has comment: http://stackoverflow.com/comment/39803663
has answer: http://stackoverflow.com/a/25500422
has answer: http://stackoverflow.com/a/25502471
answer count: 4
has answer: http://stackoverflow.com/a/25500222
type: AnsweredQuestion

http://stackoverflow.com/q/25424345
possible better answer: http://stackoverflow.com/a/25424482
linked to: http://stackoverflow.com/q/5699323
has comment: http://stackoverflow.com/comment/39663034
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25424482
accepted answer: http://stackoverflow.com/a/25440810
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/39662160
type: Question
has comment: http://stackoverflow.com/comment/39662878
tagged with: mongodb
has answer: http://stackoverflow.com/a/25440810
answer count: 2
has comment: http://stackoverflow.com/comment/39662917
has comment: http://stackoverflow.com/comment/39663227
has comment: http://stackoverflow.com/comment/39662113
downvote count: 0
has comment: http://stackoverflow.com/comment/39667837
upvote count: 1
has comment: http://stackoverflow.com/comment/39662381
type: AnsweredQuestion
has title: how to insert xml file data into mongodb database using java?
linked to: http://stackoverflow.com/q/1823264
has body: how can i insert xml file data/contents (which is already exist in a disk) into MongoDB database using java? please any one can resolve it. //Edited code XmlMapper xmlMapper = new XmlMapper(); List entries = xmlMapper.readValue(new File("C:/Users/manish/Desktop/BaseX65/xml/books.xml"),List.class); ObjectMapper jsonMapper = new ObjectMapper(); String json = jsonMapper.writeValueAsString(entries); try { Mongo mongo = new Mongo("localhost", 27017); DB db = mongo.getDB("newdb"); DBCollection collection = db.getCollection("dummyColl"); DBObject dbObject = (DBObject)JSON.parse(json); collection.insert(dbObject); DBCursor cursorDocJSON = collection.find(); while (cursorDocJSON.hasNext()) { System.out.println(cursorDocJSON.next()); } }

http://stackoverflow.com/comment/39735108
type: QuestionComment
has text: possible duplicate of [Large Numbers in Java](http://stackoverflow.com/questions/849813/large-numbers-in-java)
comment on: http://stackoverflow.com/q/25462493
score: 0
type: Comment

http://stackoverflow.com/q/25468220
has title: java regex stays processing but no result is thrown
score: 3
has comment: http://stackoverflow.com/comment/39744159
has comment: http://stackoverflow.com/comment/39744175
linked to: http://stackoverflow.com/q/4500507
tagged with: regex
has answer: http://stackoverflow.com/a/25468300
accepted answer: http://stackoverflow.com/a/25468300
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25468379
possible better answer: http://stackoverflow.com/a/25468379
upvote count: 3
has comment: http://stackoverflow.com/comment/39744264
has comment: http://stackoverflow.com/comment/39744200
has comment: http://stackoverflow.com/comment/39744168
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39744239
has comment: http://stackoverflow.com/comment/39744213
has body: so im learning regex in java and was wondering why when i execute this code String xxx = "(\\s+)?(c:/|c:\\\\|C:\\\\|C:/|c:\\|C:\\))?(\\w+(/|\\\\)?)+(/|\\\\)\\w+.[a-z]+"; String x = "C:\\Users\\esteban\\Desktop\\Java_file_testing\\file3.txt"; if(x.matches(xxx)) { System.out.println("matches"); }else { System.out.println("no match found "); } this prints matches but when i remove the .txt is stays processing without any response, am i doing something wrong?
favorite count: 0
type: Question

http://stackoverflow.com/comment/39751216
type: QuestionComment
comment on: http://stackoverflow.com/q/25466319
has text: Can you build ndk module? Or there are compile time errors?
score: 0
type: Comment

http://stackoverflow.com/q/25489528
upvote count: 0
has title: "Informing" the compiler what kind of ArrayList I am using
answer count: 3
has comment: http://stackoverflow.com/comment/39783640
has answer: http://stackoverflow.com/a/25489562
has comment: http://stackoverflow.com/comment/39783636
possible better answer: http://stackoverflow.com/a/25489562
downvote count: 1
has comment: http://stackoverflow.com/comment/39783673
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25489622
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39784089
tagged with: java
has body: The following code is a method in a constructor. .For some reason Eclipse declares an error in the fourth line of the code "The left-hand side of an assignment must be a variable". the arraylist I am going to put as an argument in the method id made of booleans boolean Referring(ArrayList results){ int so = 0; int ca = 0; if (results.get(0) **** the error is here **** = false){ return false; } return true;} I think the error occurs because the compiler "doesn't know" what kind of arguments are in the ArrayList. Can I "inform him" in some way?
has comment: http://stackoverflow.com/comment/39784052
has comment: http://stackoverflow.com/comment/39783879
score: -1
has comment: http://stackoverflow.com/comment/39783631
has answer: http://stackoverflow.com/a/25489601
has comment: http://stackoverflow.com/comment/39783742
accepted answer: http://stackoverflow.com/a/25489601
type: AnsweredQuestion

recursion
type: Tag
tags question: http://stackoverflow.com/q/25537439
tags question: http://stackoverflow.com/q/25540377
tags question: http://stackoverflow.com/q/25418859
tags question: http://stackoverflow.com/q/25515292
tags question: http://stackoverflow.com/q/25467817
tags question: http://stackoverflow.com/q/25396250
tags question: http://stackoverflow.com/q/25450570
tag name: recursion
tags question: http://stackoverflow.com/q/25428833
tags question: http://stackoverflow.com/q/25432970
tags question: http://stackoverflow.com/q/25473710
tags question: http://stackoverflow.com/q/25513751
tags question: http://stackoverflow.com/q/25442365
tags question: http://stackoverflow.com/q/25429016
tags question: http://stackoverflow.com/q/25470920
tags question: http://stackoverflow.com/q/25419934

http://stackoverflow.com/comment/39881864
comment on: http://stackoverflow.com/a/25536046
score: 0
type: AnswerComment
has text: @TariqSulaiman usually a test method signature is `@Test public void testSomething() throws Exception`. Any exception thrown during a test makes it red.
type: Comment

http://stackoverflow.com/comment/39809938
type: AnswerComment
comment on: http://stackoverflow.com/a/25503180
score: 0
has text: Yep, it seems a bit high. Are you using GUI ?
type: Comment

http://stackoverflow.com/a/25522052
answers question: http://stackoverflow.com/q/25521725
type: Answer
has body: Add this to the top of your class: protected static JButton button; protected static JTextField filterText; protected static TableRowSorter&lt;TableModel&gt; TableRowSorter;
score: 0

http://stackoverflow.com/comment/39791147
comment on: http://stackoverflow.com/a/25487656
score: 0
type: Comment
has text: You're correct in your approach. Don't be dogmatic and choose the best way depending on the situation.
type: AnswerComment

http://stackoverflow.com/q/25530342
score: 2
upvote count: 2
type: AnsweredQuestion
answer count: 3
has answer: http://stackoverflow.com/a/25530390
tagged with: java
downvote count: 0
tagged with: bitwise-operators
favorite count: 0
has answer: http://stackoverflow.com/a/25530399
type: Question
has title: Does the result of bitwise operations depend on endianess in Java? What about in C or C++?
has body: Consider the following code: long store; int firstValue = 0x1234; int secondValue = 0x5678; store = (((long) firstValue) &lt;&lt; 32) | secondValue; Is store guaranteed to have the value 0x12345678 regardless of the endianess of the machine... in Java? in C or C++?
accepted answer: http://stackoverflow.com/a/25530390
tagged with: http://stackoverflow.com/tag/c
tagged with: endianness
has answer: http://stackoverflow.com/a/25530451
possible better answer: http://stackoverflow.com/a/25530451
tagged with: c++

http://stackoverflow.com/comment/39653379
has text: I am able to read the input provided by the user(say 16).Now how to start a counter(for 16 hours) and run the code repeatedly till the time elapses?
comment on: http://stackoverflow.com/q/25419494
type: Comment
type: QuestionComment
score: 0

dropwizard
tags question: http://stackoverflow.com/q/25497258
type: Tag
tags question: http://stackoverflow.com/q/25480442
tags question: http://stackoverflow.com/q/25546778
tags question: http://stackoverflow.com/q/25497019
tags question: http://stackoverflow.com/q/25405997
tags question: http://stackoverflow.com/q/25496250
tags question: http://stackoverflow.com/q/25396459
tag name: dropwizard

http://stackoverflow.com/comment/39677317
type: Comment
type: QuestionComment
has text: possible duplicate of [jena api get range of ObjectProperty](http://stackoverflow.com/questions/24250198/jena-api-get-range-of-objectproperty). That question specifically asks about object properties, but the same code works for data properties.
score: 0
comment on: http://stackoverflow.com/q/25429479

http://stackoverflow.com/comment/39758199
type: QuestionComment
comment on: http://stackoverflow.com/q/25475837
has text: As always when it comes to performance related questios: Have you profiled? How much slower is the computation if you have a thread accepting / processing progress queries? My guess: Between none and not measurable. Keep it simple, focus on readability and maintainability.
score: 2
type: Comment

http://stackoverflow.com/a/25500545
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25477611
has body: From SpringSource Blog: Objects passed to and returned from the methods getForObject(), postForLocation(), and put() and are converted to HTTP requests and from HTTP responses by HttpMessageConverters. Converters for the main mime types and Java types are registered by default, but you can also write your own converter and plug it in the RestTemplate. In the example below, I will show you how that's done. I suppose the same for postForEntity(), so you may need to add a message converter for your specific mime type since it is not marshelled by default:
answers question: http://stackoverflow.com/q/25477611
type: Answer

http://stackoverflow.com/a/25487751
has comment: http://stackoverflow.com/comment/39780891
has comment: http://stackoverflow.com/comment/39780142
has body: You could do something like public &lt;E extends Enum&lt;E&gt;&gt; E getEnum( String text, Class&lt;E&gt; klass){ return Enum.valueOf(klass, text ); } So, for instance if there is an enum Letter public enum Letter { A, B, C} You could use it like this: Letter someLetter = getEnum("A", Letter.class); System.out.println(someLetter); //A
has comment: http://stackoverflow.com/comment/39780382
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25487619
score: 5
accepted answer of: http://stackoverflow.com/q/25487619
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39804214
has text: Correct, but unlike with AssertionClause.body, there are no overloaded methods "property" or "header" that accept the class to convert to (http://camel.apache.org/maven/camel-2.13.0/camel-core/apidocs/org/apache/camel/component/mock/AssertionClause.html). Am I missing something?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25487228

http://stackoverflow.com/comment/39819376
has text: I don't see any attempt at sorting in your code; I suspect you're supposed to write a `Comparator` that follows the "qwerty" sorting rules you posted.
comment on: http://stackoverflow.com/q/25508552
type: Comment
type: QuestionComment
score: 8

http://stackoverflow.com/q/25540193
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25546036
tagged with: scheduled-tasks
answer count: 1
has body: I'm using Cron to schedule an the upload of a file to the server in specific time given by the adminstrator. i created an interface on java, where the user can choose the time of execution of the upload program, and submit the chosen values, once submitted the following method is executed: public class Reminder { String minute; //static int i=0; String heur; String substr=","; String patterns; List&lt;String&gt; list = null; List&lt;String&gt; lines = new ArrayList&lt;&gt;(); Timer timer; FTPUploadFileDemo up=new FTPUploadFileDemo(); public void start() throws IOException { /************ Get the chosen values from the administrator saved in a CSV file *********************************************************/ BufferedReader reader; try { reader = new BufferedReader(new FileReader("C:/Users/BACKENDPC1/Desktop/timer.csv")); String line = null; while ((line = reader.readLine()) != null) { lines.add(line); }} catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace();} /**********************create cron patterns *********************************************/ patterns=""; for(int i=0; i&lt;lines.size();i++) { heur=lines.get(i).substring(0, lines.get(i).indexOf(substr)); minute=lines.get(i).substring(lines.get(i).indexOf(substr) + substr.length()); System.out.println("Time selected is: "+heur+","+minute); patterns=patterns+minute+" "+heur+" * * *|"; } System.out.println(patterns); // Creates the scheduler. Scheduler scheduler = new Scheduler(); // Schedules the task, once every minute. scheduler.schedule(patterns,new RemindTask()); scheduler.start(); try { Thread.sleep(1L * 60L * 1000L); } catch (InterruptedException e) { System.out.println(e); } // Stops the scheduler. scheduler.stop(); } class RemindTask extends TimerTask { public void run() { up.Uplaod(); } } } the scheduling works and it runs but, every time the user interface i created freeze, i don't get any error and the program keeps running but the i can't use the interface anymore. …
type: Question
has title: cron schedule freeze
accepted answer: http://stackoverflow.com/a/25546036
tagged with: swing
has comment: http://stackoverflow.com/comment/39888883
linked to: http://stackoverflow.com/q/15655126
type: AnsweredQuestion
tagged with: cron

http://stackoverflow.com/q/25514754
tagged with: debugging
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39831172
downvote count: 0
answer count: 1
score: 2
has body: When I debug my app if I step over a line it takes about 10 seconds vs when I resume to next break point on the next line it only takes about 1 second. For example. 10 MyObject obj = Dao.getAnItem(); // getAnItem makes a few database calls via Hibernate 11 some other code. I have breakpoints on both lines 10 and 11. When the program is debugged if I step over line 10 it takes about 10 seconds to return. However, if I "resume" to the next breakpoint (i.e. line 11) then it only takes about 1 second.
has answer: http://stackoverflow.com/a/25518587
has comment: http://stackoverflow.com/comment/58800782
has title: Debugging "step over" takes much longer than "resume"
tagged with: java
has comment: http://stackoverflow.com/comment/39831210
tagged with: eclipse
favorite count: 0
type: Question

http://stackoverflow.com/comment/40083553
type: Comment
comment on: http://stackoverflow.com/a/25592037
type: AnswerComment
score: 0
has text: +1 This is good, except for one thing, namely possible accumulation of already consumed things in one of the queues (as you noted). It may work well and profiling is no bad idea, but it can't tell me what happens for other inputs.

http://stackoverflow.com/comment/39692912
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25440889
has text: If this is not your repository, then the owner must give you access to it. Maybe this is the problem. Otherwise ... Everything seems to be correct.
score: 0

http://stackoverflow.com/comment/39702505
comment on: http://stackoverflow.com/q/25446314
has text: Remember you might have to escape the escape in Java code. Consider `"\\b\\w+\\b"`, or am I barking up the wrong tree?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25398081
type: Question
answer count: 2
tagged with: jersey
has body: I can't seem to figure out Why I am getting this Exception when trying to return JSON from Jersey REST webservice. I have a web dynamic project with Jersey, No Maven. Aug 20, 2014 2:15:16 AM com.sun.jersey.spi.container.ContainerResponse logException SEVERE: Mapped exception to response: 500 (Internal Server Error) javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class com.examples.rest.StoredSearch, and Java type class com.examples.rest.StoredSearch, and MIME media type application/json was not found //web.xml jersey-Employee-serlvet com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages com.examples.rest com.sun.jersey.api.json.POJOMappingFeature true 1 jersey-Employee-serlvet /rest/* </web-app> //under WEB-INF/lib asm-3.1jar jersey-core-1.16.jar jersey-json-1.16.jar jersey-server-1.16.jar jersey-servlet-1.16.jar I also added jersey-json-1.16.jar to build path. //@XmlRootElement public class StoredSearch { String username; String name; String description; Date created; public String getUsername() { return username; } public void setUsername(String username) { this.username=username; } public String getName() { return name; } public void setName(String name) { this.name=name; } public String getDescription() { return description; } public void setDescription(String description) { this.description=description; } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } @Override public String toString() { return "StoredSearch [username=" + username + ", name=" + name + ", description=" + description + ", created=" + created + "]"; } @GET @Path("/search/{a}") @Produces(MediaType.APPLICATION_JSON) public StoredSearch getStoredSearch(@PathParam("a") String user){ StoredSearch ss = new StoredSearch(); ss.setUsername("ssss"); ss.setName("yoo"); ss.setDescription("description of something"); ss.setCreated(new Date()); //return …
type: UnansweredQuestion
tagged with: web-services
has comment: http://stackoverflow.com/comment/39985812
has answer: http://stackoverflow.com/a/31693222
score: 0
has answer: http://stackoverflow.com/a/25398827
tagged with: rest
has title: JSON RestWebservice in Java Jersey
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39613622

http://stackoverflow.com/comment/39699836
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25444597
type: Comment
has text: _stream_ the `json`. Copying massive chunks of data into memory is the naive approach and is not at all scalable.

http://stackoverflow.com/comment/39732699
type: AnswerComment
comment on: http://stackoverflow.com/a/25461823
score: 0
has text: It is a singleton: only one instance exists in the program. It does not implement the singleton pattern (`getInstance()` method) because it's precisely what I want to avoid.
type: Comment

http://stackoverflow.com/comment/39784052
score: 3
type: Comment
has text: To the editors: Don't fix up the question and fix the actual PROBLEM. Fixing formatting is one thing, fundamentally "breaking" the question by fixing the problem is entirely another thing. Changing `=` to `==` is the ANSWER, so making that change the question negates the purpose of the question and just leaves everyone else wondering what the problem was.
type: QuestionComment
comment on: http://stackoverflow.com/q/25489528

http://stackoverflow.com/comment/39841458
score: 0
has text: may be they have integrate some new rules or change some configurations in the firewall.
type: Comment
comment on: http://stackoverflow.com/q/25520498
type: QuestionComment

http://stackoverflow.com/comment/39694942
comment on: http://stackoverflow.com/q/25441780
type: Comment
type: QuestionComment
has text: It's a very broad question because you don't mention what you think is strange about this. Please answer this: why would you not use `Comparable<?>` as the key type? (Hint: is your issue with the syntax `<?>`, or do you wonder why it's comparable even though a HashMap doesn't compare, or is the code that is taking things from the HashMap never using the type `Comparable`, etc. etc?)
score: 0

http://stackoverflow.com/comment/39883373
type: Comment
score: 0
type: QuestionComment
has text: The code is running windows machine perfectally
comment on: http://stackoverflow.com/q/25543714

http://stackoverflow.com/comment/39804063
score: 1
comment on: http://stackoverflow.com/q/25500328
type: QuestionComment
type: Comment
has text: Maybe this helps you: http://stackoverflow.com/questions/14385233/setting-a-cookie-using-javafxs-webengine-webview It states, that WebEngine is using an own implementation of CookieHandler.

http://stackoverflow.com/q/25478129
tagged with: cookies
tagged with: java
has comment: http://stackoverflow.com/comment/39762606
has body: I am trying to make a web scraper using my university's website. I am having trouble even loading the sign-in page because it says I do not have javascript and cookies enabled when I believe I do. WebClient webClient = new WebClient(BrowserVersion.CHROME); webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setRedirectEnabled(true); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setUseInsecureSSL(true); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getCookieManager().setCookiesEnabled(true); // Sign In Page final HtmlPage signInPage = webClient.getPage("https://eraider.ttu.edu/"); System.out.println(signInPage.getWebResponse().getContentAsString()); I am receiving the following message: This web site requires that JavaScript and Cookies be enabled in your web browser. We were unable to determine if your browser has these features enabled because META REFRESH failed. You need to make sure META REFRESH is enabled in your browser's security settings. If you need assistance, contact the TTU IT Help Desk at 806-742-HELP (4357). I was not able to figure out what meta refresh is. Update: I tried adding: new WaitingRefreshHandler().handleRefresh(signInPage, new URL("https://eraider.ttu.edu/"), 10); but only received this before receiving the same result as before: Aug 24, 2014 9:28:54 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify WARNING: Obsolete content type encountered: 'application/x-javascript'. Aug 24, 2014 9:28:55 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify WARNING: Obsolete content type encountered: 'text/javascript'. Aug 24, 2014 9:29:05 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify WARNING: Obsolete content type encountered: 'text/javascript'. Solved When using HtmlUnit, use WaitingRefreshHandler and make sure you wait until the page is fully loaded. When using Seleniu…
type: Question
tagged with: htmlunit
type: UnansweredQuestion
tagged with: javascript
has comment: http://stackoverflow.com/comment/39762656
has title: Javascript and cookies are enabled, but they still aren't? Meta refresh?
score: 0
has comment: http://stackoverflow.com/comment/39762625
answer count: 0

http://stackoverflow.com/a/25414782
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25414628
answers question: http://stackoverflow.com/q/25414628
type: Answer
has body: Given List&lt;Orange&gt; fruit; Then for (Orange orange : fruit) will loop over every fruit which is an orange because the fruit list can only contain Oranges. This is the best way to iterate the list because it applies the most-specific type which unifies the items. Now, consider when a supertype is used for (Fruit someFruit : fruit) // an Orange is also a Fruit, okay someFruit.separateSlices(); // whoops! not all Fruit have slices } or for (Object anyObject : fruit) // an Orange is also an Object, okay anyObject.eat(); // whoops! can't eat random Objects } While a cast could be used, as all the items are guaranteed to be Oranges, it adds nothing to simply refining the type in the enhanced for-loop itself. Furthermore, using the specific type in the for loop prevents some trivial type-related mistakes. Consider this, List&lt;Fruit&gt; fruit; // now really fruit for (Orange orange: fruit) { // error: incompatible types, won't compile // as not all Fruit are Oranges // .. } But with the cast, List&lt;Fruit&gt; fruit = new ArrayList&lt;Fruit&gt;(); fruit.add(new Orange()); fruit.add(new Apple()); // valid, an Apple is also a Fruit for (Fruit someFruit: fruit) { // still most specific: Fruit, not Object Orange orange = (Orange)someFruit; // runtime ClassCastException on Apple } Thus, my suggestion is to use the most specific/refined type that applies to the problem domain. In the case of the original question that is to type each item as an Orange from the start; or perhaps to revise the assumption of using List&lt;Orange&gt; to store an assortment of different fruit.
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/25447733
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26914402
tagged with: imagemagick
tagged with: dicom
tagged with: java
answer count: 1
has title: Create a Dicom image
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40967064
downvote count: 0
tagged with: im4java
tagged with: image
accepted answer: http://stackoverflow.com/a/26914402
has body: I am currently working with a DICOM project in java. I am calculating the dicom values such as depth, off-axis ratio, width and height. I want to create a sample image with the calculated width and height. I should be a gray scale image, with varying densities of gray color in appropriate area. I have created a sample image with imagemagick, using concentric circles. Bit am not getting the exact image. It does not look like an actual dicom image. The variation of gray color does not have a linear behavior. Sample image is attached. Please suggest any other method to create dicom image. The density values are available in a list. depending upon the distance from the center, the gray color also changes according to the density value provided.

http://stackoverflow.com/a/25475428
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39764178
answers question: http://stackoverflow.com/q/25473472
has body: panelC2=new JPanel(); panelC2.repaint(); panelC2.revalidate(); textPanel3.revalidate(); textPanel3.repaint(); mainPanel.revalidate(); mainPanel.repaint(); The above code is unnecessary. First you create a new panel, but you don't add anything to the panel and you don't add the panel to any other component so there is no need to revalidate()/repaint() the panel. Same for the textPanel3 and mainPanel. You haven't made any changes so you don't need the code. Whenever you do dynamically add/remove components then you only need to revalidate()/repaint() the top level container. In this case that would be the mainPanel, because it will then revalidate() the textPanel3 and panelC2. F1scrollPanel = new JScrollPane(F1Table, ...) Another general comment is don't keep adding/removing components for a panel. The better approach is to create the scrollpane with an empty JTable. Then when you want to change the data in the table you just create a new TableModel and update the existing table by using the table.setModel(...) method. This way the table will automatically repaint itself and you don't even have to worry about revalidate() and repaint().
type: Answer
has comment: http://stackoverflow.com/comment/39764096
accepted answer of: http://stackoverflow.com/q/25473472
score: 1

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

http://stackoverflow.com/q/25473005
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39753009
has answer: http://stackoverflow.com/a/25473222
has answer: http://stackoverflow.com/a/25473142
has answer: http://stackoverflow.com/a/25473066
answer count: 3
type: UnansweredQuestion
tagged with: multithreading
has title: terminate the threads in java
has body: if(thread.isalive()) { // Terminate it such that no CPu memory and resources should be used } I want to terminate the threads so that no computers resources and memory would be used.Please Guide me in this
type: Question

http://stackoverflow.com/q/25395797
possible better answer: http://stackoverflow.com/a/25396969
type: Question
has answer: http://stackoverflow.com/a/25396058
answer count: 3
tagged with: algorithm
has comment: http://stackoverflow.com/comment/39609940
tagged with: java
has body: *...*..D .G..*..... **...**. .S....*. ........ ...G**.. ........ .G..*... Here is 2d array where S- Source D-Destination G-Point must be visited ." . "Free paths "*"Block Paths Can you help me which would be the efficient algorithm to find the length of shortest pathi in java Only Horizontal and Vertical movements are possiable
has comment: http://stackoverflow.com/comment/39609981
upvote count: 4
type: AnsweredQuestion
tagged with: shortest-path
has answer: http://stackoverflow.com/a/25396969
has comment: http://stackoverflow.com/comment/39609690
has comment: http://stackoverflow.com/comment/39609899
has title: Shortest path in 2d arrays
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/39609642
score: 4
has answer: http://stackoverflow.com/a/25396045
accepted answer: http://stackoverflow.com/a/25396058
favorite count: 0

http://stackoverflow.com/q/25470918
favorite count: 0
has answer: http://stackoverflow.com/a/25471045
answer count: 2
accepted answer: http://stackoverflow.com/a/25473684
tagged with: printwriter
upvote count: 1
has title: Why do I get a PrintWriter null pointer exception when using PrintWriter in another class
has body: I have been using Java for a while for tasks and support tools, but I have never worked out how to use PrintWriter in a class that I can then use from another class, for example, I have several XML files that I want to parse, and then output to tables from a single input source (an .xls report), and I have several output files for the different XML's and child nodes. So I created this class to create a PrintWriter and report if the output file exists already: public class PrintAdmin { public PrintWriter pout; public int PrintFromElement = 0; public PrintAdmin(String Dirname) throws IOException { PrintWriter pout = new PrintWriter(new BufferedWriter(new FileWriter((Dirname)))); int PrintFromElement = 0; File f1 = new File("FirstNode.CSV"); if(f1.exists()) { PrintFromElement = 1; } else { PrintFromElement = 0; } } public void poutclose() { this.pout.close(); } } This is called from: public class AuditParser { public static File Auditor; public static void main(String[] args) throws IOException { PrintAdmin xmltype1out = new PrintAdmin(xmltype1); ... for (int xml1 = PrintAdmin.PrintFromElement: xml1 &lt; xml1parsed.header.size();xml1++) { ...dostuff... } And this pattern is repeated 4 or 5 times. My problem is that while I get a good compile using PrintAdmin in AuditParser, at runtime I get a NullPointerException. I want to do it this way to have the simple class that creates a PrintWriter which instructs to print the header record or not depending on whether the file exits already. It is useful here, and I am sure it would be useful for me elsewhere....
type: Question
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39749681
has comment: http://stackoverflow.com/comment/39753819
has answer: http://stackoverflow.com/a/25473684
downvote count: 1
possible better answer: http://stackoverflow.com/a/25471045

http://stackoverflow.com/a/25507611
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25457032
answers question: http://stackoverflow.com/q/25457032
type: Answer
has body: Axel, That sort of pointed me in the right direction, but I should note that the XCell interface doesn't have a getPropertyValue method. Instead, one needs to get the XPropertySet of the XCell object. Here is the full code that does work: public void mergeCells(int startColumn, int startRow, short endColumn, short endRow) { if (endRow == 0 &amp;&amp; endColumn == 0) { return; } XCell xCell = getCell(column, row); //Custom method to get cell XPropertySet props = null; try { props = (XPropertySet) FileManager.getOOoUnoRuntimeQueryInterface(XPropertySet.class, xCell); } catch (Exception ex) { // Do error stuff } XTextTableCursor textTableCursor = null; String cellName = null; try { cellName = props.getPropertyValue("CellName").toString(); } catch (Exception ex) { // Do error stuff } try { textTableCursor = xTextTable.createCursorByCellName(cellName); textTableCursor.goRight(endColumn, true); textTableCursor.goDown(endRow, true); textTableCursor.mergeRange(); } catch (Exception ex) { // Do error stuff } }

http://stackoverflow.com/a/25508446
type: Answer
has comment: http://stackoverflow.com/comment/39855423
has body: I think you need to remove the whitespace from you input string. Try this: Cell a2=sheet.getCell(6,4); String contenuA1= a2.getContents(); contenuA1 = contenuA1.replaceAll("\\s", ""); // Removes whitespace double contenu= Double.parseDouble(contenuA1);// The problem is here but why? System.out.print (contenu+" xx ");
has comment: http://stackoverflow.com/comment/39820900
answers question: http://stackoverflow.com/q/25508102
has comment: http://stackoverflow.com/comment/39842924
score: 0
has comment: http://stackoverflow.com/comment/39819352

http://stackoverflow.com/comment/39703380
has text: I tried same and works for me.. Can you try removing Triggers. I suspect problem is due to that.
type: AnswerComment
comment on: http://stackoverflow.com/a/25443850
score: 1
type: Comment

http://stackoverflow.com/comment/40055429
comment on: http://stackoverflow.com/a/25498529
score: 0
type: AnswerComment
has text: You have to match the category keyword to what's stored in the Master CateogryList (for that Mailbox) to tell what colour is associated with the Category Keyword. This is a per Mailbox configuration Item so different users may have different colours assigned to the same keyword.
type: Comment

http://stackoverflow.com/q/25512440
score: 0
tagged with: jsf
tagged with: java
answer count: 1
has body: I have created a method to add and I used the jsf and hibarnate framwork but a notable exception appear and she blocked me. the code View: &lt;h:body&gt; &lt;h:form&gt; &lt;h:outputLabel value="Prenom: " style="font-size:15px; font-family:verdana;" /&gt; &lt;p:inputText value="#{Bean.user.prenom}" style="width:201px; height:20px; font-size:15px;" /&gt; &lt;h:outputLabel value="Nom: " style="font-size:15px; font-family:verdana;" /&gt; &lt;p:inputText value="#{Bean.user.nom}" style="width:201px; height:20px; font-size:15px;" /&gt; &lt;h:commandButton value="Submit" actionListener="#{Bean.saveUser()}" /&gt; &lt;/h:form&gt; &lt;/h:body&gt; the code bean manager is : @ManagedBean(name="Bean") @RequestScoped @Component public class UserManager{ @Autowired private UserService userService; private User user; public UserService getUserService() { return userService; } public void setUserService(UserService userService) { this.userService = userService; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public void saveUser(){ userService.add(user); } } When I submit the form I get this error Etat HTTP 500 - /pages/test.xhtml @13,102 value="#{Bean.user.prenom}": Target Unreachable, 'user' returned null . Can you help me to find the problem
accepted answer: http://stackoverflow.com/a/25512461
has answer: http://stackoverflow.com/a/25512461
type: Question
has comment: http://stackoverflow.com/comment/39840457
has title: Target Unreachable, 'user' returned null
type: AnsweredQuestion

http://stackoverflow.com/a/25447812
has comment: http://stackoverflow.com/comment/39709370
answers question: http://stackoverflow.com/q/25447462
has comment: http://stackoverflow.com/comment/39706587
has body: public int random(int[] array) { Random generator = new Random(); int lotto = generator.nextInt(20) + 1; for(int i = 0; i &lt; array.length; ++i) if(array[i] == lotto) random(array); return lotto; } If you were to keep track of your values in an array, you could just check it against the rest of the array. The performance side of things wouldn't be necessarily too fantastic, but this would do you the job essentially. To answer the edit: In order to "take that out", which I'm doing my best to understand what you mean by that, in order to print the array, just do the code segment for(int num : cards) System.out.println(num)
type: Answer
score: 0

http://stackoverflow.com/a/56206755
downvote count: 0
has body: synchronized is an intrinsic lock which is beyond the control of JDK. Synchronization is built around an internal entity known as the intrinsic lock or monitor lock. (The API specification often refers to this entity simply as a "monitor.") Intrinsic locks play a role in both aspects of synchronization: enforcing exclusive access to an object's state and establishing happens-before relationships that are essential to visibility. When a thread invokes a synchronized method, it automatically acquires the intrinsic lock for that method's object and releases it when the method returns. The lock release occurs even if the return was caused by an uncaught exception. In your example, you are actually interrupting the sleep as JDK doc mentions. If this thread is blocked in an invocation of the wait(), wait(long), or wait(long, int) methods of the Object class, or of the join(), join(long), join(long, int), sleep(long), or sleep(long, int), methods of this class, then its interrupt status will be cleared and it will receive an InterruptedException. More details about how interrupt() works. Many methods that throw InterruptedException, such as sleep, are designed to cancel their current operation and return immediately when an interrupt is received.
score: 3
answers question: http://stackoverflow.com/q/25461463
type: Answer
upvote count: 3

http://stackoverflow.com/a/25479457
answers question: http://stackoverflow.com/q/25479363
score: 0
has body: There is no reason specific to start enum names with underscore. But as a good practice you can use All Caps for enum names. Since enums are very much similar to constants It is better to use all caps separate each word with underscore if you have more than one word e.g. apple // this is not recommended APPLE &lt;-- this is recommended
type: Answer

http://stackoverflow.com/comment/39845872
has text: it wokred :)... Keeping it as VERTICAL did it, but not sure how(since I am new to Android).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25503520

http://stackoverflow.com/q/25505141
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/40283752
has comment: http://stackoverflow.com/comment/39862870
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39995968
has comment: http://stackoverflow.com/comment/39819937
tagged with: ldap
type: Question
has comment: http://stackoverflow.com/comment/39995930
has comment: http://stackoverflow.com/comment/39812497
has answer: http://stackoverflow.com/a/40283752
has comment: http://stackoverflow.com/comment/39992850
has title: LDAPConnection (org.apache.directory.ldap.client.api.LdapConnection) fails on ssl
has body: I get an error on trying to connect to my server via 636 and ssl enabled. I used apache directory studio to explore the Active directory and connected via port 636 and ssl (ldaps://....) now i got the following code: LdapConnection connection = new LdapNetworkConnection("172.16.1.8", 636, true); and this doesn't work: org.apache.directory.api.ldap.model.exception.LdapProtocolErrorException: PROTOCOL_ERROR: The server will disconnect! at org.apache.directory.api.ldap.model.message.ResultCodeEnum.processResponse(ResultCodeEnum.java:2163) at org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:129) at org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:112) at ch.berufsbildungscenter.notiztool.control.Account.login(Account.java:123) at ch.berufsbildungscenter.notiztool.control.Account.login(Account.java:100) at ch.berufsbildungscenter.notiztool.gui.control.LoginController$2.run(LoginController.java:53) Someone got an idea why not? Here's the login function: /** * Checks the pw with the pw on the Active Directory. * * @param username * @param pw * @param b * * @return true if login was successful, false if not. */ private static boolean login(String username, String pw, Berufsbildner b) { if(b == null) return false; String cn = b.getNachname() + " " + b.getVorname(); //Create connection to the LDAP server @SuppressWarnings("resource") LdapConnection connection = new LdapNetworkConnection("172.16.1.8", 636, true); //try to bind with the login data try { //------------------ Here's the exception connection.bind("CN="+ cn +",OU=Ausbilder,OU=Informatiker,OU=Ascom Bern,OU=Berufsbildungscenter,DC=bbcnet,DC=ch", pw); loggedin = true; currentAccount = b; } catch (LdapException e) { e.printStackTrace(); loggedin = false; return false; } return true; Thanks
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/39630731
type: Comment
type: QuestionComment
has text: Is an instance *protected* when any of its super-classes or super-interfaces are `protected`, `private`, or package-private?
score: 0
comment on: http://stackoverflow.com/q/25407260

http://stackoverflow.com/q/25495013
tagged with: java
has title: NetBeans Plugin - Perform Operation on User Saving the Code
type: Question
tagged with: netbeans
downvote count: 0
has answer: http://stackoverflow.com/a/25577051
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: netbeans-plugins
accepted answer: http://stackoverflow.com/a/25577051
has body: I'm building a plugin for NetBeans and I would like to know how I can perform an action when the user presses Ctrl+S or clicks the "Save …" button. I searched for this on Google, but I could not come up with some instructions or APIs to use to achieve this goal. In fact, I want to capture the contents of the NetBeans active editor each time the user saves, and at the same time, compiles the source code. Would you please give me some hints or resources on how to achieve this? Thanks in advance! Jeremie
score: 1

http://stackoverflow.com/comment/39913992
has text: My idea is, that the zip file format does not know about the character encoding of file names.
type: QuestionComment
comment on: http://stackoverflow.com/q/25519018
score: 0
type: Comment

http://stackoverflow.com/comment/39724698
type: Comment
comment on: http://stackoverflow.com/q/25457571
type: QuestionComment
score: 2
has text: @user2864740 it's not *the* problematic line, it's one of many :)

http://stackoverflow.com/a/25532386
has comment: http://stackoverflow.com/comment/39863355
type: Answer
has body: Even though an EventType is an Enum, a List&lt;EventType&gt; is not a List&lt;Enum&lt;?&gt;&gt;, because Java's generics are invariant. Change the signature of toDbInClauseEnum to include an upper bound wildcard: // vvvvvvvvv public static String toDbInClauseEnum( final List&lt;? extends Enum&lt;?&gt;&gt; pEnums ) This will work because the wildcard allows a subclass type, e.g. EventType, to be the generic type parameter.
upvote count: 4
score: 4
answers question: http://stackoverflow.com/q/25532319
downvote count: 0

http://stackoverflow.com/q/25542231
answer count: 2
downvote count: 0
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25550293
accepted answer: http://stackoverflow.com/a/25550293
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25613751
has body: Using Hibernate Envers (4.1.9.Final). Trying to get all the revisions (date, revision number) for which a entities have changed of a certain type and that match a certain criterion. This is the code that I'm currently having: AuditReader auditReader = AuditReaderFactory.get(entityManager); AuditQuery query = auditReader.createQuery() .forRevisionsOfEntity(InventoryItem.class, false, true) .add(AuditEntity.property("section_uuid").eq(sectionUuid)) .addOrder(AuditEntity.revisionNumber().desc()); List&lt;Object[]&gt; revisions = query.getResultList(); This returns one element for each changed InventoryItem. So, if two InventoryItems were changed in a revision, I get two elements -- I do not want that. This returns also the actual InventoryItems, I think that's a bit heavy -- I do not want that. How can I get a distinct collection of revisions (date, revision number)?
tagged with: hibernate-envers
score: 1
tagged with: java
tagged with: hibernate
has title: Hibernate Envers get revisions for criteria
type: Question
has answer: http://stackoverflow.com/a/25613751

http://stackoverflow.com/comment/39622786
has text: Yes, this code is in the custom adapter (in the getView event) which is added to the listview
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25403293
type: Comment

http://stackoverflow.com/q/25443336
accepted answer: http://stackoverflow.com/a/25446721
has body: I'm trying to set a one-to-one mapping between two tables by using playframework.I would like to create rating list for each user after this mapping. However, I couldn't. Could you help me? My two seperate classes are like that: User.java package models; import java.util.*; import javax.persistence.*; import play.db.jpa.Model; @Entity @Table(name = "`user`") public class User extends Model { public String name; public String surname; public String password; public String username; public Date lastlogin; @Id @GeneratedValue } UserRating.java package models; import java.util.*; import javax.persistence.*; import play.db.jpa.Model; @Entity @Table(name = "`userrating`") public class UserRating extends Model { public double rating; @Id @GeneratedValue @MapsId @OneToOne() @JoinColumn(name="user_id") public User user; } My yaml file is that: User(19): name: freud surname: lily password: x56 username: freud lastlogin: 2010-05-02 User(20): name: osman surname: özsu password: 798 username: osman lastlogin: 2004-12-11 UserRating(1): rating: 1.2 user: User(2)
type: Question
has answer: http://stackoverflow.com/a/25446721
score: 0
has comment: http://stackoverflow.com/comment/39699262
tagged with: playframework
possible better answer: http://stackoverflow.com/a/25449042
tagged with: jpa
has title: How to make one-to-one mapping playframework
has answer: http://stackoverflow.com/a/29413533
has answer: http://stackoverflow.com/a/25449042
linked to: http://stackoverflow.com/q/18298173
tagged with: one-to-one
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39702586
answer count: 3
tagged with: java
tagged with: database

http://stackoverflow.com/comment/39685010
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25435178
has text: ReplyFragment:46 its View view = inflater.inflate(R.layout.work_reply_fragment, container, false);

http://stackoverflow.com/comment/39774183
has text: thanks for taking the time to reply - much appreciated !
type: AnswerComment
comment on: http://stackoverflow.com/a/25483619
score: 0
type: Comment

http://stackoverflow.com/q/25492353
has comment: http://stackoverflow.com/comment/39799102
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/39820388
has comment: http://stackoverflow.com/comment/39792963
has comment: http://stackoverflow.com/comment/39790304
has comment: http://stackoverflow.com/comment/39797032
has comment: http://stackoverflow.com/comment/39961129
has comment: http://stackoverflow.com/comment/39799030
tagged with: jtable
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25494317
score: 0
has comment: http://stackoverflow.com/comment/39792971
has comment: http://stackoverflow.com/comment/39968014
has comment: http://stackoverflow.com/comment/39792031
has answer: http://stackoverflow.com/a/25494317
tagged with: java
has comment: http://stackoverflow.com/comment/39792085
answer count: 1
has comment: http://stackoverflow.com/comment/39797004
has comment: http://stackoverflow.com/comment/39799017
has title: reading desired data from file but saving the whole file data
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39901868
has body: I have made a GUI using swing, i read data from a text file to the jtable, the text file has 6 columns and 5 rows,the 3 row has values 0,0.0,0,0,0,0.so i want to display values in the JTable till it encounters 0.but to save the full text file while saving which means values of 5 rows.here is my code: import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.table.*; public class Bb extends JFrame { private JTable table; private DefaultTableModel model; @SuppressWarnings("unchecked") public Bb() { String aLine ; Vector columnNames = new Vector(); Vector data = new Vector(); try { FileInputStream fin = new FileInputStream("Bbb.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(fin)); StringTokenizer st1 = new StringTokenizer(br.readLine(), " "); while( st1.hasMoreTokens()) { columnNames.addElement(st1.nextToken()); } while ((aLine = br.readLine()) != null ) { StringTokenizer st2 = new StringTokenizer(aLine, " "); Vector row = new Vector(); while(st2.hasMoreTokens()) { row.addElement(st2.nextToken()); } data.addElement( row ); } br.close(); } catch (Exception e) { e.printStackTrace(); } model = new DefaultTableModel(data, columnNames); table = new JTable(model); JScrollPane scrollPane = new JScrollPane( table ); getContentPane().add( scrollPane ); JPanel buttonPanel = new JPanel(); getContentPane().add( buttonPanel, BorderLayout.SOUTH ); JButton button2 = new JButton( "SAVE TABLE" ); buttonPanel.add( button2 ); button2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if ( table.isEditing() ) { int row = table.getEditingRow(); int col = table.getEditingColumn(); table.getCellEditor(row, col).stopCellEditing(); } int rows = table.getRowCount(); int columns = table.getColumnCount(); try { StringBuffer Con = new StringBuffer(); for (int i = 0; i &lt; table.getRowCount(); i++) { for (int j = 0; j &lt; table.getColumnCount(); j++) { Object Value = table.get…
has comment: http://stackoverflow.com/comment/39789228
has comment: http://stackoverflow.com/comment/39873127

http://stackoverflow.com/q/25499800
tagged with: mobile
tagged with: layout
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39802687
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39803115
answer count: 1
has title: Android cannot get relative layout to place in correct position
has comment: http://stackoverflow.com/comment/39841311
has answer: http://stackoverflow.com/a/25516695
type: Question
has body: I cannot seem to position a relative layout based on the margins being set. Android seems to be placing the image at the top left corner of the screen for some reason. ImageView iv = new ImageView(super.getContext()); iv.setImageResource(R.drawable.image); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.topMargin=100; params.leftMargin=259; this.addView(iv, params); Ideally the image should be placed at 100,259 - however, it appears to be positioned at 0,0. The "this" reference in my code is a Framelayout.

http://stackoverflow.com/comment/39707329
comment on: http://stackoverflow.com/a/25448723
has text: Thank you for your answer! I really appreciate it! Actually I prefer the first answer too... but you know, customers.. You can't go against them... "Customers are always right..." ;)
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39631045
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25407380
has text: Tried this: absolutely nothing happens. The button's text does not update. The onProgressUpdate() method is never entered - even after calling publishProgress()

http://stackoverflow.com/q/25392656
accepted answer: http://stackoverflow.com/a/25635599
has comment: http://stackoverflow.com/comment/39604215
has comment: http://stackoverflow.com/comment/39604181
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39604116
score: 0
has comment: http://stackoverflow.com/comment/39604093
has comment: http://stackoverflow.com/comment/39604479
has comment: http://stackoverflow.com/comment/39604104
has comment: http://stackoverflow.com/comment/39616024
tagged with: java
has comment: http://stackoverflow.com/comment/39604712
answer count: 1
tagged with: bukkit
tagged with: mysql
has title: Java application gives random outputs of an integer
has answer: http://stackoverflow.com/a/25635599
type: Question
has comment: http://stackoverflow.com/comment/39604294
has comment: http://stackoverflow.com/comment/39604063
has comment: http://stackoverflow.com/comment/39604285
has body: I have been having an issue with my Java application where I give the user a certain amount of "points" in the database for every time they complete an action. 32 database points is equal to one ingame point. On the event that the user does an action a method is run to see if the points are a multiple of 32, then says you have skypoints after dividing the points from the database by 32. After the user completes the action a certain amount of times it stops working and returns 0 every time the user does an action, not even when it's a multiple of 32. Here is a screenshot of the output and the code is located below to give you an understanding of what I have. Screenshot: Code inside my database class public long getPoints(String uuid) { long points = 0; try { // Open a connection Connection conn = DriverManager.getConnection(DB_URL, USER, PASS); Statement stmt = conn.createStatement(); // Execute a query stmt = conn.createStatement(); String sql = "SELECT playerpoints FROM SkyPoints.players WHERE playerid='" + uuid + "';"; ResultSet rs = stmt.executeQuery(sql); while(rs.next()) { points = rs.getLong("playerpoints") / 32; } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } return points; } public long getRawPoints(String uuid) { long points = 0; try { // Open a connection Connection conn = DriverManager.getConnection(DB_URL, USER, PASS); Statement stmt = conn.createStatement(); // Execute a query stmt = conn.createStatement(); String sql = "SELECT playerpoints FROM SkyPoints.players WHERE playerid='" + uuid + "';"; ResultSet rs = stmt.executeQuery(sql); while(rs.next()) { points = rs.getLong("playerpoints"); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } return points; } Code inside my main class if(DatabaseObject.getRawPoints(uuid) % 32 == 0) { String newamount = String.valueOf(DatabaseObject.getPoints(uuid)); String word = null; if(DatabaseObject.getPoints(uuid) == 1) { word = "Point"; } e…

http://stackoverflow.com/q/25477109
has answer: http://stackoverflow.com/a/25477124
tagged with: batch-file
tagged with: java
answer count: 1
duplicate of: http://stackoverflow.com/q/615948
has title: Why can't I run a batch command from my java program?
accepted answer: http://stackoverflow.com/a/25477124
favorite count: 0
type: Question
has body: I'm trying to run a command from my java application. I get input from the user and run this line of code: Runtime.getRuntime().exec($userInput);. I've tried lots of simple commands, including "echo," "start chrome," and "rem." It seems that the only command that works is "cmd.exe," and I have no idea what that even does. Commands such as "echo" generate this error: java.io.IOException: Cannot run program "echo": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at me.Draconwolver.Main.runCmd(Main.java:119) at me.Draconwolver.Main.main(Main.java:34) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.&lt;init&gt;(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 6 more Feel free to ask me for more details.
upvote count: 5
has comment: http://stackoverflow.com/comment/39760674
tagged with: createprocess
score: 4
downvote count: 1
linked to: http://stackoverflow.com/q/615948
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17524332
tagged with: ioexception

http://stackoverflow.com/comment/39861755
has text: Look for [ButtonGroup with .getSelection()](http://docs.oracle.com/javase/7/docs/api/javax/swing/ButtonGroup.html#getSelection()) at http://docs.oracle.com/javase/tutorial/uiswing/components/button.html
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25531699
type: QuestionComment

http://stackoverflow.com/q/25521458
has title: How to give url of folder to ivy pattern
accepted answer: http://stackoverflow.com/a/25522137
tagged with: java
tagged with: ivy
answer count: 1
has body: In ivyconf.xml, I have pattern='${ivy.settings.dir}/../../lib/Google Guava/[artifact].[ext]' /&gt;. As you can see, I have wrote Google Guava in the pattern. However, I have more than one jar file stored in another folder in same level of Google Guava folder. I have tried ** in place of Google Guava, but I think it is not supported in ivyconf.xml. What should I wrote instead of Google Guava so that it searches all folders to resolve dependencies? ivyconf.xml &lt;resolvers&gt; &lt;filesystem name="local"&gt; &lt;artifact pattern='${ivy.settings.dir}/../../lib/Google Guava/[artifact].[ext]' /&gt; &lt;/filesystem&gt; &lt;/resolvers&gt; &lt;modules&gt; &lt;module organisation='FS' resolver='local' /&gt; &lt;/modules&gt; project structure project | - - - src ... | - - - lib | - - Google Guava | - - guava.jar | - - Folee | - - folee-1.4.0.jar
linked to: http://stackoverflow.com/q/25505746
type: Question
tagged with: ant
has comment: http://stackoverflow.com/comment/39856331
has answer: http://stackoverflow.com/a/25522137
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25480063
has body: I know there are lots of questions and answers about this but none of them are working. I am on a Windows 7 Computer. I have set my JAVA_HOME in Environment Variables but I keep on getting errors. I have set it to "C:\Program Files\java\jdkxxx\" (xxx = Java Version) I have tried setting it without quotes and it still doesn't work. I get the error ERROR: JAVA_HOME variable is set to an invalid directory: C:\Program Files\java\java1.7.0_21\ Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
has comment: http://stackoverflow.com/comment/39766256
has answer: http://stackoverflow.com/a/25480100
has answer: http://stackoverflow.com/a/33473623
downvote count: 0
upvote count: 1
has title: JAVA_HOME Errors
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39766227
score: 1
tagged with: windows
tagged with: java
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39766228
answer count: 2
accepted answer: http://stackoverflow.com/a/25480100
possible better answer: http://stackoverflow.com/a/33473623

http://stackoverflow.com/comment/41173058
comment on: http://stackoverflow.com/q/25467704
type: Comment
type: QuestionComment
score: 0
has text: I am trying to figure this one for my game too. Will update this if I find something. Interesting that there is no documentation on this anywhere even though the Games doc from Google specifically says that when responding to an invite the user should be taken directly to the game activity rather than the menu. Which would mean there is a way to force a specific activity to start.

http://stackoverflow.com/q/25497093
has comment: http://stackoverflow.com/comment/39798533
answer count: 0
has comment: http://stackoverflow.com/comment/39798703
type: UnansweredQuestion
tagged with: solr
has body: when i index a .docx document , with Apache Solr 4.9 (solr cell); it extracts the text with a lot of "\n", is there some way to either clean the field content or remove the "\n"? field content looks like: "content": [ " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Solr es un motor de búsqueda de código abierto basado en la biblioteca Java del proyecto Lucene, con APIs en XML/HTTP y JSON , resaltado de resultados, búsqueda por facetas, caché, y una interfaz para su administración \n \n " here is the code, i'm using SolrJ, java, tomcat 8, Apache Solr 4.9, also i tried to modificate schema.xml, using regex on the tokenizer to replace the "\n" with "" (blank), also another way but however nothing made it work the code is here : SolrServer solrServer = new HttpSolrServer(url, httpClient); ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract"); up.addFile(new File("C:\\doc.docx"),""); up.setParam("literal.id", "indexDoc.docx"); up.setParam("field", "anything"); up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true); NamedList&lt;Object&gt; result = solrServer.request(up); String y = ""; rsp = solrServer.query( new SolrQuery( "id:indexDoc.docx") ); System.out.println(rsp.toString()); `
tagged with: solr-cell
downvote count: 0
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39798561
type: Question
tagged with: indexing
has comment: http://stackoverflow.com/comment/39798063
has comment: http://stackoverflow.com/comment/39798636
tagged with: solrj
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39798357
has comment: http://stackoverflow.com/comment/39798480
has title: How to remove a lot of "\n" in text extracted from a Word file using Solr?

http://stackoverflow.com/a/25483840
downvote count: 0
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/131336508
type: Answer
accepted answer of: http://stackoverflow.com/q/25483338
has body: If you want the absence of the collection from the XML to correspond to an empty List in the Java object you just need to do the following. @XmlElement(required = false) private List&lt;String&gt; list = new ArrayList&lt;String&gt;(); This will marshal the same as if the field was null. There is only a difference in how a null and empty List is marshalled when the @XmlElementWrapper annotation is used. http://blog.bdoughan.com/2012/12/jaxb-representing-null-and-empty.html
answers question: http://stackoverflow.com/q/25483338
type: AcceptedAnswer

http://stackoverflow.com/q/25539891
downvote count: 0
answer count: 1
tagged with: java-8
score: 15
favorite count: 0
type: AnsweredQuestion
has body: Before Java 8 the common method was the Calendar API: Calendar cal = Calendar.getInstance(); int hour = cal.get(Calendar.HOUR_OF_DAY); How can I get the current hour, but using the new Date-Time API provided in Java 8?
tagged with: java
tagged with: java-time
has comment: http://stackoverflow.com/comment/39876786
accepted answer: http://stackoverflow.com/a/25539911
has answer: http://stackoverflow.com/a/25539911
has title: How to get the current hour with new Date-Time API in Java 8?
type: Question
upvote count: 15

http://stackoverflow.com/a/25493820
upvote count: 4
downvote count: 0
has body: studentName is a variable not an object - you garbage collect only objects. The only objects in here, as mentioned are the created String[] and "Peter Smith", and both are reachable, and thus not eligable for GC.
score: 4
answers question: http://stackoverflow.com/q/25493793
type: Answer

http://stackoverflow.com/comment/39852370
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25526319
score: 4
has text: Jsoup is (X)HTML parser, not browser simulator so it doesn't actually support CSS or JavaScript. Maybe instead of parser you should use web driver like selenium.

http://stackoverflow.com/q/25535057
score: 5
has comment: http://stackoverflow.com/comment/39867861
downvote count: 0
has answer: http://stackoverflow.com/a/51439869
has comment: http://stackoverflow.com/comment/39876228
tagged with: opencv
has answer: http://stackoverflow.com/a/39420015
has body: I am in the process of writing an Android application that uses JavaCV for some facial recognition. I have come across a slight problem where I need to convert from an org.opencv.core.Mat that the onCameraFrame(CvCameraViewFrame inputFrame) function returns to a org.bytedeco.javacpp.opencv_core.Mat that the org.bytedeco.javacpp.opencv_contrib.FaceRecognizer requires. I have found similar questions here and here but neither got a working solution.
upvote count: 5
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39867697
favorite count: 0
type: Question
answer count: 2
tagged with: javacv
type: UnansweredQuestion
has title: OpenCV Mat to JavaCV Mat conversion

http://stackoverflow.com/q/25502637
has answer: http://stackoverflow.com/a/25548820
upvote count: 2
has answer: http://stackoverflow.com/a/25502725
downvote count: 0
has body: I need to consume a webservice with webservice-security. This webservice was created using cxf (not by me). I tried so far: wsimport with locally downloaded wsdl (http://theopentutorials.com/examples/java-ee/jax-ws/create-and-consume-web-service-using-jax-ws/). This failed with a couple of errors. I tried it without -extension saying "no usable port, try using -extension". I tried it with -extension saying "no standard SOAP". So I thought this may be because they used CXF. web service client using cxf in eclipse (http://help.eclipse.org/luna/topic/org.eclipse.jst.ws.cxf.doc.user/tasks/create_client.html). When I select in step 3d "Apache CXF 2" the OK-button gets grayed out. Could be an unresolved error (https://bugs.eclipse.org/bugs/show_bug.cgi?id=351799) if I understand it right. wsdl2java (https://axis.apache.org/axis2/java/core/tools/eclipse/wsdl2java-plugin.html#Installation). I followed the instructions getting an exception when clicking finish "An error occurred while completing process - java.lang.InterruptedException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException". edit: I ran wsdl2java now in command prompt getting the following error: wsdl2java -d C:\xkfz -client -verbose C:\xkfz.wsdl Loading FrontEnd jaxws ... Loading DataBinding jaxb ... wsdl2java -d C:\xkfz -client -verbose C:\xkfz.wsdl wsdl2java - Apache CXF 3.0.1 Aug 26, 2014 4:07:23 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped INFORMATION: Operation {http://www.xoev.de/schemata/xkfz/1_1}verarbeiteXKfz cannot be unwrapped, input message must reference global element declaration with same localname as operation Is there any way to generate my desired classes? This shouldn't be that complicated :-/ I use Win7/64 with latest Eclipse EE and JDK.
linked to: http://stackoverflow.com/q/25391606
tagged with: wsdl2java
accepted answer: http://stackoverflow.com/a/25548820
has title: What is the easiest way to generate code from wsdl (cxf)?
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25503707
answer count: 3
tagged with: cxf
tagged with: java
tagged with: wsimport
tagged with: wsdl
has comment: http://stackoverflow.com/comment/39809038
possible better answer: http://stackoverflow.com/a/25503707
favorite count: 0
type: Question

http://stackoverflow.com/q/25529314
has title: How to fetch different columns from different tables using single query?
tagged with: java
has comment: http://stackoverflow.com/comment/39857556
has body: I need your humble help to a concept of web application. I want fetch different columns from different tables using single query. one column is same in all tables like pk_data(varchar). But I need different-different columns on basis pk_data(varchar) column. For example, I need user name from first table and address from second table and age from third table and cost from fourth table. But I need also use a where clause with pk_data(varchar) column. We can understand this question in other way. I have a HashSet Variable that has a number of String data(pk_data). I want fetch data on basis on this HashSet records. And all strings of HashSet do not belong to all tables. Please give suggestion to solve this issue.
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/39857597
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25529574
type: Question
has comment: http://stackoverflow.com/comment/39857478
has answer: http://stackoverflow.com/a/25529452
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39857058
has comment: http://stackoverflow.com/comment/39857467
has comment: http://stackoverflow.com/comment/39857390
has comment: http://stackoverflow.com/comment/39857274
tagged with: sql-server
answer count: 2
has comment: http://stackoverflow.com/comment/39857108
tagged with: sql
score: 0

http://stackoverflow.com/comment/40027630
has text: Thankyou, this is a nice thing to know! I'm not using Camel 2.13 so I don't have the format.setUseMaps() option but I get the values as a List of List<String> so no problem. I'll give it a try today and see how I can figure the fields out and populate my beans ( I have an idea, I'll share it here if it works). (btw I'm using Camel 2.10.7 for max compatibility with ServiceMix 4.5.3)
type: Comment
comment on: http://stackoverflow.com/a/25612392
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39878789
comment on: http://stackoverflow.com/a/25540958
has text: Isn't there any way to get it programmatically?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25398532
has body: The first one catches all subclasses of Throwable (this includes Exception and Error), the second one catches all subclasses of Exception Class. Error is programatically unrecoverable in any way and should be avoided as far as catching is concerned, except for logging purposes, which in turn should throw it again. Error should not be caught, except if you are trying for something kinda "catch all" level of a thread. Exception is programmatically recoverable. Its subclass RuntimeException indicates a programming error and is usually not to be catched as well.
downvote count: 1
score: 3
has comment: http://stackoverflow.com/comment/39614302
has comment: http://stackoverflow.com/comment/39616714
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25398452

http://stackoverflow.com/q/25461673
has comment: http://stackoverflow.com/comment/40396261
has comment: http://stackoverflow.com/comment/39732061
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39858962
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40366994
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/21024851
tagged with: virtual
answer count: 0
has comment: http://stackoverflow.com/comment/39732073
type: UnansweredQuestion
downvote count: 0
tagged with: voice
has comment: http://stackoverflow.com/comment/40365810
has comment: http://stackoverflow.com/comment/39851887
has comment: http://stackoverflow.com/comment/39731980
linked to: http://stackoverflow.com/q/15255832
favorite count: 0
has title: Android Virtual Microphone
score: 4
has body: My question is more general and doesn't point to specific code segments. I would like to know is it possible to create a virtual microphone; for example when I connect my headset, my phone uses the microphone on the headset. Is there a way to create a virtual headset for which I specify a file to be read as it's input stream (or input from another device)? I've heard these sort of things are impossible due to hardware restrictions but I feel like there should be a way to create virtual devices which can pretend they are real external devices. If the above is possible are there specific libraries or documentations which can help me since I did not find anything.

http://stackoverflow.com/comment/39881096
type: QuestionComment
type: Comment
has text: what is the point of throwing an exception if you end up just catching it , Log the reasonPhrase instead
score: 1
comment on: http://stackoverflow.com/q/25542268

http://stackoverflow.com/q/25499751
score: 0
has title: Gestures in activity - android
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39849910
type: Question
linked to: http://stackoverflow.com/q/23353173
has body: I need to implement few gestures in activity. I used Genymotion for that, saved gestures file in res/raw folder and wrote a code which is showing all good but keeps crashing the application. Does anyone know what could be the possible reason? I really tried to solve, but it seems i am missing something! protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GestureOverlayView gesturesView = new GestureOverlayView(this); View inflate = getLayoutInflater().inflate(R.layout.activity_garden, null); gesturesView.addView(inflate); gesturesView.addOnGesturePerformedListener(this); gestures = GestureLibraries.fromRawResource(this, R.raw.gestures); if (!gestures.load()) { finish(); } setContentView(gesturesView); } public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) { ArrayList&lt;Prediction&gt; predictions = gestures.recognize(gesture); int index = 0; double maxScore = predictions.get(index).score; for (int i = 1; i &lt; predictions.size(); i++) { if (predictions.get(i).score &gt; maxScore) { index = i; maxScore = predictions.get(i).score; } } Prediction p = predictions.get(index); if (p.name.equalsIgnoreCase("Love")) daisy.setImageResource(sp.getInt("Love", 0)); if (p.name.equalsIgnoreCase("Hit")) daisy.setImageResource(sp.getInt("Hit", 0)); if (p.name.equalsIgnoreCase("Pet")) daisy.setImageResource(sp.getInt("Pet", 0)); Toast.makeText(this, p.name + "\n" + p.score, Toast.LENGTH_SHORT) .show(); }
tagged with: android
has answer: http://stackoverflow.com/a/25525456
accepted answer: http://stackoverflow.com/a/25525456
has comment: http://stackoverflow.com/comment/39842914
type: AnsweredQuestion

http://stackoverflow.com/comment/39820900
type: AnswerComment
has text: Do you get a different error message when you try, or the same error message?
comment on: http://stackoverflow.com/a/25508446
score: 0
type: Comment

http://stackoverflow.com/q/25486283
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39777257
has answer: http://stackoverflow.com/a/25487028
tagged with: java
has body: Following is: appServlet-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:cache="http://www.springframework.org/schema/cache" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="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/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> <!-- <annotation-driven /> --> <!-- <context:annotation-config /> --> <mvc:annotation-driven /> <context:component-scan base-package="com.interlace"/> </beans:beans> web.xml <?xml version="1.0" encoding="UTF-8"?> appServlet org.springframework.web.servlet.DispatcherServlet 1 appServlet / HelloController.java @Controller @RequestMapping("/welcome") public class HelloController { @RequestMapping("/hello") public ModelAndView helloWorld(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception { return new ModelAndView("/HelloWorld.jsp"); } } No mapping found for HTTP request with URI [/HelloWorld/welcome/hello] in DispatcherServlet with name 'appServlet' I am using spring 3.2.0 if have added all required jar files.I am using without maven.Please try to help me
type: Question
has answer: http://stackoverflow.com/a/25486707
type: UnansweredQuestion
has title: Spring 3.2.0 no uri found
has comment: http://stackoverflow.com/comment/39777162
tagged with: javascript

http://stackoverflow.com/a/25401101
answers question: http://stackoverflow.com/q/25400355
has body: @Override protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException { //Send 204 back resp.setStatus(HttpServletResponse.SC_NO_CONTENT); // Continue with you logic here . . . .
type: Answer
score: 0

http://stackoverflow.com/comment/42823015
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25483014
has text: Just change your `onCreateOptionMenu` code to `onPrepareOptionMenu`

http://stackoverflow.com/q/25397161
has answer: http://stackoverflow.com/a/25397822
score: 1
tagged with: java
has body: ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;&gt;(); HashMap&lt;String, String&gt; map1 = new HashMap&lt;&gt;(); map1.put("Country", "India"); map1.put("State", "Tamilnadu"); map1.put("Distict", "Ariyalur"); HashMap&lt;String, String&gt; map2 = new HashMap&lt;&gt;(); map2.put("Country", "India"); map2.put("State", "Tamilnadu"); map2.put("Distict", "Salem"); HashMap&lt;String, String&gt; map3 = new HashMap&lt;&gt;(); map3.put("Country", "India"); map3.put("State", "Tamilnadu"); map3.put("Distict", "Trichy"); HashMap&lt;String, String&gt; map4 = new HashMap&lt;&gt;(); map4.put("Country", "India"); map4.put("State", "Kerala"); map4.put("Distict", "State1"); HashMap&lt;String, String&gt; map5 = new HashMap&lt;&gt;(); map5.put("Country", "Pak"); map5.put("State", "Kerala"); map5.put("Distict", "State1"); mylist.add(map1); mylist.add(map2); mylist.add(map3); mylist.add(map4); mylist.add(map5); System.out.println(mylist); ArrayList&lt;HashMap&lt;String, String&gt;&gt; counstatelist = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; mylist.size(); i++) { HashMap&lt;String, String&gt; tempMap = new HashMap&lt;&gt;(); if (counstatelist.size() &gt; 0) { for (int j = 0; j &lt; counstatelist.size(); j++) { if ((!counstatelist.get(j).get("Country") .equals(mylist.get(i).get("Country"))) || (!counstatelist.get(j).get("State") .equals(mylist.get(i).get("State")))) { tempMap.put("Country", mylist.get(i).get("Country")); tempMap.put("State", mylist.get(i).get("State")); counstatelist.add(tempMap); } } } else { tempMap.put("Country", mylist.get(i).get("Country")); tempMap.put("State", mylist.get(i).get("State")); counstatelist.add(tempMap); } } System.out.println(counstatelist); In this code I want to get group of Country and State list. So my expected output is [{State=Tamilnadu, Country=India}, {State=Kerala, Country=India}, {State=Kerala, Country=Pak}] But this code gives me following output [{State=Tamilnadu, Country=India}, {State=Kerala, Country=India}…
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25397522
has comment: http://stackoverflow.com/comment/39612077
has comment: http://stackoverflow.com/comment/39612092
has comment: http://stackoverflow.com/comment/39612113
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25397986
has comment: http://stackoverflow.com/comment/39612524
has title: ArrayList of hashmap sorting in Java
upvote count: 1
has comment: http://stackoverflow.com/comment/39612109
answer count: 3

http://stackoverflow.com/a/25409779
score: 1
upvote count: 1
type: Answer
has body: Nested classes (that are not static) have access to instance fields of the outer class that non-nested classes wouldn't have. You can declare a nested class or interface to be private. This is useful when the implementation of a class benefits from defining other classes or interfaces; since the class or interface is an implementation detail, it should be hidden from clients that use the outer class. You can't do this if the class or interface is at the top level. (You can make it package-private, but it will still be visible to other classes in the same package, which may not be desirable. I think it depends on how tightly the implementation of the nested class is coupled to the implementation of the outer class. If the code in the nested class doesn't make sense independently of the code in the outer class, then it should probably be nested.) Other than those, it's a choice of how to name things. In Android, many classes that extend View have their own nested LayoutParams classes (over a dozen of them). I suppose they could have put all those classes at the top level and given them names like AbsListViewLayoutParams, TableRowLayoutParams, etc. (instead of AbsListView.LayoutParams, etc.), but the actual choice makes it clear that these are classes with similar purposes that are closely related to their "parent" classes. Setting up 17 packages or so to group those related classes together could have caused some other problems (perhaps they would no longer be able to access package-private members of other classes that they needed), and seems obnoxious even if it doesn't create this kind of problem.
answers question: http://stackoverflow.com/q/25409459
downvote count: 0

http://stackoverflow.com/comment/45001189
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25446411
has text: Does anyone knows if filling rectangle with fully transparent color (alpha = 0) creates a performance hit? Or is it optimized and skipped entirely?
type: Comment

http://stackoverflow.com/q/25471945
has body: Getting the following exception while starting the glassfish server (in Mac OS with jdk1.7.0_67). Let me know if you have any suggestion to resolve the java conflict and start the domain successfully. Thanks in Advance. The below one is result from Mac OS Mavericks -> Terminal &gt; pwd /Users/arj/glassfish3/bin &gt; **./asadmin start-domain domain1** Waiting for domain1 to start .Error starting domain domain1. The **server exited prematurely with exit code 1.** Before it died, it produced the following output: FATAL ERROR in native method: processing of -javaagent failed objc[20181]: **Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.** Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger at com.advisory.olympus.util.JavaAgentClass.&lt;clinit&gt;(JavaAgentClass.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397) Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 7 more lau…
has title: Glassfish not able to start due to conflict with java (available in jdk and jre) in Mac
type: UnansweredQuestion
tagged with: java
tagged with: macos
tagged with: eclipse
tagged with: glassfish
has answer: http://stackoverflow.com/a/25485595
score: 0
has comment: http://stackoverflow.com/comment/39763310
answer count: 1
has comment: http://stackoverflow.com/comment/39753354
type: Question

http://stackoverflow.com/comment/39834869
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25516561
type: AnswerComment
has text: <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.myFirstApp.MainActivity" /> I had this in the manifest. Is it not done properly?

containskey
tag name: containskey
tags question: http://stackoverflow.com/q/25408426
type: Tag

http://stackoverflow.com/comment/39607615
type: QuestionComment
has text: Added the entire stacktrace since the one previously was from an email.
score: 0
comment on: http://stackoverflow.com/q/25394140
type: Comment

http://stackoverflow.com/comment/39765096
type: QuestionComment
score: 3
type: Comment
has text: Java VM is "safe". It creates sandbox for program. So when you star VM you can define maximal limits for space (Xmx and Xms options). That will prevent server from allocating too much space and will crush VM and not whole server. For example, Erlang web server will eat all memory if needed and can hang down computer which will lead to reboot, but JMV will not, so you can easily restart it with script.
comment on: http://stackoverflow.com/q/25478780

http://stackoverflow.com/comment/39783964
has text: But all the checkboxes are properly selected/unselected, right? As you must provide the string converter, you need to provide the callback too, even it's not necessary in this case. You'll notice the callback gets called when you have `TreeItem` instances different than `CheckBoxTreeItem`, so you can return a proper select property for them if you need to.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25444841
type: Comment

http://stackoverflow.com/comment/39701888
type: QuestionComment
comment on: http://stackoverflow.com/q/25445433
has text: Very hard to believe. Sure it isn't thrown at readObject()?
score: 1
type: Comment

http://stackoverflow.com/comment/39669058
type: AnswerComment
has text: @Kent regex101 is free for everyone. Just click on `save regex` link. Are you not getting it?
type: Comment
comment on: http://stackoverflow.com/a/25427921
score: 0

http://stackoverflow.com/comment/39808744
has text: WOW! I'm overwhelmed. Now everything works. Thanks a million, I'm speechless. Have a nice day, greetings from Germany.
type: Comment
comment on: http://stackoverflow.com/a/25501929
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39826510
has text: Java I/O API is completely usable in Android.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25511493

http://stackoverflow.com/comment/39843639
has text: gently you could give me a helping hand.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25516991
score: 0

http://stackoverflow.com/comment/39770157
score: 0
has text: Use @SuppressWarnings('unchecked')
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25482238

constructor
tags question: http://stackoverflow.com/q/25394004
tags question: http://stackoverflow.com/q/25465253
tags question: http://stackoverflow.com/q/25442174
tags question: http://stackoverflow.com/q/25536470
tags question: http://stackoverflow.com/q/25435966
type: Tag
tags question: http://stackoverflow.com/q/25403932
tags question: http://stackoverflow.com/q/25488090
tags question: http://stackoverflow.com/q/25506710
tags question: http://stackoverflow.com/q/25530382
tags question: http://stackoverflow.com/q/25444917
tags question: http://stackoverflow.com/q/25401821
tags question: http://stackoverflow.com/q/25418122
tags question: http://stackoverflow.com/q/25456108
tags question: http://stackoverflow.com/q/25444266
tags question: http://stackoverflow.com/q/25414129
tags question: http://stackoverflow.com/q/25458497
tags question: http://stackoverflow.com/q/25443962
tag name: constructor

http://stackoverflow.com/a/25516813
answers question: http://stackoverflow.com/q/25516778
score: 1
type: Answer
has body: HTTPS uses SSL so yeah it's secure, but don't send the password in every requests (only when it's necessary) and don't store it on the phone. If you want to improve your security, you can add SSL pinning too: https://www.owasp.org/index.php/Certificate_and_Public_Key_Pinning
downvote count: 0
upvote count: 1

tess4j
type: Tag
tag name: tess4j
tags question: http://stackoverflow.com/q/25404464

http://stackoverflow.com/comment/39620499
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25397158
has text: @Yagnesh i am calling one method which is in data access class their i am retrieving image and its type and adding into bean class object and trying to retrieve on jsp using scriptlet help me in this if you can..
score: 0

http://stackoverflow.com/comment/39820506
type: AnswerComment
comment on: http://stackoverflow.com/a/25505097
score: 1
type: Comment
has text: @Manu Can you post the request and response (headers)?

http://stackoverflow.com/a/25397812
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25397800
has comment: http://stackoverflow.com/comment/39632958
has body: no you haven't: g2 = g1.clone (); is not in a try/catch block for the exception that the clone() method you're written is supposed to throw. Even if you catch the throw inside the method (which you should not do), your signature still tells java that the method will throw under unknown conditions, and thus code that calls it must use a try/catch, or the method inside which the call is made must itself have a throw CloneNotSupportedException. Either try/catch inside the method and don't declare a throw, or do declare a throw and then let the calling code handle the try/catch.
type: Answer
answers question: http://stackoverflow.com/q/25397800
score: 2
has comment: http://stackoverflow.com/comment/39613114
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/39853277
type: Comment
has text: What is `getGraphicsConfiguration()`?
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25527205

http://stackoverflow.com/comment/39729771
score: 0
comment on: http://stackoverflow.com/q/25460289
has text: is there connection timeout ? try setting ftpClient.setControlKeepAliveTimeout(300); (from documentation http://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/FTPClient.html). Also use ftp.enterLocalPassiveMode() if you are uploading file.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39636145
score: 0
comment on: http://stackoverflow.com/q/25410012
has text: Well, is it possible to make the class generic, and create a new instance with the knowledge of the class type at runtime? Ie i have Class<?> someClass = thirdPartyObject.getPropertyClass(); GenericObjectBuilder<?> gc = new GenericObjectBuilder<>(); ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39849322
comment on: http://stackoverflow.com/q/25525067
has text: Provide sample code which reproduces your issue.
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25438423
tagged with: java
tagged with: jdbc
tagged with: image
type: Question
linked to: http://stackoverflow.com/q/25378231
has body: i am trying to display a database table with blobs on a Jtable and i want the images to show but instead i get a set of codes in the column for images...Here are my codes: this class retrieves my db table from database through a result set... public class rs2Table { public static TableModel resultSetToTableModel(ResultSet rs) { try { ResultSetMetaData metaData = rs.getMetaData(); int numberOfColumns = metaData.getColumnCount(); Vector&lt;String&gt; columnNames = new Vector&lt;String&gt;(); // Get the column names for (int column = 0; column &lt; numberOfColumns; column++) { columnNames.addElement(metaData.getColumnLabel(column + 1)); } // Get all rows. Vector&lt;Vector&lt;Object&gt;&gt; rows = new Vector&lt;Vector&lt;Object&gt;&gt;(); while (rs.next()) { Vector&lt;Object&gt; newRow = new Vector&lt;Object&gt;(); for (int i = 1; i &lt;= numberOfColumns; i++) { newRow.addElement(rs.getObject(i)); } rows.addElement(newRow); } return new DefaultTableModel(rows, columnNames) { @Override public boolean isCellEditable(int row, int column) { //return all cells false return false; } }; } catch (SQLException e) { JOptionPane.showMessageDialog(null,e); return null; } } this is where i try to display the database table with images and other fields... private void retrvStaffList() { try { //this sql uses LEFT JOIN to merge tables with corresponding foreign keys //hence we it is going to display all staff with their specified info retrieved from all the tables in ONE table... String sql = "SELECT DISTINCT s.StaffName, d.DeptName, b.age, b.telephone, b.email, b.address, t.position, t.salary, b.image FROM Staffs AS s\n" + "LEFT JOIN Departments as d ON d.DepartmentID = s.DepartmentID\n" + "LEFT JOIN BioData AS b ON b.BioID = s.StaffID\n" + "LEFT JOIN StatusTable AS t ON t.ownerID = s.StaffID\n" + "ORDER BY s.StaffName"; PreparedStatement pStmt2 = connect.prepareStatement(sql); rs = pStmt2.executeQuery(); //get the staff table... staffTable.setModel(rs2Table.resultSetToTableModel(rs)…
has comment: http://stackoverflow.com/comment/39688623
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25438948
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/25438948
favorite count: 0
has title: how to display a database table with blobs in a JTable
linked to: http://stackoverflow.com/q/7331310
has comment: http://stackoverflow.com/comment/39689503
tagged with: jtable
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/61107627
score: 1

http://stackoverflow.com/a/26866486
has comment: http://stackoverflow.com/comment/53996717
answers question: http://stackoverflow.com/q/25493293
upvote count: 3
downvote count: 0
has body: Instead of relying on PCollection.size() method to check whether your collection is empty or not, you should use PCollection.length(), which does exactly what you need.
score: 3
type: Answer

http://stackoverflow.com/comment/39664910
comment on: http://stackoverflow.com/a/25399807
type: Comment
has text: Thanks for your help, I made the change, but still each function only works separately. Any ideas :S
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39634563
type: Comment
comment on: http://stackoverflow.com/a/25409233
has text: Actually, I did investigate before I read this. I got a compiler error instead. Back to the drawing board.
score: 0
type: AnswerComment

el
tags question: http://stackoverflow.com/q/25526966
tags question: http://stackoverflow.com/q/25495813
tag name: el
type: Tag

http://stackoverflow.com/comment/68347550
has text: still finding your useful contributions, 2 years later ! thanks MadProgrammer!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25419069
score: 0

http://stackoverflow.com/q/25532151
has comment: http://stackoverflow.com/comment/39867770
linked to: http://stackoverflow.com/q/4543858
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25534314
tagged with: sockets
linked to: http://stackoverflow.com/q/3954454
has body: I'm trying to monitor a port to get the outgoing/incoming packets (or sockets) from my PC using Java, more like what Wireshark does. I'm using this code: int portNumber = 5816; try { System.out.println("New ServerSocket..."); ServerSocket serverSocket = new ServerSocket(portNumber); serverSocket.setSoTimeout(5000); System.out.println("Accepting..."); serverSocket.accept(); System.out.println("Done Accepting."); } catch (IOException e) { System.out.println(e.getMessage()); } Now I can see the packets using Wireshark, and I can see the connection is established using Process Hacker 2, but I always get this output: New ServerSocket... Accepting... Accept timed out EDIT: The question, I got an application installed, that exchange packets with an external server (nor the client or the server are mine), i just want to intercept these packets and log them. and they are using 5816 port.
score: 2
upvote count: 2
type: UnansweredQuestion
has title: Monitor All outgoing/Incoming packet from a specific port
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39863322

http://stackoverflow.com/q/25546660
accepted answer: http://stackoverflow.com/a/25546840
has comment: http://stackoverflow.com/comment/39889038
has comment: http://stackoverflow.com/comment/39889287
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39888581
type: Question
tagged with: oop
has title: Object constructed automatically in java
has comment: http://stackoverflow.com/comment/39889217
has comment: http://stackoverflow.com/comment/39888513
has body: [EDIT] If getters in RolloParser is deleted, the problem is solved. But why getter method make the class constructed automatically? I have a class named RolloParser you can see below. I use this class to parse a JSON file in my assets folder. Problem is when I check this class is not null in my application class, I see that RolloParsehas already been constructed. I wonder why? Line 7 never works but parser object is not null. Application class method 1- private RolloParser parser=null; 2- public RolloParser getRolloParser(){ 3- 4- //in first run, parser object is not null ??? 5- 6- if(parser == null){ 7- parser = new RolloParser(mContext); 8- } 9- 10- return parser; 11- } Parser Class import java.io.IOException; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.content.Context; import android.util.Log; public class RolloParser { private String path ="www/android-device/rollo.json"; private String extension =".ttf"; private HashMap&lt;String, String&gt; iconMap; private HashMap&lt;String, String&gt; fontMap; public RolloParser(){ System.err.println(); } public RolloParser(Context context) { try { iconMap = new HashMap&lt;String, String&gt;(); fontMap = new HashMap&lt;String, String&gt;(); JSONObject objTop; try { objTop = new JSONObject(AndroidUtils.ReadFromfile(path, context)); String fonts = objTop.getString("fonts"); JSONObject objFonts = new JSONObject(fonts); JSONArray icons = objFonts.getJSONArray("icons"); JSONArray others = objFonts.getJSONArray("others"); for (int i = 0; i &lt; icons.length(); i++) { JSONObject objIcon = new JSONObject(others.get(i).toString()); iconMap.put(objIcon.get("family").toString(),objIcon.get("file").toString()+extension); }; for (int i = 0; i &lt; others.length(); i++) { JSONObject objIcon = new JSONObject(others.get(i).toString()); fontMap.put(objIcon.get("family").toString(),objIcon.get("file").toString()+extension); } for (int i = 0; i &lt; others.lengt…
tagged with: android
has answer: http://stackoverflow.com/a/25546840
has comment: http://stackoverflow.com/comment/39889939
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39830121
score: 0
type: Comment
type: QuestionComment
has text: @ripudam Service and Repository added. This is the actual code at the moment.
comment on: http://stackoverflow.com/q/25494507

http://stackoverflow.com/comment/39697600
type: AnswerComment
has text: @Will 1. It's `Object`, not `object`. 2. Primitive arrays are not instances of `Object[]`.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25410693

http://stackoverflow.com/comment/39703568
type: Comment
score: 0
type: AnswerComment
has text: @WilQu Please refer to the docs: http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html Method signature: `public Class<? super T> getSuperclass()`. And here `Class` is `java.lang.Class.class` So in the question `getSuperclass()` will return `Class<Parent>` and that is still an instance of type `Class` and not of type `Parent`.
comment on: http://stackoverflow.com/a/25446196

http://stackoverflow.com/comment/39817429
score: 0
type: Comment
type: QuestionComment
has text: ...to clarify: You already have a `Date` object that you can ‘pass to the DAO layer’. Never mind that output, it's just a string *representation* of the `Date`.
comment on: http://stackoverflow.com/q/25507245

http://stackoverflow.com/q/25527382
score: 1
tagged with: java
has body: In my application i am giving spannable to different word of single edit text, for that i am storing start and end position of different position on which i need to apply span method. like this i have used setChips method public void setChips() { // split string wich comma Log.i("FinalData", finaldata + " " + FPos.size() + " " + LPos.size()); SpannableStringBuilder ssb = new SpannableStringBuilder(finaldata); for (int i = 0; i &lt; FPos.size(); i++) { Log.i("Pos", " " + FPos.get(i) + " " + LPos.get(i)); LayoutInflater lf = (LayoutInflater) this .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); TextView textView = (TextView) lf.inflate(R.layout.chips_edittext, null); int f=FPos.get(i); int l=LPos.get(i); if(!chipflag){ //l++; } textView.setText(finaldata.substring(f,l)); // set setFlags(textView, finaldata.substring(f,l)); // set // capture bitmapt of genreated textview int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); textView.measure(spec, spec); textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight()); Bitmap b = Bitmap.createBitmap(textView.getWidth(), textView.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(b); canvas.translate(-textView.getScrollX(), -textView.getScrollY()); textView.draw(canvas); textView.setDrawingCacheEnabled(true); Bitmap cacheBmp = textView.getDrawingCache(); Bitmap viewBmp = cacheBmp.copy(Bitmap.Config.ARGB_8888, true); textView.destroyDrawingCache(); // destory drawable // create bitmap drawable for imagespan BitmapDrawable bmpDrawable = new BitmapDrawable(viewBmp); bmpDrawable.setBounds(0, 0, bmpDrawable.getIntrinsicWidth(), bmpDrawable.getIntrinsicHeight()); // create and set imagespan ssb.setSpan(new ImageSpan(bmpDrawable), FPos.get(i), LPos.get(i), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); chipflag = false; } testedt.setText(ssb); // setSelection(data.length()); } For this i am storing each start and end position in Integer ArrayList , Now for example if user change any value …
has title: Android Tag Functionality Customization
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: android
answer count: 0
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39814541
has text: got the solution here, http://swordsystems.com/2011/06/29/xerces-and-xml-api-dependency-hell/
comment on: http://stackoverflow.com/a/25440863
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25494338
tagged with: java
downvote count: 0
tagged with: jar
upvote count: 1
has comment: http://stackoverflow.com/comment/39793455
has title: Maven packaging project as executuble JAR with dependencies
tagged with: packaging
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25497269
accepted answer: http://stackoverflow.com/a/25497269
has answer: http://stackoverflow.com/a/25497807
possible better answer: http://stackoverflow.com/a/25497807
tagged with: maven
has body: I'm new to Maven and having difficulties packaging my java project as a executable Jar. The program compiles and works correctly when I run it from the IDE (IntelliJ). I have the following pom.xml file: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.mathanv AlgorithmicDebugger jar 0.1 Algorithmic Debugger <jdk.version>1.6</jdk.version> net.sf.jung jung-graph-impl 2.0.1 net.sf.jung jung-visualization 2.0.1 com.sun tools 1.4.2 system ${java.home}/../lib/tools.jar org.apache.maven.plugins maven-compiler-plugin 2.3.2 ${jdk.version} ${jdk.version} org.apache.maven.plugins maven-jar-plugin 2.5 true com.mathanv.Main org.apache.maven.plugins maven-dependency-plugin 2.5.1 copy-dependencies package copy-dependencies ${project.build.directory}/dependency-jars/ The target directory looks like this: However, when I run the application from terminal I get: mathan:target Mathan$ java -jar AlgorithmicDebugger-0.1.jar Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jdi/IncompatibleThreadStateException at com.mathanv.Main.main(Main.java:15) Caused by: java.lang.ClassNotFoundException: com.sun.jdi.IncompatibleThreadStateException at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 1 more I thought it may have been the project not finding tools.jar? but it is inside the dependency folder I created.
has comment: http://stackoverflow.com/comment/39794587
tagged with: build
type: AnsweredQuestion
answer count: 2
score: 1
has comment: http://stackoverflow.com/comment/39793142

http://stackoverflow.com/q/25547825
has comment: http://stackoverflow.com/comment/39890907
has comment: http://stackoverflow.com/comment/39890688
has comment: http://stackoverflow.com/comment/40133376
score: 0
tagged with: java
has title: intellij idea ignoring MaxPermSize run parameter
has comment: http://stackoverflow.com/comment/39890650
type: Question
has comment: http://stackoverflow.com/comment/39892031
has comment: http://stackoverflow.com/comment/39890581
answer count: 0
type: UnansweredQuestion
tagged with: intellij-idea
has body: It seems something strange happening with my intllij idea. I'm trying to launch project in intellij and constantly getting java.lang.OutOfMemoryError: PermGen space regardless the value I set for -XX:MaxPermSize (tried from 256 to 4096, no effect). It seems intellij doesn't use it at all. Application get OutOfMemory exception when java process acquares approximately 700mb of memory. Just to compare: this project gets launched in eclipse and in the end it consumes about 4gb of memory. Is there a bug regarding this or I'm the only who faces this issue? Could somebody, please, point me at my mistakes? ADDITION Content of my idea64.exe.vmoptions -Xms1024m -Xmx2048m -XX:MaxPermSize=500m -XX:+UseConcMarkSweepGC -XX:ReservedCodeCacheSize=128m -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djsse.enableSNIExtension=false -XX:+UseCodeCacheFlushing -XX:+UseParallelGC -XX:+UseAdaptiveSizePolicy -XX:-UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/25406815
tags question: http://stackoverflow.com/q/25477663
tags question: http://stackoverflow.com/q/25510052
tags question: http://stackoverflow.com/q/25532169
tags question: http://stackoverflow.com/q/25548103
tags question: http://stackoverflow.com/q/25548716
tags question: http://stackoverflow.com/q/25418479
tags question: http://stackoverflow.com/q/25494851
tags question: http://stackoverflow.com/q/25411278
type: Tag
tags question: http://stackoverflow.com/q/25451153
tags question: http://stackoverflow.com/q/25492586

http://stackoverflow.com/q/25503547
has comment: http://stackoverflow.com/comment/39809830
has comment: http://stackoverflow.com/comment/39809723
has comment: http://stackoverflow.com/comment/39809974
upvote count: 2
tagged with: sockets
has comment: http://stackoverflow.com/comment/39811729
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/1195809
has title: Writing a telnet client in java - how to listen for new data?
has body: I'm attempting to implement a Telnet client in Java, which will just get data from a telnet server. I've been looking for ages now and have found a lot of things, but not particularly what I need - for example the apache commons client example, which seems to send a lot of commands, which is just confusing me to be honest. So I therefore thought it would be easier to just to write my own client which connects to the server using a socket. public class TelnetClient { private String host; public TelnetClient(String host) { this.host = host; } public void getData(){ Socket s = new Socket(); PrintWriter s_out = null; BufferedReader s_in = null; try { s.connect(new InetSocketAddress("www.google.com" , 80)); System.out.println("Connected"); //writer for socket s_out = new PrintWriter( s.getOutputStream(), true); //reader for socket s_in = new BufferedReader(new InputStreamReader(s.getInputStream())); } //Host not found catch (UnknownHostException e) { System.err.println("Don't know about host : " + host); System.exit(1); } catch (IOException e) { e.printStackTrace(); } //Send message to server String message = "GET / HTTP/1.1\r\n\r\n"; s_out.println( message ); System.out.println("Message send"); //Get response from server String response; try { while ((response = s_in.readLine()) != null) { System.out.println( response ); } } catch (IOException e) { e.printStackTrace(); } } } But I cant actually test this with the server currently so Im just using google.com, however I want to change it to listen continuously for new lines of data on the server. Basically my question is, am I going about this the wrong way - am I being naive by just using sockets to access the telnet server and am I underestimating what a telnet client/server should be, thanks for any help. Also if anyone has any good/simple examples of a telnet client, that would be very useful!!
has answer: http://stackoverflow.com/a/25505264
accepted answer: http://stackoverflow.com/a/25505264
tagged with: telnet
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39810040
linked to: http://stackoverflow.com/q/1359689
tagged with: java
tagged with: client
favorite count: 0
type: Question

http://stackoverflow.com/a/25443365
has body: I have tried with your data to get your required output by changing some code in function processString() in argument instead of passing single string I have passed whole list and process that list in that function as show in below code : private static JSONObject processString(List&lt;String&gt; list, int level,String key) throws JSONException { JSONObject json = new JSONObject(); JSONArray jsonarray = new JSONArray(); String value = ""; String remainder = ""; JSONObject obj = new JSONObject(); for(String data : list) { String name = data; int index = data.indexOf(','); name = data.substring(0, index); remainder = data.substring(name.length() + 1); String fullpath = key+"***"+name; value = fullpath; System.out.println(fullpath); json.put("name", fullpath); remainder = data.substring(index+1); int lastindex = remainder.indexOf('('); if (lastindex &gt; 0) { remainder = remainder.substring(0,lastindex); } String fullpathVal = key+"***"+remainder; obj.put("name", fullpathVal); jsonarray.put(obj); json.put("T" + level, jsonarray); } return json; } This is based on your sample data and what you required in output. May this help you.
upvote count: 1
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25440431
accepted answer of: http://stackoverflow.com/q/25440431
type: Answer
has comment: http://stackoverflow.com/comment/39698595
downvote count: 0

google-cloud-datastore
tags question: http://stackoverflow.com/q/25437341
tags question: http://stackoverflow.com/q/25446489
tags question: http://stackoverflow.com/q/25436114
tag name: google-cloud-datastore
tags question: http://stackoverflow.com/q/25481874
type: Tag
tags question: http://stackoverflow.com/q/25398118

http://stackoverflow.com/q/25519727
answer count: 1
tagged with: swing
type: Question
type: UnansweredQuestion
tagged with: jdatechooser
has title: How to get/compute total number of months using JDateChooser
has answer: http://stackoverflow.com/a/25519895
score: 0
has body: I'm new to Java How do I get the total number of months between two (2) jdatechooser? I've search already about this but the date was set to the code, In my case I want to put the dates via JDateChooser. I can do this through this code but if the year change I was not able to compute the total number of months I want to do this without using JodaTime. Here is my code public void month(){ int TotalMonth; Calendar toDate; Calendar fromDate; int increment; Date dt1 = date1.getDate(); //datechooser 1 Date dt2 = date2.getDate(); //datechooser 2 fromDate = Calendar.getInstance(); toDate = Calendar.getInstance(); if(dt1.after(dt2)) { fromDate.setTime(dt2); toDate.setTime(dt1); } else { fromDate.setTime(dt1); toDate.setTime(dt2); } increment = 0; TotalMonth = toDate.get(Calendar.MONTH) - (fromDate.get(Calendar.MONTH + increment)); jLabel2.setText(Integer.toString(age)); }
tagged with: java

http://stackoverflow.com/comment/39693881
type: AnswerComment
comment on: http://stackoverflow.com/a/25441439
has text: The OP is asking for an efficient / elegant / clear way. I think this satisfies at least two of these. Of course you can always invent your own wheel and write some shiny logic in a few lines of code, which won't necessarily _lower the brain power required for people who will maintain this_.
type: Comment
score: 1

http://stackoverflow.com/a/25414180
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25414017
downvote count: 1
has comment: http://stackoverflow.com/comment/39644426
has comment: http://stackoverflow.com/comment/39644273
has comment: http://stackoverflow.com/comment/39644335
has comment: http://stackoverflow.com/comment/39644501
answers question: http://stackoverflow.com/q/25414017
type: Answer
score: -1
has body: I suggest the following : public String[] returnArray(int num){ switch(num) case 1 : return array1; case 2 : return array2; . . . case 8 : return array8; default : return null //this shouldn't really happen but its required to return something. } public void printArray(){ for(int i=0;i&lt;p.length;i++){ System.out.print(p[i] + " " ); for(String s : returnArray(i+1)) System.out.print(s + " "); System.out.println(); } }
upvote count: 0

http://stackoverflow.com/q/25511672
has body: I have a Json request which is in the form of a String :- { "insertDataRequest": [ { "id": "98", "name": "Mercer Island", "age": "12", "designation": "SSE" } ] } Now , I need to convert this String format into Java Object and retrieve it's value using Jackson ... So far I did the following :- public static void main(String[] args) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); String json= "{\"insertDataRequest\":{\"id\":98, \"name\":\"Mercer Island\",\"age\":12,\"designation\":\"SEE\"}}"; JsonNode root2 = objectMapper.readTree(json); JsonNode rootnode = root2.get("insertDataRequest"); if (rootnode != null &amp;&amp; rootnode.has("id")) { int id = rootnode.get("id").intValue(); System.out.println(id); } if (rootnode != null &amp;&amp; rootnode.has("name")) { String name = rootnode.get("name").toString().replace("\"", ""); System.out.println(name); } if (rootnode != null &amp;&amp; rootnode.has("age")) { int age = rootnode.get("age").intValue(); System.out.println(age); } if (rootnode != null &amp;&amp; rootnode.has("designation")) { String designation = rootnode.get("designation").toString().replace("\"", ""); System.out.println(designation); } } Now .. I am not getting any value when I run the code ....How can I convert this String and retrieve the value .. Is I am missing something ??? Please help ....
answer count: 4
tagged with: parsing
has answer: http://stackoverflow.com/a/25511909
has answer: http://stackoverflow.com/a/25511920
has comment: http://stackoverflow.com/comment/39825506
possible better answer: http://stackoverflow.com/a/25513045
linked to: http://stackoverflow.com/q/16788213
upvote count: 2
has answer: http://stackoverflow.com/a/25513045
has comment: http://stackoverflow.com/comment/39825624
tagged with: jackson
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39825562
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31853250
tagged with: rest
has comment: http://stackoverflow.com/comment/39825399
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39825683
tagged with: http://stackoverflow.com/tag/json
has title: How to convert a String into object and retrieve the value using Jackson
accepted answer: http://stackoverflow.com/a/25511909

http://stackoverflow.com/q/25444221
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39701670
has title: How to check a cell in excel integer or not in apache POI
tagged with: apache-poi
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28500479
tagged with: apache
has comment: http://stackoverflow.com/comment/39702355
downvote count: 0
tagged with: excel
has body: I am using apache POI to read excel.i have a requirement that the the value in the excel should only be integer. I have done this if(cell.getCellType()==XSSFCell.CELL_TYPE_NUMERIC) but it is applicable for all numeric values. But i want to check only for integer.Plese help.I dont find any thing in this XSSFCell to check integer.
has answer: http://stackoverflow.com/a/39170497
score: 2
answer count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39701224
has answer: http://stackoverflow.com/a/67338938

http://stackoverflow.com/a/25434102
score: 5
upvote count: 5
type: Answer
has body: Hadoop uses speculative execution by default and there is no guarantee your mapper or reducer will be run only once. This is why you should disable speculative execution for reduce tasks that have side effects. It's very possible to see multiple log statements and things like that. The answer here is to use the jobtracker to verify that the map and reduce tasks completed successfully, and were run in the way you expect. Because of speculative execution, looking at log statements is not a reliable way of determining this. The other possibility is that your job is defined in such a way that the reducer is indeed being called twice, possibly incorrectly. you'd need to post the configuration of your job and a lot more detail, in order for us to be able to work out if this is in fact the case.
answers question: http://stackoverflow.com/q/25434010
downvote count: 0

http://stackoverflow.com/q/25527163
has answer: http://stackoverflow.com/a/25527285
has comment: http://stackoverflow.com/comment/39853115
score: 0
has comment: http://stackoverflow.com/comment/39853097
tagged with: android
tagged with: java
answer count: 1
has body: i have 2 Activities A and B , "A" hold a list of certain songs category , while i click on these list its start new activity "B" and load a new list of songs based on user choice , if user made another click on the list in Activity B its start to play the song. When user click on back button , its goes back to Activity "A" but the player still continue in background. My actual problem starts here , when user again clicks on other category from Activity "A" (while the song is still playing in background) it does not reloading the new category in Activity B but showing old list . How i overcome these . i need help ACTIVITY A onclick list.setOnItemClickListener(new OnItemClickListener() { @SuppressLint("NewApi") @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { String webpage = ((TextView) view.findViewById(R.id.link)) .getText().toString(); String titles = ((TextView) view.findViewById(R.id.title)) .getText().toString(); Intent intent = new Intent(A.this, B.class); intent.putExtra("webpage_key",webpage); intent.putExtra("title_key",titles); startActivity(intent); }
has comment: http://stackoverflow.com/comment/39858689
type: Question
has title: i have to refresh an activity , but these refresh is bit complicated
has comment: http://stackoverflow.com/comment/39880019
type: UnansweredQuestion

http://stackoverflow.com/comment/39821226
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25509015
score: 0
has text: I'm not quite sure how to use that in a jsp, as I keep receiving invalid syntax messages for the above.

http://stackoverflow.com/comment/39840884
has text: apply weight to edittext, textview and see
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25520297

http://stackoverflow.com/comment/39780184
type: AnswerComment
comment on: http://stackoverflow.com/a/25487646
score: 0
type: Comment
has text: I'm not sure if this is what I actually need. As per my question, I'm supposed to include header files and use some of the resources in them and link the library's binary file as I'm compiling my C application. I have a compiled version of this library, but for another platform. When I run the C application, on this platform, I obviously see Java involved as if I ran a Java application. So I assume I'm supposed to have a C library binary file somehow.

http://stackoverflow.com/comment/39725509
comment on: http://stackoverflow.com/q/25458027
type: Comment
has text: Yes, I just tested it with the software, heidsql @isim
type: QuestionComment
score: 0

http://stackoverflow.com/q/25527656
upvote count: 1
accepted answer: http://stackoverflow.com/a/25527851
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25527851
has title: HashMap display in JSP from Controller Springs
tagged with: hashmap
downvote count: 0
possible better answer: http://stackoverflow.com/a/25529072
has answer: http://stackoverflow.com/a/25529072
tagged with: spring-mvc
type: AnsweredQuestion
answer count: 2
has body: I am newbie to Springs and currently stuck at displaying HashMap Value to JSP page . All I need is to do is specify the key of hashmap to get the corresponding My page is a listing page. Here is My Controller Code that returns data succesfull @Controller public class GetUserController { @Autowired private AddUserServiceImpl aus; @RequestMapping(value="/getUser.do",method=RequestMethod.GET) public ModelAndView getUser() { HashMap&lt;String,String&gt; listMap = new HashMap&lt;String,String&gt;(); List&lt;User&gt; u = (List&lt;User&gt;) aus.getUser(); System.out.println("List Size "+u.size()); for(User ux : u) { listMap.put("userId", String.valueOf(ux.getUser_id())); listMap.put("userName", String.valueOf(ux.getUserName())); listMap.put("firstName", String.valueOf(ux.getFirstName())); listMap.put("lastName", String.valueOf(ux.getLastName())); listMap.put("email", String.valueOf(ux.getEmail())); } return new ModelAndView("listingView","listMapView",listMap); } } MY JSP is as Follows &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Insert title here&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;table align="center" style="padding-top: 30px; border: 0.5px;"&gt; &lt;tr&gt; &lt;th bgcolor="#2E64FE"&gt;USERNAME&lt;/th&gt; &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt; &lt;th bgcolor="#2E64FE"&gt;FIRSTNAME&lt;/th&gt; &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt; &lt;th bgcolor="#2E64FE"&gt;LASTNAME&lt;/th&gt; &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt; &lt;th bgcolor="#2E64FE"&gt;EMAIL&lt;/th&gt; &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;c:forEach var="listMapview" items="${listMapView.listMap}" varStatus="status"&gt; &lt;tr&gt…
tagged with: java
tagged with: jsp
score: 1

http://stackoverflow.com/comment/39684325
has text: Please update it correctly ;) byte, short, int ànd long are initalized to 0. float and double are initialized to 0.0 (there is a difference between 0 and 0.0 (for floating point types at least)). char is also a primitive and its initial value is `\u0000`.
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25434449
type: Comment

http://stackoverflow.com/comment/39676329
type: QuestionComment
has text: ++a increments a and returns the new value (2). plus a++ (a++ increments and returns the previous value (2)), plus positive 1. Simplified: 2 + 2 + (+1)
score: 0
comment on: http://stackoverflow.com/q/25431715
type: Comment

http://stackoverflow.com/comment/39711800
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25450838
type: Comment
has text: Yeah, figured that one out already. Just don't want to loop everything in my XML. I want to work on a certain element do some more stuff and then go to the next element where i have to loop them all again. Anyway, if directly selecting them is not possible I try to change my flow and work all these elements first inside the loop. Wish i had some more control over the XML file, it's a nightmare :).

http://stackoverflow.com/a/25478677
type: AcceptedAnswer
type: Answer
score: 0
has body: tmp = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(prev) This creates a shallow copy, which is a new top-level ArrayList that contains the same references as the original. The members of tmp are references to the exact same objects that are still in prev. You need to make a deep copy of the entire structure, which is what you accomplished with your edit. Note that the Integer objects are immutable. Thus it's OK to refer to them from multiple places, so they don't need to be duplicated.
accepted answer of: http://stackoverflow.com/q/25477745
answers question: http://stackoverflow.com/q/25477745

http://stackoverflow.com/comment/39890818
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25547819
has text: This is up to you. You're asking about your application specific code. My answer does exactly what you asked for. We do not know what is "POST" or "return"

http://stackoverflow.com/comment/39893726
type: Comment
has text: Sounds ideal. Did you follow some tutorials or did you just teach yourself?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25547762

http://stackoverflow.com/q/25433177
tagged with: datatables
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39679100
score: 0
has comment: http://stackoverflow.com/comment/39680904
has answer: http://stackoverflow.com/a/25493248
has comment: http://stackoverflow.com/comment/39683055
accepted answer: http://stackoverflow.com/a/25493248
answer count: 1
tagged with: jquery
type: Question
has comment: http://stackoverflow.com/comment/39678913
has body: I have a tabbed data table and I'd like to add the selection of 'All' to my menu length. I have 10, 25, 50, 75 which all work fine, but the 'All' option returns "Showing 1 to 0 of 100 entries"... In firebug I can see for the selection 'All' aaData is empty. Am I missing a specific parameter? Thanks. JS: `$('#datatable').dataTable({ "aaSorting": 0, 'asc', "sDom": '<"H"lr>t<"F"ip>', // Specifies where to inject controls "bJQueryUI": true, "bAutoWidth": false, "sPaginationType": "full_numbers", "bProcessing": true, "bStateSave": true, "iDisplayLength": 10, "aLengthMenu": [[10, 25, 50, 75, -1], [10, 25, 50, 75, "All"]], "bLengthChange": true, "bPaginate": true, "bServerSide": true, "sAjaxSource": 'datatable.json', "aoColumnDefs": [ { "fnRender": function(oObj, sVal) { return 'Edit'; }, "bSortable": false, "aTargets": [2] } ], /* The following lines are used to send extra data to the server */ "fnServerData": function(sSource, aoData, fnCallback) { $.getJSON(sSource, aoData, function(json) { fnCallback(json); }); } }).columnFilter({aoColumns: [{type: "text"}, {type: "text"}]});` JSON: @RequestMapping(value = "datatable.json", method = RequestMethod.GET) @ResponseBody public Page getDataTablePage( @RequestParam int sEcho, @RequestParam int iColumns, @RequestParam int iSortCol_0, @RequestParam String sSortDir_0, @RequestParam String sSearch_0, @RequestParam String sSearch_1, @RequestParam int iDisplayStart, @RequestParam int iDisplayLength) { logger.info("Inside " + ((StackTraceElement[]) Thread.currentThread().getStackTrace())[1]); Integer total = service.getCount(); Integer totalMatching = service.getCountBySearch(sSearch_0, sSearch_1); List<Data> rowData = service.getPage(iDisplayStart, iDisplayLength, iSortCol_0, sSortDir_0, sSearch_0, sSearch_1); Page p = new Page(); p.setsEcho(sEcho); p.setiTotalRecords(total); p.setiTotalDisplayRecords(totalMatching); // Convert list of unordered hashmaps into 2D array for DataTables String[][] pageData = new String[rowData.size…
has comment: http://stackoverflow.com/comment/39679604
has comment: http://stackoverflow.com/comment/39682687
has title: Data table 'All' selection, "Showing 1 to 0 of 100 entries"
tagged with: java

http://stackoverflow.com/comment/39872852
score: 0
has text: do you have getter and setter for id in your entity?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25536418

http://stackoverflow.com/q/25523036
has comment: http://stackoverflow.com/comment/39847340
has answer: http://stackoverflow.com/a/25530346
has comment: http://stackoverflow.com/comment/39846550
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39845843
tagged with: swing
has comment: http://stackoverflow.com/comment/39851511
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/39857310
has body: Here is my code: Object[][] refreshCartonCodesToTable = dbutils.checker.CartonCodesToTable(); String[] colnames = new String[6]; colnames[0] = selectCodes.invoiceTable.getColumnName(0).toString(); colnames[1] = selectCodes.invoiceTable.getColumnName(1).toString(); colnames[2] = selectCodes.invoiceTable.getColumnName(2).toString(); colnames[3] = selectCodes.invoiceTable.getColumnName(3).toString(); colnames[4] = selectCodes.invoiceTable.getColumnName(4).toString(); colnames[5] = selectCodes.invoiceTable.getColumnName(5).toString(); MyTableModel mod = new MyTableModel(refreshCartonCodesToTable, colnames); selectCodes.invoiceTable = new JTable(mod); selectCodes.invoiceTable.setVisible(true); Custom model as shown below: class MyTableModel extends DefaultTableModel { public MyTableModel(Object data[][], Object columnames[]) { super(data, columnames); } public Class getColumnClass(int col) { if (col == 5) { return Boolean.class; } else { return String.class; } } @Override public boolean isCellEditable(int row, int col) { if (col == 0) //first column will be uneditable { return false; } else { return true; } } } The table displays the columnames but the data is not diplayed. The array has data and the sample output is as shown below: 250VV 250VV0575W20140819 false B1 19 August 2014 250VV 250VV0561W20140819 false B1 19 August 2014 250VV 250VV0560W20140819 false B1 19 August 2014 250VV 250VV0559W20140819 false B1 19 August 2014 250VV 250VV0558W20140819 false B1 19 August 2014 There are six columns. The sixth column I want to place a checkbox in the cells. Can somebody help me please. Here is the source code for CartonCodesToTable(); public static Object[][] CartonCodesToTable() { Object[][] array = null; try { dbutils.checker.connect_to_db_again_again(); sqlcommand = "SELECT Product_ID, carton_code, scanned, batchno,date FROM carton_codes where scanned ='false' order by bno asc"; rset = stmts.executeQuery(sqlcommand); int row = 0; while (rset.next()) { rset.last(); row = rs…
has comment: http://stackoverflow.com/comment/39849213
has comment: http://stackoverflow.com/comment/39849391
has comment: http://stackoverflow.com/comment/39847260
tagged with: java
has title: I cant view data in JTable From a custom table model
answer count: 1
has comment: http://stackoverflow.com/comment/39847346
has comment: http://stackoverflow.com/comment/39852051
has comment: http://stackoverflow.com/comment/39845765
linked to: http://stackoverflow.com/q/17225988
type: Question

http://stackoverflow.com/a/25529796
answers question: http://stackoverflow.com/q/25511847
score: 0
has body: It turned out that the problem was in debugger. If I do this in debug mode, it takes code 2-5 seconds to be executed. But if I do the same thing without debugger and log execution time, it is executed within 0,1-0,8 milliseconds - fast enough.
type: Answer

http://stackoverflow.com/a/25454093
accepted answer of: http://stackoverflow.com/q/25453794
has body: You should download Driver from HERE and JAR file need to add to project class path. First Right click on you Eclipse Project, Project --> Build Path --> Configure Build Path. Under Libraries tab, click Add Jars or "Add External JARs" and add downloaded jar Not 100% sure but looks like you are using wrong port number 80. Make sure your MySQL port number is current by below statement SHOW VARIABLES WHERE Variable_name = 'port';
has comment: http://stackoverflow.com/comment/39717990
type: Answer
answers question: http://stackoverflow.com/q/25453794
score: 0
has comment: http://stackoverflow.com/comment/39718781
upvote count: 1
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/39718018
has comment: http://stackoverflow.com/comment/39717956

http://stackoverflow.com/comment/39708935
comment on: http://stackoverflow.com/q/25449155
score: 0
type: QuestionComment
has text: just a hint - make your own classloader
type: Comment

http://stackoverflow.com/comment/39716146
type: QuestionComment
has text: yes it is just a declaration @Misho Metreveli
comment on: http://stackoverflow.com/q/25453218
type: Comment
score: 0

http://stackoverflow.com/comment/39697608
score: 0
has text: Where do you get the time values from anyway? Do you read them out of a log or a database? Or are they from somewhere in your program? If it's possible for you to use a time stamp or a _full_ `Date` object instead, it would give you much greater precision.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25443258

http://stackoverflow.com/a/25484792
answers question: http://stackoverflow.com/q/25480014
downvote count: 0
has body: I recommend you the Datastax cassandra driver. You can do an update like: Statement statement = QueryBuilder.update("simplex", "songs") .with(set("artist", "Vasili Ostertag")) .where(eq("id", UUID.fromString("f6071e72-48ec-4fcb-bf3e-379c8a696488"))); getSession().execute(statement);
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/39767792
type: QuestionComment
has text: remove r.report_comment LIKE '%事務%' execute is working well. I don't know why.
comment on: http://stackoverflow.com/q/25480529
score: 0
type: Comment

avro
type: Tag
tag name: avro
tags question: http://stackoverflow.com/q/25527760

http://stackoverflow.com/comment/39814189
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25484603
type: AnswerComment
has text: I thought, the container will OOB use the classloader to load resources. But apparently from your explaination, this isn't so. Then does it just try to look for relative path of that resource in the web archive? And as for classloader, to use it, one will have to explicitly invoke it via a servlet/filter/etc.

http://stackoverflow.com/a/25466539
answers question: http://stackoverflow.com/q/25466455
score: 2
upvote count: 2
has body: I won't tell you to use a faster algorithm, you'll probably have a lot of other (better explained) suggestions for that. I'll stick with optimizing your inner for loop: you can stop your inner for loop as soon as you know i isn't a prime boolean isPrime = true; for (j = 2; j &lt; i; j++) { if (i % j == 0) { isPrime = false; break; } } if (isPrime) as.println(i + " ");
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39779606
type: Comment
has text: Alright, i solve it, thx. And comparing to tree set with arraylist, which one is the recommended way to store a collection of data?
type: AnswerComment
comment on: http://stackoverflow.com/a/25485813
score: 0

http://stackoverflow.com/comment/39844985
comment on: http://stackoverflow.com/a/25521454
has text: So would it be right to do something like this System.out.print(symbol + " ")
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39728411
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25459525
has text: `Http Status 500` exception occurred.

http://stackoverflow.com/q/25507200
score: -3
has comment: http://stackoverflow.com/comment/39816902
has comment: http://stackoverflow.com/comment/39817150
has comment: http://stackoverflow.com/comment/39816770
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39816774
has comment: http://stackoverflow.com/comment/39817866
has comment: http://stackoverflow.com/comment/39817279
has body: Let me rephrase my question.I'm searching in file for some keyword.When i fond it,i need to print some lines preceding this keyword including it. I want to print range of lines start with some keyword line1 line2 someword line4 line5 After i find this keyword i need to print line1 line2 and this keyword. Any idea?
tagged with: java
has comment: http://stackoverflow.com/comment/39826566
downvote count: 3
has answer: http://stackoverflow.com/a/25509893
has comment: http://stackoverflow.com/comment/39816838
possible better answer: http://stackoverflow.com/a/25509893
has comment: http://stackoverflow.com/comment/39817782
favorite count: 0
has answer: http://stackoverflow.com/a/25507441
type: Question
accepted answer: http://stackoverflow.com/a/25507441
answer count: 2
has comment: http://stackoverflow.com/comment/39816856
upvote count: 0
has title: How to print range of lines after keyword Java
has comment: http://stackoverflow.com/comment/39824684

http://stackoverflow.com/q/25413023
has body: help me, please. When I start a Perform Maven Release erro below appears: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.2.2:prepare (default-cli) on project JavaWeb: Cannot prepare the release because you have local modifications : [ERROR] [${project.basedir}:unknown] [ERROR] -> [Help 1] My tags directory in SVN is empty. Pom.xml: org.apache.maven.plugins maven-release-plugin 2.2.2 https://server01.com/svn/JavaWeb/tags/ ${project.artifactId}-${maven.build.timestamp} clean install package -DskipTests=false <providerImplementations> javasvn </providerImplementations> <checkModificationExcludes> <checkModificationExclude>${project.build.directory}</checkModificationExclude> </checkModificationExcludes> com.google.code.maven-scm-provider-svnjava maven-scm-provider-svnjava 2.0.4 What's means that error? Is a problem in my repository? Thanks.
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39669102
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25413045
type: UnansweredQuestion
tagged with: maven
has title: Maven build release ${project.basedir}:unknown
has comment: http://stackoverflow.com/comment/39642749

http://stackoverflow.com/comment/39691908
comment on: http://stackoverflow.com/a/25440121
score: 0
type: AnswerComment
has text: thanks for the answer. Is it possible to run the doNETCFG() on my code in a fragment? I've put this code on my ToolsFragment.java and set this String to one of my textviews.
type: Comment

http://stackoverflow.com/comment/39752714
comment on: http://stackoverflow.com/q/25472584
has text: @MarkoTopolnik ok ignore the essay below the code just want to know any library available to find the program flow from the main class that is the bottom line
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39691181
comment on: http://stackoverflow.com/a/25439912
type: AnswerComment
score: 6
has text: Mind. blown. . . . all. over. the. floor.
type: Comment

ssl
tags question: http://stackoverflow.com/q/25503573
tags question: http://stackoverflow.com/q/25509825
tags question: http://stackoverflow.com/q/25516778
tags question: http://stackoverflow.com/q/25543627
tags question: http://stackoverflow.com/q/25495368
tags question: http://stackoverflow.com/q/25547976
tags question: http://stackoverflow.com/q/25488203
type: Tag
tags question: http://stackoverflow.com/q/25507177
tags question: http://stackoverflow.com/q/25491241
tags question: http://stackoverflow.com/q/25522542
tags question: http://stackoverflow.com/q/25521221
tags question: http://stackoverflow.com/q/25426933
tags question: http://stackoverflow.com/q/25527255
tag name: ssl
tags question: http://stackoverflow.com/q/25402162
tags question: http://stackoverflow.com/q/25457988

http://stackoverflow.com/comment/89958793
has text: @Marc: Yes, changes applied now
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/41534207
type: Comment

http://stackoverflow.com/a/25462145
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25462002
answers question: http://stackoverflow.com/q/25462002
type: Answer
has comment: http://stackoverflow.com/comment/39738346
has body: Not anymore: there used to be a Files API, but it's now deprecated. You should use Google Cloud Storage instead, which has all features of blobstore and also has Client Library allowing you to programmatically store data.
has comment: http://stackoverflow.com/comment/39741721
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25927115
type: Answer
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25399909
has body: I suspect you will need to refactor your JPQL statement to use subquery 'EXISTS' as the IN statement doesn't support a sub select. Hopefully this will point you in the right direction. SELECT oo FROM OperationalObjective oo WHERE NOT EXISTS ( SELECT oosub FROM OperationalObjective oosub JOIN oosub.goal g JOIN g.policy p WHERE &lt;&lt;where conditions&gt;&gt; ) Oracle docs

http://stackoverflow.com/q/25465590
accepted answer: http://stackoverflow.com/a/25465723
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25465723
answer count: 3
has title: Java - List, types, and Inheritance (maybe generic?)
has answer: http://stackoverflow.com/a/25465748
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25465737
has comment: http://stackoverflow.com/comment/39739210
tagged with: generics
has comment: http://stackoverflow.com/comment/39739308
favorite count: 0
has comment: http://stackoverflow.com/comment/39739227
tagged with: list
possible better answer: http://stackoverflow.com/a/25465737
has comment: http://stackoverflow.com/comment/39739221
tagged with: types
downvote count: 0
has comment: http://stackoverflow.com/comment/39739329
upvote count: 1
tagged with: inheritance
has body: Lets say I have a class of type Color. I want to create some child classes, Red, Green, and Blue. Then, in a completely separate class I have a List called Rainbow of type Color. I want to be able to place all types of colors (Red, Greed, Blue) into the list Rainbow that way later I can search the list Rainbow by a type of color to see if it contains one of those colors. Here is some pseudocode of what I'm wanting to accomplish: class Color(){} class Red extends Color(){} class Blue extends Color(){} class Green extends Color(){} class JustSomeClass(){ List&lt;Color&gt; Rainbow; Rainbow.add(new Red()); Rainbow.add(new Blue()); Rainbow.add(new Green()); public Color getTypeOfColor(typeOfColor){ for(Color c : Rainbow){ if(c.getType().equals(typeOfColor)){ return c; } } } } I'm not that familiar enough with Java to know a good way to go about accomplishing this. Can someone point me in the right direction?

http://stackoverflow.com/comment/53442475
comment on: http://stackoverflow.com/q/25496503
type: Comment
type: QuestionComment
score: 0
has text: looks like ill be coming back to this example to show a thorough answer :)

http://stackoverflow.com/a/28018302
has body: The problem is solved if you will close the open FDs in the code.
type: Answer
answers question: http://stackoverflow.com/q/25502114
score: 0

eclipse
tags question: http://stackoverflow.com/q/25543885
tags question: http://stackoverflow.com/q/25541391
tags question: http://stackoverflow.com/q/25462354
tags question: http://stackoverflow.com/q/25522498
tags question: http://stackoverflow.com/q/25446660
tags question: http://stackoverflow.com/q/25404420
tags question: http://stackoverflow.com/q/25402188
tags question: http://stackoverflow.com/q/25509871
tags question: http://stackoverflow.com/q/25493529
tags question: http://stackoverflow.com/q/25545149
tag name: eclipse
tags question: http://stackoverflow.com/q/25416528
tags question: http://stackoverflow.com/q/25450755
tags question: http://stackoverflow.com/q/25435247
tags question: http://stackoverflow.com/q/25412960
tags question: http://stackoverflow.com/q/25436753
tags question: http://stackoverflow.com/q/25527412
tags question: http://stackoverflow.com/q/25473326
tags question: http://stackoverflow.com/q/25550692
tags question: http://stackoverflow.com/q/25410541
tags question: http://stackoverflow.com/q/25398221
tags question: http://stackoverflow.com/q/25509962
tags question: http://stackoverflow.com/q/25512696
tags question: http://stackoverflow.com/q/25411904
tags question: http://stackoverflow.com/q/25527420
tags question: http://stackoverflow.com/q/25531920
tags question: http://stackoverflow.com/q/25509488
tags question: http://stackoverflow.com/q/25447487
tags question: http://stackoverflow.com/q/25474223
tags question: http://stackoverflow.com/q/25471945
tags question: http://stackoverflow.com/q/25544979
tags question: http://stackoverflow.com/q/25450071
tags question: http://stackoverflow.com/q/25543864
tags question: http://stackoverflow.com/q/25462995
tags question: http://stackoverflow.com/q/25518842
tags question: http://stackoverflow.com/q/25464992
tags question: http://stackoverflow.com/q/25518033
tags question: http://stackoverflow.com/q/25399235
tags question: http://stackoverflow.com/q/25444923
tags question: http://stackoverflow.com/q/25421573
tags question: http://stackoverflow.com/q/25480309
tags question: http://stackoverflow.com/q/25522643
tags question: http://stackoverflow.com/q/25483883
tags question: http://stackoverflow.com/q/25486800
tags question: http://stackoverflow.com/q/25529253
tags question: http://stackoverflow.com/q/25461741
tags question: http://stackoverflow.com/q/25422214
tags question: http://stackoverflow.com/q/25392781
tags question: http://stackoverflow.com/q/25478043
tags question: http://stackoverflow.com/q/25437239
tags question: http://stackoverflow.com/q/25503939
tags question: http://stackoverflow.com/q/25439022
tags question: http://stackoverflow.com/q/25533176
tags question: http://stackoverflow.com/q/25414311
tags question: http://stackoverflow.com/q/25462015
tags question: http://stackoverflow.com/q/25423642
tags question: http://stackoverflow.com/q/25447652
tags question: http://stackoverflow.com/q/25455532
tags question: http://stackoverflow.com/q/25448226
tags question: http://stackoverflow.com/q/25447590
tags question: http://stackoverflow.com/q/25528837
tags question: http://stackoverflow.com/q/25422595
tags question: http://stackoverflow.com/q/25419131
tags question: http://stackoverflow.com/q/25521877
tags question: http://stackoverflow.com/q/25508735
tags question: http://stackoverflow.com/q/25539648
tags question: http://stackoverflow.com/q/25453502
tags question: http://stackoverflow.com/q/25549683
tags question: http://stackoverflow.com/q/25497203
tags question: http://stackoverflow.com/q/25419891
tags question: http://stackoverflow.com/q/25415458
tags question: http://stackoverflow.com/q/25486349
tags question: http://stackoverflow.com/q/25436422
tags question: http://stackoverflow.com/q/25480801
tags question: http://stackoverflow.com/q/25394609
tags question: http://stackoverflow.com/q/25545250
tags question: http://stackoverflow.com/q/25514373
tags question: http://stackoverflow.com/q/25545861
tags question: http://stackoverflow.com/q/25456694
tags question: http://stackoverflow.com/q/25407033

http://stackoverflow.com/q/25471903
has title: Why do I get a NullPointerException while autowiring an interface that extends MongoRepository?
has answer: http://stackoverflow.com/a/25472310
duplicate of: http://stackoverflow.com/q/19896870
tagged with: spring-data-mongodb
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
answer count: 2
score: 1
possible better answer: http://stackoverflow.com/a/25471949
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25471949
upvote count: 1
linked to: http://stackoverflow.com/q/19896870
accepted answer: http://stackoverflow.com/a/25472310
has body: I'm trying to write an access layer class that gets data from MongoDB using Spring Data, but I have the following problem: I have the following interface: public interface BlogDataRepository extends MongoRepository&lt;Article, String&gt; { public Article findArticleByName(String name); } and the access layer class: @EnableAutoConfiguration public class BlogDataAccessLayer { @Autowired private BlogDataRepository dataRepository; ... } And finally a main class: @EnableAutoConfiguration public class Test implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(Test.class, args); } public void run(String... args) throws Exception { BlogDataAccessLayer layer = new BlogDataAccessLayer(); Article article = new Article("test", "first article"); layer.addArticle(article); } } Each time I'm trying to run the app I get a NullPointerExeption from dataRepository located in BlogDataAccessLayer. I don't understand why dataRepository is not autowired. If I move dataRepository in Test it works. Can somebody explain why I get this behavior?
favorite count: 0
type: Question

http://stackoverflow.com/comment/39681301
has text: @Jens that is the only error message in the trace. The rest is just INFO
type: QuestionComment
comment on: http://stackoverflow.com/q/25432810
score: 0
type: Comment

http://stackoverflow.com/q/25483489
type: Question
answer count: 2
has body: I have a problem. I want to convert the string to a xml document. But this code is throw exception: Exception in thread "main" java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl cannot be cast to org.jdom2.Document at ru.unicus.osp.Test.main(Test.java:17) import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.jdom2.Document; import org.xml.sax.InputSource; public class Test { public static void main(String[] args) throws Exception { DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader("&lt;root&gt;&lt;node1&gt;&lt;/node1&gt;&lt;/root&gt;")); Document doc = (Document) db.parse(is); } } Got any ideas?
tagged with: jdom
downvote count: 0
accepted answer: http://stackoverflow.com/a/25485910
has title: Parse String to XML Document jdom2
possible better answer: http://stackoverflow.com/a/25485728
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39772071
has answer: http://stackoverflow.com/a/25485910
score: 3
has answer: http://stackoverflow.com/a/25485728
upvote count: 3
tagged with: java
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/39918664
comment on: http://stackoverflow.com/q/25502222
type: Comment
score: 0
type: QuestionComment
has text: Can you include a log file from WinSCP for a working session?

http://stackoverflow.com/a/26012795
type: Answer
has body: Provided your REST APIs are only called by the web application which is deployed together with them (in a single war and therefore sharing the same HTTP session) you can use Spring SAML + Spring Security to secure them. Spring SAML will be used to authenticate the users against a remote IDP and populate their entitlements (granted authorities); Spring Security can then be used to define security policies for the APIs called from the UI. In case you want to be able to call the REST APIs from remote clients, you may want to look into the Spring Security OAuth project - as this is no longer about web single sign-on. It is possible to create a central installation of Spring SAML which handles all SSO logic. Of course you will need to implement a mechanism in which Spring SAML relays information about the authenticated user and her attributes to your other applications, and do so in a secure way. One possible way to approach it (provided the applications are deployed on the same domain and therefore can share cookies) is to: after authentication in Spring SAML set a shared cookie which is visible to all the other applications and which is e.g. signed by the Spring SAML's key, or encrypted using a shared key, the cookie should also contain user's attributes this can be done in a custom AuthenticationSuccessHandler which is subsequently expected to redirect user to the correct application (e.g. based on some custom logic or relay state) the target application needs to verify the cookie (by checking the signature or decrypting using a shared key, possibly performing other checks), parse the attributes and start own session which is pre-authenticated based on the content of the cookie All of this can be done with implementations to standard interfaces of Spring Security and Spring SAML. But it's not a trivial task - mainly considering that any security vulnerability in your implementation might compromise security of your applications.
answers question: http://stackoverflow.com/q/25527932
downvote count: 0
score: 9
upvote count: 9
accepted answer of: http://stackoverflow.com/q/25527932
type: AcceptedAnswer

http://stackoverflow.com/comment/39757072
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25474992
has text: I've tried already but I can't access the attribute "2014-08-24": in forecasts because it is variable
type: Comment

http://stackoverflow.com/q/25529874
has body: I have a table which can have elements added to it and I need to be able to locate specific rows of the table for Selenium automation testing. I don't care about the first two rows -- just the ones that have class names starting with 'something'. I tried these as locators to pick the first table row that has a class name starting with 'something'. Selenium throws exceptions trying to interact with these elements. What am I doing wrong.... div.elements table.table tbody tr.something:nth-child(1) div.elements table.table tbody tr.something:nth-of-type(1) Here is are the methods I'm having difficulty with. So basically, it is a data entry form. If you want to add another entry, you click a button, a new row appears. The method returns the row number of the new entry, so that further interaction with the new row can occur. private static final String somethingEntryRowCss = "div.scrolling-table table.table tbody tr.hostname"; public final int clickAddSomethingButton() { int count = countEntries() + 1; addSomethingButton.click(); ComponentLoader.waitForElementVisible(driver, By.cssSelector(somethingEntryRowCss + ":nth-child(" + count +")")); return count; } Here is the ComponentLoader.waitForElementVisible(driver, By) method that checks to see if the new row is visible after clicking the button. It is timing out while waiting for the element to be visible: public static final WebElement waitForElementVisible(final WebDriver driver, final By locator) { try { Wait<WebDriver> wait = setWait(driver); wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); break; } catch(NoSuchElementException nsee) { logger.trace("NoSuchElementException. Element is not visible.); } catch(TimeoutException toe) { logger.trace("TimeoutException. Element is not visible.); } return driver.findElement(locator); }
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39862948
has comment: http://stackoverflow.com/comment/39867066
type: Question
has comment: http://stackoverflow.com/comment/39866114
type: UnansweredQuestion
has title: CSS selector for locating specific row in a table: Confused about nth-type/nth-child
has answer: http://stackoverflow.com/a/25531164
tagged with: selenium-webdriver
score: 0
tagged with: css-selectors

http://stackoverflow.com/q/25469863
has comment: http://stackoverflow.com/comment/39786491
linked to: http://stackoverflow.com/q/8503086
has body: I am passing an arraylist from Java to Xsl using transformer.setParameter. ArrayList books=new ArrayList&lt;String&gt;; transformer.setparameter("booksinXSL","books"); Now I need to access this array's elements in XSL. &lt;xsl:param name="booksinXSL"&gt; Now If I use this line of code in XSL it throws an error:Invalid conversion of ArrayList to NodeSet. &lt;value-of select="$booksinXSL[0]"&gt; but if I set it as the below line it prints the entire array [book1,book2] without any error &lt;value-of select="$booksinXSL"&gt;
has comment: http://stackoverflow.com/comment/39752031
tagged with: xslt
score: 3
has answer: http://stackoverflow.com/a/25470001
upvote count: 3
tagged with: java
answer count: 1
favorite count: 0
type: Question
has title: How to pass an arraylist from Java to xsl and access this individual arraylist elements in XSL?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39789808
has comment: http://stackoverflow.com/comment/39791271
downvote count: 0

http://stackoverflow.com/a/25412988
downvote count: 0
score: 1
upvote count: 1
has body: This question has little to do with Java in fact. It's about knowledge representation models. I can think of ontologies in particular which have much to do with DAGs (directed acyclic graphs). And yes, an "is a" relationship is transitive, so the answer to your question is also "yes". You can Google any of the concepts (from my answer) which you're not familiar with.
has comment: http://stackoverflow.com/comment/39642162
has comment: http://stackoverflow.com/comment/39641979
type: Answer
answers question: http://stackoverflow.com/q/25412903

http://stackoverflow.com/comment/39807153
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25502203
has text: What is the value of `folderPath` in runtime?
type: Comment

http://stackoverflow.com/comment/39868652
has text: Omit that `Graphics g = getGraphics();` and add a `super.paintComponent(g)` instead. (Apart from that, the method may be `protected` and should have an `@Override` annotation.)
type: AnswerComment
comment on: http://stackoverflow.com/a/25532282
score: 0
type: Comment

http://stackoverflow.com/q/25475210
type: AnsweredQuestion
has body: The Hibernate documentation, says that: Hibernate makes identifier properties optional. There are a range of reasons why you should use them. We recommend that identifiers be 'synthetic', that is, generated with no business meaning. As it says the identifier is optional I tried to create an entity without @Id annotation to any of the fields. Then I got an exception as: Initial SessionFactory creation failed.org.hibernate.AnnotationException: No identifier specified for entity: org.hibernate.tutorials.User Then what it means that Hibernate makes identifier properties optional. Can someone please explain?
score: 1
tagged with: java
tagged with: hibernate
has title: How can we tell Hibernate to make identifier properties as optional
accepted answer: http://stackoverflow.com/a/25476546
linked to: http://stackoverflow.com/q/9314453
has comment: http://stackoverflow.com/comment/39757098
type: Question
has answer: http://stackoverflow.com/a/25476546
answer count: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39757140
has comment: http://stackoverflow.com/comment/39761265
favorite count: 0

http://stackoverflow.com/q/25526216
tagged with: java
possible better answer: http://stackoverflow.com/a/25526810
tagged with: grails
tagged with: import
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25526810
answer count: 2
upvote count: 2
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25526789
has body: i´m using grails and i want to use the http builder http://groovy.codehaus.org/modules/http-builder/doc/ when i follow the examples like : import groovyx.net.http.HTTPBuilder or sth. i found here on SO @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0-RC2' ) it throws an error : unable to resolve class groovyx.net.http.HTTPBuilder what am i doing wrong ? what can i do to make it work ? Please note that i want to use the groovy http builder and not some magic grails-rest plugin thanks for any Help!
tagged with: groovy
has answer: http://stackoverflow.com/a/25526789
has title: Grails import groovy http builder

http://stackoverflow.com/q/25436156
tagged with: java
has answer: http://stackoverflow.com/a/25436240
accepted answer: http://stackoverflow.com/a/25436240
tagged with: eclipse
has body: What I think happened is that logcat is listening for a different emulator that I already closed. How/can I tell logcat the number of the emulator that it is supposed to be displaying errors for?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25436434
possible better answer: http://stackoverflow.com/a/25436434
has title: Android Eclipse set logcat to receive input from emulator
tagged with: emulation
tagged with: logcat
type: AnsweredQuestion
score: 0
tagged with: android

http://stackoverflow.com/comment/47118176
has text: yeah thanks it was that, i found that was the problem too and posted and answer in Aug 27 of 2014, but my answer didn't have the quality standards and it was deleted. but thanks anyway friend.
type: Comment
comment on: http://stackoverflow.com/a/29477686
type: AnswerComment
score: 1

http://stackoverflow.com/q/25416114
score: 2
tagged with: java
has title: How to read in a RCFile
tagged with: mapreduce
favorite count: 0
type: Question
tagged with: hadoop
answer count: 2
upvote count: 2
has answer: http://stackoverflow.com/a/31488652
downvote count: 0
has body: I am trying to read in a small RCFile (~200 rows of data) into a HashMap to do a Map-Side join, but I having a lot of trouble getting the data in the file into a usable state. Here is what I have so far, most of which is lifted from this example: public void configure(JobConf job) { try { FileSystem fs = FileSystem.get(job); RCFile.Reader rcFileReader = new RCFile.Reader(fs, new Path("/path/to/file"), job); int counter = 1; while (rcFileReader.next(new LongWritable(counter))) { System.out.println("Fetching data for row " + counter); BytesRefArrayWritable dataRead = new BytesRefArrayWritable(); rcFileReader.getCurrentRow(dataRead); System.out.println("dataRead: " + dataRead + " dataRead.size(): " + dataRead.size()); for (int i = 0; i &lt; dataRead.size(); i++) { BytesRefWritable bytesRefRead = dataRead.get(i); byte b1[] = bytesRefRead.getData(); Text returnData = new Text(b1); System.out.println("READ-DATA = " + returnData.toString()); } counter++; } } catch (IOException e) { throw new Error(e); } } However, the output that I am getting has all of the data in each column concatenated together in the first row and no data in any of the other rows. Fetching data for row 1 dataRead: org.apache.hadoop.hive.serde2.columnar.BytesRefArrayWritable@7f26d3df dataRead.size(): 5 READ-DATA = 191606656066860670 READ-DATA = United StatesAmerican SamoaGuamNorthern Mariana Islands READ-DATA = USASGUMP READ-DATA = USSouth PacificSouth PacificSouth Pacific READ-DATA = 19888 Fetching data for row 2 dataRead: org.apache.hadoop.hive.serde2.columnar.BytesRefArrayWritable@1cb1a4e2 dataRead.size(): 0 Fetching data for row 3 dataRead: org.apache.hadoop.hive.serde2.columnar.BytesRefArrayWritable@52c00025 dataRead.size(): 0 Fetching data for row 4 dataRead: org.apache.hadoop.hive.serde2.columnar.BytesRefArrayWritable@3b49a794 dataRead.size(): 0 How do I read in this data properly so that I have access to one row at a time e.g (191, United States, US, US, 19)?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25436169
possible better answer: http://stackoverflow.com/a/31488652
has answer: http://stackoverflow.com/a/25436169

http://stackoverflow.com/q/25529510
has title: PHP equivalent of getBytes in Java
tagged with: php
has body: I have the below Java code: String Str1 = new String("Welcome to Tutorialspoint.com"); System.out.println(Str1.toString().getBytes("UTF-8")); The output on a 64-bit Windows 7 machine is: "[B@7041825e". What would be the above code's PHP equivalent?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39858221
has answer: http://stackoverflow.com/a/25529584
answer count: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/25529665
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25529584
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39858624
linked to: http://stackoverflow.com/q/885597
has answer: http://stackoverflow.com/a/25529665

http://stackoverflow.com/q/25480327
type: Question
has title: link button print wrongly because of beanclass tag
has comment: http://stackoverflow.com/comment/39772797
has answer: http://stackoverflow.com/a/25482201
accepted answer: http://stackoverflow.com/a/25482201
tagged with: jsp
type: AnsweredQuestion
score: 0
tagged with: printing
tagged with: java
tagged with: prefix
answer count: 1
has body: Good day, The following is my jsp code: &lt;sx:row key="com.ui.batchRefNo"&gt; &lt;s:link beanclass="com.ui.Batches" event="detail" addSourcePage="true"&gt; ${paymentHistory.batchRefNo } &lt;/s:link&gt; &lt;/sx:row&gt; &lt;sx:input name="print" image="buttons.print" cssClass="btn-primary" onclick="framePrint('mainFrame');return false" simple="true"/&gt; The following is my output after I click on print button: Suppose it should only display File Batch Ref No 20140814AP007, the rest of word inside the bracket is because of beanClass. I already try make a division with style="display:none;" and put the link inside this division, but still same out put. Kindly advise.

http://stackoverflow.com/q/25433586
has body: I knew that in Java class instances are passed by references. I was trying to swap two class instances but it didn't worked. What I don't understand if they are passed through references then the code should have worked. What am I missing here? public class Swapper { public static void main(String[] args) { NormalClass na = new NormalClass(1235); NormalClass nb = new NormalClass(5468); System.out.println("Before: 1st Object --&gt;"); na.print_obj(); System.out.println("Before: 2nd Object --&gt;"); nb.print_obj(); NormalClass.swap(na,nb); System.out.println("After: 1st Object --&gt;"); na.print_obj(); System.out.println("After: 2nd Object --&gt;"); nb.print_obj(); } } class NormalClass{ public int _ID; public static void swap(NormalClass a, NormalClass b){ NormalClass temp; temp = a; a = b; b = temp; } public void print_obj(){ System.out.println(this._ID); } NormalClass(int __id){ this._ID = __id; } }
has comment: http://stackoverflow.com/comment/39680120
has answer: http://stackoverflow.com/a/25433633
possible better answer: http://stackoverflow.com/a/25433633
has comment: http://stackoverflow.com/comment/39679716
tagged with: instance
answer count: 2
upvote count: 2
has title: Swapping variables in Java using a method
downvote count: 0
linked to: http://stackoverflow.com/q/40480
tagged with: swap
tagged with: pass-by-reference
has comment: http://stackoverflow.com/comment/39679599
favorite count: 0
type: Question
tagged with: object
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/13209082
has comment: http://stackoverflow.com/comment/39679643
has answer: http://stackoverflow.com/a/25433719
tagged with: java
accepted answer: http://stackoverflow.com/a/25433719
has comment: http://stackoverflow.com/comment/39679714
has comment: http://stackoverflow.com/comment/39679623

http://stackoverflow.com/a/25455502
upvote count: 1
has body: You should use struts2 tags, they has support for OGNL. OGNL has a context and a value stack which is a root object. So, your request scoped object is displayed as &lt;p&gt; Full Name : &lt;s:property value=&quot;#request.myPersonObj.firstName&quot;/&gt;&amp;nbsp; &lt;s:property value=&quot;#request.myPersonObj.lastName&quot;/&gt; &lt;/p&gt; For better understanding OGNL concepts see docs.
score: 1
answers question: http://stackoverflow.com/q/25454699
type: Answer
downvote count: 0

http://stackoverflow.com/comment/39865695
type: QuestionComment
comment on: http://stackoverflow.com/q/25533978
score: 2
has text: Obviously `a` is not instanceof `CharSequence`.
type: Comment

http://stackoverflow.com/q/25444927
tagged with: broadcastreceiver
has comment: http://stackoverflow.com/comment/39701028
accepted answer: http://stackoverflow.com/a/25446459
tagged with: android
has title: Waiting until onReceive runs and stop
has comment: http://stackoverflow.com/comment/39700080
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25446459
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39700566
has body: Main Purpose: Reading an access point's properties freshly, and use it. I tried to add a custom BroadcastReceiver class to my activity. If it is true; I learned that; onReceive runs after intent action, (here: WifiManager.SCAN_RESULTS_AVAILABLE_ACTION). But i think i must wait until onReceive finishes running to get a fresh r11. When i debug the method "useResults"; "use r11, modify r11" lines runs first, after a while onReceive starts to run. public class MainActivity extends ActionBarActivity implements OnTouchListener{ int r11=0; public void useResults(){ mainWifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); receiverWifi = new WifiReceiver(); registerReceiver(receiverWifi, new IntentFilter( WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); mainWifi.startScan(); //use r11 //modify r11 //do something with r11 } @Override protected void onPause() { unregisterReceiver(receiverWifi); super.onPause(); } @Override protected void onResume() { registerReceiver(receiverWifi, new IntentFilter( WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); super.onResume(); } class WifiReceiver extends BroadcastReceiver { public void onReceive(Context c, Intent intent) { wifiList = mainWifi.getScanResults(); for (ScanResult result0:wifiList) { String ssid0 = result0.SSID; if(ssid0.compareTo("anID")==0){ r11=result0.level; } } } } }
type: Question

http://stackoverflow.com/q/25419741
has comment: http://stackoverflow.com/comment/39653818
favorite count: 0
type: Question
tagged with: ajax
has comment: http://stackoverflow.com/comment/39655155
linked to: http://stackoverflow.com/q/15357366
linked to: http://stackoverflow.com/q/3271249
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am new to ajax, I am making ajax call, it will hit servlet, it fetches data and prints data to jsp using out.println(). It is working fine but I feel its not good way. Here is my coding , Ajax call, xmlHttpReq.open('GET', "RTMonitor?rtype=groups&groupname="+temp, true); In RTMonitor servlet I have, sql ="SELECT a.vehicleno,a.lat,a.lng,a.status,a.rdate,a.rtime from latlng a,vehicle_details b where a.vehicleno=b.vehicleno and b.clientid="+clientid +" and b.groupid in(select groupid from group_details where groupname='"+gname+"' and clientid='"+clientid+"')"; resultSet = statement.executeQuery(sql); while(resultSet.next()) { response.setContentType("text/html"); out.println(" "+ " "+"&nbsp"+"&nbsp"+resultSet.getString("vehicleno")+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp"+" "+" "+" "+); //other s } I think this is not good way. So I think about returning response as JSON object. Tell me how to return object as JSON and set values in . and tell me JSON is a good way , or is there any other way please suggest me.
has comment: http://stackoverflow.com/comment/39653756
tagged with: servlets
has answer: http://stackoverflow.com/a/25420312
answer count: 2
has answer: http://stackoverflow.com/a/25420026
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39653828
score: 1
tagged with: jquery
has title: What is other better way to send response and print data in table structure?
downvote count: 1
has comment: http://stackoverflow.com/comment/39653845

http://stackoverflow.com/q/25499425
type: Question
answer count: 2
has body: I have this date but do not know timezone/ country Tue 8/26/2014 2:59 AM Using code how I can best guess from which country/locale this date is ? Give code example in java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25499543
score: -4
has comment: http://stackoverflow.com/comment/39802114
downvote count: 5
upvote count: 1
has title: How to guess locale from this date Tue 8/26/2014 2:59 AM?
has answer: http://stackoverflow.com/a/25499605
has comment: http://stackoverflow.com/comment/39802108
has comment: http://stackoverflow.com/comment/39802215
tagged with: java
has comment: http://stackoverflow.com/comment/39802558
has comment: http://stackoverflow.com/comment/39802224
favorite count: 0

http://stackoverflow.com/a/25536468
has comment: http://stackoverflow.com/comment/39892841
has body: OnDraw will be called multiple times per second in most cases. It will do so at potential random time intervals depending in how your code is setup. So your first call into draw could happen at time = 0ms, your second call could happen at 100ms, etc. Therefore, you might get a blue for 100ms followed by a red until the next color change occurs. You would need to restructure your handlers so that they are outside your draw mechanism most likely. Perhaps invalidate your view for draw inside a single handler outside the onDraw method. Similar to something on the lines of this that would loop around and continuously update the view with a different color. Warning, not tested, quick pseudo-code. public MyViewConstructorOrSimilarClass() { Handler handler = new Handler(); Runnable runnable = new Runnable() { @Override public void run() { int rnd = (int)(Math.random() * 4); switch(rnd) { case 0: globalpaint.setColor(Color.BLUE); break; case 1: globalpaint.setColor(Color.RED); break; case 2: globalpaint.setColor(Color.GREEN); break; case 3: globalpaint.setColor(Color.YELLOW); break; } invalidate();//requestLayout(); Depends on view. handler.postDelayed(runnable, 3000); } }; } @protected void onDraw(Canvas canvas) { ballBounds.set(ballX-ballRadius, ballY-ballRadius, ballX+ballRadius,ballY+ballRadius); canvas.drawOval(ballBounds, globalpaint); }
score: 0
answers question: http://stackoverflow.com/q/25536289
has comment: http://stackoverflow.com/comment/39871289
type: Answer

http://stackoverflow.com/q/25451806
type: Question
has answer: http://stackoverflow.com/a/25490145
upvote count: 2
has comment: http://stackoverflow.com/comment/39713095
answer count: 2
type: UnansweredQuestion
tagged with: annotations
linked to: http://stackoverflow.com/q/8048941
has answer: http://stackoverflow.com/a/43910948
score: 2
has body: I know there are three retention policies for Java annotations: CLASS: Annotations are to be recorded in the class file by the compiler but need not be retained by the VM at run time. RUNTIME: Annotations are to be recorded in the class file by the compiler and retained by the VM at run time, so they may be read reflectively. SOURCE: Annotations are to be discarded by the compiler. And although I understand their usage scenarios, I don't get why it is such an important thing to specify the retention policy that retention policies exist at all. I mean, why aren't all the annotations just kept at runtime? Do they generate so much bytecode / occupy so much memory that stripping those not declared as RUNTIME does make that much difference?
downvote count: 0
has title: Annotation retention policy: what real benefit is there in declaring `SOURCE` or `CLASS`?
has comment: http://stackoverflow.com/comment/39713340
tagged with: java
favorite count: 0

http://stackoverflow.com/comment/39773137
type: Comment
type: QuestionComment
has text: what JSON library are you using with Java?
comment on: http://stackoverflow.com/q/25484168
score: 0

http://stackoverflow.com/comment/39627730
has text: I can not add manually a table in a cell on excel. i can do it only in world. i contune to search if it is possible manually
comment on: http://stackoverflow.com/q/25399697
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25450877
has body: I put this listener on several swipelistview BaseSwipeListViewListener myBaseSwipeListViewListener = new BaseSwipeListViewListener() { @Override public void onOpened(int position, boolean toRight) { //Here I need the calling swipelistview } } with swipelistview0.setSwipeListViewListener(myBaseSwipeListViewListener); swipelistview1.setSwipeListViewListener(myBaseSwipeListViewListener); swipelistview2.setSwipeListViewListener(myBaseSwipeListViewListener); //and so on How could I get the calling swipelistview ?
answer count: 1
type: Question
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25451152
tagged with: android
tagged with: java
has title: Get the object that raises the listener
accepted answer: http://stackoverflow.com/a/25451152
tagged with: listener

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

http://stackoverflow.com/comment/39887256
type: Comment
comment on: http://stackoverflow.com/a/25536006
has text: Hi maaartinus, thanks for AtomicInteger suggestion. Could you please provide more details on Queue, Runnable and Polling solution? Thanks.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39825032
has text: Right. NaN would be the result of evaluating 0 / 0. I should have realized that since OP was getting Infinity, the numerator wasn't evaluating to 0; hence at least one of `d` and `p` must be declared as a floating point type.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25510919
score: 0

http://stackoverflow.com/q/25517353
has body: I want to select an element with specific text from the HTML using JSoup. The html is &lt;td style="vertical-align:bottom;text-align:center;width:15%"&gt; &lt;div style="background-color:#FFDD93;font-size:10px;margin:5px auto 0px auto;text-align:left;" class="genbg"&gt;&lt;span class="corners-top-subtab"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt; &lt;div&gt;&lt;b&gt;Pantry/Catering&lt;/b&gt; &lt;div&gt; &lt;div style="color:#00700B;"&gt;&amp;#10003;&amp;nbsp;Pantry Car Avbl &lt;br /&gt;&amp;#10003;&amp;nbsp;Catering Avbl&lt;/div&gt; &lt;/div&gt; &lt;div&gt; &lt;div&gt;&lt;span&gt;Dinner is served after departure from NZM on 1st day.;&lt;/span&gt;... &lt;br /&gt;&lt;a style="font-size:10px;color:Red;" onClick="expandPost($(this).parent());" href="javascript:void(0);"&gt;Read more...&lt;/a&gt; &lt;/div&gt; &lt;div style="display:none;"&gt;Dinner :2 chapati, rice, dal and chicken curry (NV) and paneer curry in veg &amp;amp;Ice cream.; Breakfast:2 bread slices with jam and butter. ; Omlet of 2 eggs (Non veg),vada and sambar(veg)..; coffee &amp;amp; lime juice&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;span class="corners-bottom-subtab"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/div&gt; I want to find the div element containing the text "Pantry/Catering". I tried doc.select("div:contains(Pantry/Catering)").first(); But this doesnt seem to work. How can I get this element using Jsoup?
tagged with: jsoup
upvote count: 14
type: UnansweredQuestion
has title: Jsoup find element with specific text
downvote count: 0
score: 14
has answer: http://stackoverflow.com/a/57135577
answer count: 3
has answer: http://stackoverflow.com/a/25517772
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/25533000
favorite count: 0
tagged with: parsing
type: Question

apache-httpclient-4.x
tags question: http://stackoverflow.com/q/25433240
tags question: http://stackoverflow.com/q/25420304
tags question: http://stackoverflow.com/q/25390203
tags question: http://stackoverflow.com/q/25425551
tags question: http://stackoverflow.com/q/25471451
tag name: apache-httpclient-4.x
type: Tag
tags question: http://stackoverflow.com/q/25469483
tags question: http://stackoverflow.com/q/25407853

http://stackoverflow.com/a/46922289
upvote count: 2
answers question: http://stackoverflow.com/q/25453042
downvote count: 0
has body: I also had this error in a project. As I understand it, newer versions of the JRE have the Xerces implementation built into it. More importantly, the JRE version properly supports the accessExternalDTD and entityExpansionLimit properties. Because I had a downstream dependency that was including xercesImpl.jar in my war file, my solution was to just yank it using the code below in my build.gradle and let the JRE implementation of xerces take over in the class path. warApplication { from '/WEB-INF/lib' exclude 'xercesImpl*.jar' }
type: Answer
score: 2

http://stackoverflow.com/comment/39860553
type: Comment
score: 0
has text: @Antoniossss When replacing `growx` with `fill`, I get: `Illegal Constraint: 'fill'`
type: QuestionComment
comment on: http://stackoverflow.com/q/25531070

http://stackoverflow.com/comment/39715131
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25452761
score: 0
has text: Maximum allowed is 1 character for "FL_CONCR" column, you are passing 8 characters

http://stackoverflow.com/q/25458911
has answer: http://stackoverflow.com/a/25459645
tagged with: java
has comment: http://stackoverflow.com/comment/39727428
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/39727163
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39727089
tagged with: swing
has body: I want to print mathematical solutions, questions and answers, both in Bold and plain text in my JTextArea How do I print symbols like exponent 2, matrix symbols, etc? Something like this: What is the shortest, smartest way to accomplish this type of text in JTextArea? Having both bigger fonts, smaller fonts wrapped together with few headings bold and having symbols too. Please pardon me if the question is childish :( SO is always my last and ultimate choice of getting answers to my questions.
linked to: http://stackoverflow.com/q/456002
type: Question
linked to: http://stackoverflow.com/q/7448216
has title: How to print symbols, non-alphanumeric characters in JTextArea
score: 0
has comment: http://stackoverflow.com/comment/39727176

http://stackoverflow.com/comment/39755294
type: Comment
type: AnswerComment
has text: But how to display the value of n.....which is the last id in the database plus 1.........in front of LOGIN ID....?????
score: 0
comment on: http://stackoverflow.com/a/25474022

http://stackoverflow.com/q/25472563
tagged with: swagger
downvote count: 0
has comment: http://stackoverflow.com/comment/39886089
has body: did anyone tried using swagger with play 2. i have play 2 java project and i am trying to integrate swagger with it without any luck. i installed the package using this dependency: "com.wordnik" %% "swagger-play2" % "1.3.7" but i keep getting this error from the routes file: object ApiHelpController is not a member of package controllers In C:\play project\check8s-api\conf\routes at line 21. line 21: GET /api-docs.json controllers.ApiHelpController.getResources any idea how to solve that?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39833375
has title: Swagger with play 2
type: UnansweredQuestion
tagged with: swagger-play2
has comment: http://stackoverflow.com/comment/46457256
has comment: http://stackoverflow.com/comment/62427358
score: 4
tagged with: swagger-ui
has comment: http://stackoverflow.com/comment/49174625
has comment: http://stackoverflow.com/comment/59723916
upvote count: 4
answer count: 0
has comment: http://stackoverflow.com/comment/61008317
tagged with: playframework
tagged with: java

http://stackoverflow.com/comment/39783479
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25486349
score: 0
has text: Can you post your POM?

http://stackoverflow.com/q/25451360
type: UnansweredQuestion
has title: Weka error msg - Not enough training instances with class labels (required: 1, provided: 0)!
downvote count: 0
tagged with: machine-learning
upvote count: 1
has body: My Weka code is not working. I don't know how to fix the error. Please give me some advice (I used weka.jar (version 3.6.11)) import weka.classifiers.Classifier; import weka.classifiers.Evaluation; import weka.classifiers.functions.RBFNetwork; import weka.clusterers.FarthestFirst; import weka.core.Attribute; import weka.core.FastVector; import weka.core.Instance; import weka.core.Instances; public class WEKATutorial { public static void main(String[] args) throws Exception { WEKATutorial wekaTut = new WEKATutorial(); wekaTut.executeWekaTutorial(); } private void executeWekaTutorial() throws Exception { FastVector allAttributes = createAttributes(); Instances learningDataset = createLearningDataSet(allAttributes); Classifier predictiveModel = learnPredictiveModel(learningDataset); Evaluation evaluation = evaluatePredictiveModel(predictiveModel, learningDataset); System.out.println(evaluation.toSummaryString()); predictUnknownCases(learningDataset, predictiveModel); } private FastVector createAttributes() { Attribute ageAttribute = new Attribute("age"); FastVector genderAttributeValues = new FastVector(2); genderAttributeValues.addElement("male"); genderAttributeValues.addElement("female"); Attribute genderAttribute = new Attribute("gender", genderAttributeValues); Attribute numLoginsAttribute = new Attribute("numLogins"); FastVector allAttributes = new FastVector(3); allAttributes.addElement(ageAttribute); allAttributes.addElement(genderAttribute); allAttributes.addElement(numLoginsAttribute); return allAttributes; } private Instances createLearningDataSet(FastVector allAttributes) { Instances trainingDataSet = new Instances("wekaTutorial", allAttributes, 4); trainingDataSet.setClassIndex(2); addInstance(trainingDataSet, 20., "male", 5); addInstance(trainingDataSet, 30., "female", 2); addInstance(trainingDataSet, 40., "male", 3); addInstance(trainingDataSet, 35., "female", 4); return trainingDataSet; } private void addInstance(Instances trainingDataSet, double age, S…
tagged with: weka
has answer: http://stackoverflow.com/a/25537616
score: 1
tagged with: java
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25538872

http://stackoverflow.com/comment/39621249
score: 0
comment on: http://stackoverflow.com/q/25400934
has text: Solved, example works as expected.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/45817386
answers question: http://stackoverflow.com/q/25420745
type: Answer
has body: The first thing you need is two properties files for keeping your configurations. The names of the files should match with the pattern application-{custom_suffix}.properties. Create them in the src/main/resources directory of your Maven project, next to the main application.properties file, which you’re going to use later to activate one of the others and to hold values shared by both profiles. Then it’s time to modify your pom.xml. You need to define a custom property in each of your Maven profiles and set their values to match with suffixes of corresponding properties files that you want to load with a particular profile. The following sample also marks the first profile to run by default, but it’s not mandatory. dev dev true release release Next, in the build section of the same file, configure filtering for the Resources Plugin. That will allow you to insert properties defined in the previous step into any file in the resources directory, which is the subsequent step. src/main/resources true … Finally, add the following line to the application.properties. spring.profiles.active=@activatedProperties@ When the build is run, the Resources Plugin will replace the placeholder with the value of the property defined in the active Maven profile. After starting your application, the Spring framework will load the appropriate configuration file based on the name of the active Spring profile, which is described by the value of the spring.profiles.active property. Note that Spring Boot 1.3 replaced the default Resources Plugin syntax for filtered values and uses @activatedProperties@ instead of ${activatedProperties} notation. It worked to perfection. Hope this can help you.
downvote count: 0
has comment: http://stackoverflow.com/comment/96213382
has comment: http://stackoverflow.com/comment/119343451
upvote count: 38
score: 38

http://stackoverflow.com/a/25493743
has body: Each Swing JComponent has ComponentUI that is responsible for displaying a component. While JComponent has a paint method, only user derived classes use it directly - "standard" implementations very often just call the paint method of the attached UI instead. This allows to plug-in various look and feel implementations very easily - a different look and feel just provides different ComponentUI's. Very clearly component is the "model" and the UI is the "view". And Android does not inherit this decoupling in very obvious way. For instance, its TextView seems just painting drawables when a similar JLabel has UI. This is however not the only place where MVC approach is used, and for some other specific cases Android and Swing MVC are very similar. For instance, Android ListView has a model (ListAdapter) very much like Swing JList has ListModel. In both cases the model provides data while the component itself provides possibilities to display. The possible difference is that Swing has more components with such decoupled data and presentation. JTable and JTree have similar models when Android does not provide such components out of box. There is no tree at all, and TableLayout is a that is called GridLayout in Swing, not similar to JTable. The general approach for invalidating and repainting is not much different and in both frameworks only dedicated master thread can touch components. Also, event listeners (probably other group of "controllers") are very similar in Java and Android, all differences between them could probably be called "subtle" only. Containers and layout manages are also quite similar between Swing and Android, the main differences being that Swing has much more possible implementations of its LayoutManager to choose from than Androids ViewGroup (classes like DatePicker, while derived from ViewGroup, are not general purpose layout managers). Also, part of Android layout is encoded in XML while Swing is typically plain Java only. If layout managers are a…
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25465320
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25465320

http://stackoverflow.com/comment/39789311
comment on: http://stackoverflow.com/q/25492381
has text: You mean the array index.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39774844
comment on: http://stackoverflow.com/q/25484784
type: Comment
type: QuestionComment
has text: I have no idea what you mean. You can't and there is no reason to do that anyway. See the answer of @CommonsWare.
score: 0

http://stackoverflow.com/q/25411410
has comment: http://stackoverflow.com/comment/39638925
tagged with: http://stackoverflow.com/tag/xml
type: Question
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39639100
score: 0
has answer: http://stackoverflow.com/a/25411800
has comment: http://stackoverflow.com/comment/39639093
has comment: http://stackoverflow.com/comment/39639219
has comment: http://stackoverflow.com/comment/39639000
linked to: http://stackoverflow.com/q/18289235
has body: I am working on a java program that reads from a xml file. The input string to be read is: ABC XYZ I am using the getTextContent() method of Element class to read the value of this node. I want to print the extra white spaces that are before the 'XYZ' string in the second line. However, those spaces are ignored. I also tried the getNodeValue() method but the output still remains the same.
tagged with: java
has title: Read XML node value containing white spaces
has comment: http://stackoverflow.com/comment/39638910
has comment: http://stackoverflow.com/comment/39639113
has comment: http://stackoverflow.com/comment/39638897

http://stackoverflow.com/q/25474260
linked to: http://stackoverflow.com/q/15073853
possible better answer: http://stackoverflow.com/a/25475275
has body: Which components, containers or layouts should I use to have left hand side click-able folder structure as shown in the picture? Is it possible to do it with Swing? left hand side = place which marked as favorite. As an second question, how can I put search icon in the jtextField like shown in the search place, top-right-hand-side?
has title: How to create folder listing
has comment: http://stackoverflow.com/comment/39756112
has answer: http://stackoverflow.com/a/25475275
tagged with: swing
duplicate of: http://stackoverflow.com/q/15073853
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25475058
answer count: 2
has comment: http://stackoverflow.com/comment/39755267
has answer: http://stackoverflow.com/a/25475058
score: 1
tagged with: java
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39755561
favorite count: 0
type: Question

http://stackoverflow.com/comment/39806384
comment on: http://stackoverflow.com/q/25495244
type: Comment
type: QuestionComment
has text: Also, this is the fourth time you've posted this question, and you're still posting the exact same background material without expanding it with what you've tried or where things are going wrong.
score: 0

http://stackoverflow.com/a/25414725
has comment: http://stackoverflow.com/comment/39648308
answers question: http://stackoverflow.com/q/25410144
type: Answer
has body: You could use @Conditional annotation or use a PropertySourcesPlaceholderConfigurer in xml bean defintion files. For example, for xml test.aspect = org.example.Test1Aspect &lt;context:property-placeholder location="configuration.properties" /&gt; &lt;bean id="testAspect" class="${test.aspect}" /&gt; You don't need maven aspectj plugin for Spring AOP.
score: 0
has comment: http://stackoverflow.com/comment/39660669
has comment: http://stackoverflow.com/comment/39648013
has comment: http://stackoverflow.com/comment/39668987

http://stackoverflow.com/q/25419369
score: 1
linked to: http://stackoverflow.com/q/12393590
tagged with: java
has comment: http://stackoverflow.com/comment/39657336
has body: I have inherited an application that is written using Spring 3.2. The application works absolutely fine when built when it is not obfuscated. Once obfuscated (using ProGuard) I get the following exception in my logs. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailStoreFactoryImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [de.aeromaritime.messaging.roudistsrv.data.RdsDAO] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(mappedName=, shareable=true, description=, name=, type=class java.lang.Object, lookup=, authenticationType=CONTAINER)} at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607) at org.springframework.context.support.AbstractApplicatio…
answer count: 1
downvote count: 0
has title: Why does Spring not see my @Resource annotated object after Obfuscation?
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39660933
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25419451
tagged with: spring
tagged with: obfuscation

http://stackoverflow.com/a/38740782
has body: String lastAppPN = ""; public void checkRunningApps() { ActivityManager mActivityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); String activityOnTop; if (Build.VERSION.SDK_INT &gt; 20) { activityOnTop = mActivityManager.getRunningAppProcesses().get(0).processName; } else { List&lt;ActivityManager.RunningTaskInfo&gt; RunningTask = mActivityManager.getRunningTasks(1); ActivityManager.RunningTaskInfo ar = RunningTask.get(0); activityOnTop = ar.topActivity.getPackageName(); } //Log.e("activity on TOp", "" + activityOnTop); // Provide the packagename(s) of apps here, you want to show password activity if (activityOnTop.contains("whatsapp") // you can make this check even better || activityOnTop.contains(CURRENT_PACKAGE_NAME)) { if (!(lastAppPN.equals(activityOnTop))) { lastAppPN = activityOnTop; Log.e("Whatsapp", "started"); } } else { if (lastAppPN.contains("whatsapp")) { if (!(activityOnTop.equals(lastAppPN))) { Log.e("Whatsapp", "stoped"); lastAppPN = ""; } } // DO nothing } }
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25440741
score: 2
upvote count: 3

http://stackoverflow.com/a/25527576
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25474223
has body: I found it! I changed the version of org.glassfish.jersey.containers and org.glassfish.jersey to 2.5 and it works!

http://stackoverflow.com/comment/39905348
has text: Can you check this question I posted. Same repo. http://stackoverflow.com/questions/25535991/hibernate-manytoone-mapping-automatic-loading-without-id-property-set
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25537533
type: Comment

coding-style
type: Tag
tag name: coding-style
tags question: http://stackoverflow.com/q/25420281

http://stackoverflow.com/comment/39694431
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25440479
has text: You code does not compile. See [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).

http://stackoverflow.com/q/25403420
favorite count: 0
has comment: http://stackoverflow.com/comment/39624207
has title: Include file exe into Project Netbeans Java
tagged with: resources
type: Question
tagged with: netbeans
linked to: http://stackoverflow.com/q/13991007
downvote count: 2
has comment: http://stackoverflow.com/comment/39623051
has comment: http://stackoverflow.com/comment/39625518
upvote count: 5
tagged with: exe
has comment: http://stackoverflow.com/comment/39625065
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/39624250
has body: i want to include a file into my project in Netbeans, i'm developping an application for PC with the language Java. I searched almost on the Net, but i have found nothing. When i compile the application if i go into path where there is /dist the file exe aren't here. Thank you so much. String exec [] = {getClass().getClassLoader().getResource("inc_volume.exe").getPath() }; System.out.println(exec[0]); Runtime.getRuntime().exec(exec); Update on 20/08/2014 15.29 I have found this source to extract from jar, but i don't know how to use: java.util.jar.JarFile jar = new java.util.jar.JarFile(jarFile); java.util.Enumeration enumEntries = jar.entries(); while (enumEntries.hasMoreElements()) { java.util.jar.JarEntry file = (java.util.jar.JarEntry) enumEntries.nextElement(); java.io.File f = new java.io.File(destDir + java.io.File.separator + file.getName()); if (file.isDirectory()) { // if its a directory, create it f.mkdir(); continue; } java.io.InputStream is = jar.getInputStream(file); // get the input stream java.io.FileOutputStream fos = new java.io.FileOutputStream(f); while (is.available() &gt; 0) { // write contents of 'is' to 'fos' fos.write(is.read()); } fos.close(); is.close(); } Here Image:
linked to: http://stackoverflow.com/q/320542
tagged with: java
answer count: 1
tagged with: file
has comment: http://stackoverflow.com/comment/39624680
accepted answer: http://stackoverflow.com/a/25404459
linked to: http://stackoverflow.com/q/1529611
has answer: http://stackoverflow.com/a/25404459

http://stackoverflow.com/q/25514014
answer count: 1
tagged with: kml
has comment: http://stackoverflow.com/comment/39829728
has body: I am attempting to parse a KML file which has some non-standard tags: <Placemark id="plot"> Type 1 62 Type 2 I'm attempting to read/parse the file, obtain the representative elements as described above and then all the coordinates, and finally write the output to a text file for downstream use. I'm able to parse the file and get the coordinates with no issues but have been unable to determine a way to get the custom elements, and I need the data to format the output file correctly. The elements are not wrapped in an extendeddata structure or any other grouping. I am hoping someone has run into this before and can offer some guidance on the best way to read the data via supplied methods for javaapiforkml.
has title: Parsing KML file with java api for kml
has comment: http://stackoverflow.com/comment/39829821
has comment: http://stackoverflow.com/comment/39829738
score: 0
upvote count: 1
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/39829794
favorite count: 0
tagged with: parsing
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25675312

http://stackoverflow.com/a/25488921
has comment: http://stackoverflow.com/comment/39783128
has body: Don't use else if if you want all the conditions to be evaluated. if(firstGroup instanceOf TreeItem ) { Sun first=(Sun) item.getUserObject(); ....; } if(secondGroup instanceOf TreeItem) { Wall second=(Wall) item.getUserObject(); ...; } if(thirdGroup instanceOf TreeItem) { Sky third=(Sky) item.getUserObject(); ...; } else if would have made sense if all the conditions were checking the type of firstGroup, since if that was the case, only one of them could have been true for a given value of firstGroup. After taking another look, it makes more sense to check the instance of the object you are actually casting, and in this case, else if makes sense : if (item.getUserObject() instanceOf Sun) { Sun first=(Sun) item.getUserObject(); ....; } else if (item.getUserObject() instanceOf Wall) { Wall second=(Wall) item.getUserObject(); ...; } else if (item.getUserObject() instanceOf Sky) { Sky third=(Sky) item.getUserObject(); ...; }
accepted answer of: http://stackoverflow.com/q/25488896
type: Answer
has comment: http://stackoverflow.com/comment/39782958
has comment: http://stackoverflow.com/comment/39782894
has comment: http://stackoverflow.com/comment/39782782
has comment: http://stackoverflow.com/comment/39782589
score: 3
has comment: http://stackoverflow.com/comment/39783023
has comment: http://stackoverflow.com/comment/39783075
upvote count: 3
has comment: http://stackoverflow.com/comment/39783302
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39782694
downvote count: 0
has comment: http://stackoverflow.com/comment/39782912
answers question: http://stackoverflow.com/q/25488896

http://stackoverflow.com/comment/39826747
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25511332
has text: find() will match against a substring, though, which isn't the same behavior as matches(). For instance, try using "abcdef" as your example string. This won't match anything in the example I gave above, but will match all of them here.

http://stackoverflow.com/q/25474479
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: sockets
tagged with: android
has title: TCP connection between Android App and PC
score: -1
has body: I'm trying to create a TCP connection between my PC and Android smartphone to send text from the PC (Client) to the Android App (Server). I found a tutorial which helped me with the code for the App which creates the server ( http://pastebin.com/z0xPSAvP ). Now I'm struggling connecting my client with the server. The client is programmed with "AutoIt" http://pastebin.com/tCW5bK9V When I run the client the "could not connect to $socket" msg-box is displayed. Could someone tell me what I'm doing wrong here? Both devices are in the same Network (smartphone via WiFi and PC via LAN) and I checked for the smartphones IP in the smartphone settings.
tagged with: tcp
upvote count: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25474798
tagged with: autoit
downvote count: 1

http://stackoverflow.com/q/25528769
tagged with: http://stackoverflow.com/tag/xml
type: Question
has body: Im trying to pass some data from a ListFragment to another Fragment. The list shows up fine but when I click on an item in the list, nothing happens, and there is nothing showing up in the log that indicates an error. I'm new to android/java development and trying to wrap my ahead around the different concepts (activities, fragments, bundle, etc). Coming from the iOS/objective C world I see similarities in the concept involved in passing data between 'views' but I guess I'm not fully understanding the android concept. Anyway, the fragments and layouts are below. Can someone help me to see where I am going wrong? Much appreciated. Layout for main (fragment_ehschedule.xml) and list view (schedule_info.xml): &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"&gt; &lt;EditText android:id="@+id/myFilter" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:hint="@string/some_hint"&gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/frameLayout" android:padding="6dip" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/textViewSessionTime" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textStyle="bold" android:paddingTop="10dip" android:paddingBottom="10dip" android:text="sessiontime" /&gt; &lt;TextView android:id="@+id/textViewScheduleDate" android:layout_width="fill_parent"…
possible better answer: http://stackoverflow.com/a/25529322
has answer: http://stackoverflow.com/a/25529759
accepted answer: http://stackoverflow.com/a/25529759
has comment: http://stackoverflow.com/comment/39856226
tagged with: android
has title: Android: Issue trying to pass data between fragments
type: AnsweredQuestion
answer count: 2
downvote count: 0
tagged with: android-fragments
has answer: http://stackoverflow.com/a/25529322
upvote count: 1
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/23353173
favorite count: 0
has comment: http://stackoverflow.com/comment/39856069

http://stackoverflow.com/comment/39898041
score: 0
type: Comment
type: AnswerComment
has text: Thanks, I already thought of that (this is my "plan B"), but I'm not sure it's the right way (what if package name changes tomorrow?)
comment on: http://stackoverflow.com/a/25550635

http://stackoverflow.com/a/25636657
has body: Before do any actions with user you should get user proxy from info.archinnov.achilles.persistence.PersistenceManager and only after that use setters/getters for modification with 'user' entity. User user = persistenceManager.getProxy(User.class, UUID.fromString(id));
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25470039
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25470039

http://stackoverflow.com/q/25492905
type: UnansweredQuestion
tagged with: java
favorite count: 0
type: Question
has body: I've got a simple Method that returns me always "-undefined-". public static String getStereoType(Class&lt;?&gt; clazz) { String result = "-undefined-"; if (clazz.isEnum()) { result = "enum"; } else if (clazz.isInterface()) { result = "interface"; } else if (clazz.isLocalClass() || clazz.isMemberClass()) { result = "class"; } return result; } When I call this Method with Object.class or Long.class always is the result "-undefined-". List&lt;Class&lt;?&gt;&gt; superClazzes = ClassUtil.getSuperClazzList(clazz); for (Class&lt;?&gt; c: superClazzess){ String stereoType = ClassUtil.getStereoType(c.getClass()); } public static List&lt;Class&lt;?&gt;&gt; getSuperClazzList(Class&lt;?&gt; clazz) { List&lt;Class&lt;?&gt;&gt; resultList = new ArrayList&lt;Class&lt;?&gt;&gt;(); Class&lt;?&gt; superClass = clazz.getSuperclass(); if (superClass != null) { resultList.add(superClass); resultList.addAll(getSuperClazzList(superClass)); } return resultList; }
has answer: http://stackoverflow.com/a/25494031
score: -2
has comment: http://stackoverflow.com/comment/39790446
has comment: http://stackoverflow.com/comment/39792144
tagged with: class
has answer: http://stackoverflow.com/a/25493851
upvote count: 0
tagged with: stereotype
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/39790278
has comment: http://stackoverflow.com/comment/39790463
tagged with: reflection
has title: Why does Class.isLocalClass always Boolean.FALSE?

http://stackoverflow.com/a/25440639
has body: Try with, int a=(int)(Math.random()*100); System.out.println(a); Math.random() Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Returned values are chosen pseudorandomly with (approximately) uniform distribution from that range.
answers question: http://stackoverflow.com/q/25440562
score: 2
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39690115
score: 1
type: QuestionComment
has text: @ErwinBolwidt Thanks, so it's actually the String object itself that might not be visible.
type: Comment
comment on: http://stackoverflow.com/q/25438681

http://stackoverflow.com/comment/39887543
type: Comment
comment on: http://stackoverflow.com/a/25545963
type: AnswerComment
has text: Thanks Thomas... You cleared my doubt. I thought same but was not sure that both are same or not... yeah, during my reading i got to know about -128 to 127 caching range... +1 for the equality thing...
score: 0

http://stackoverflow.com/comment/39868773
type: AnswerComment
comment on: http://stackoverflow.com/a/25535555
has text: Yea there is no contains method. Also instead of text[i] i used text.charAt(i). Does anyone else have any ideas?
type: Comment
score: 0

http://stackoverflow.com/comment/39751016
comment on: http://stackoverflow.com/a/25471510
type: Comment
type: AnswerComment
has text: Checking that there are 500 threads requires a solution which is not specific to multithreading. Treat the `Thread` instances as just a regular Java object, put them into a `Collection` and process the collection using general-purpose collection-processing code. Use the method `Thread#isAlive()` to check that a thread is still running.
score: 0

http://stackoverflow.com/q/25470211
has comment: http://stackoverflow.com/comment/39747925
has title: findViewById from a different class
has body: This should be simple, but even reading other solutions I can't get it... I simply want to access a TextView with findViewById from a different class (it's in a different file), how to do that? MainActivity: public class MainActivity extends ActionBarActivity { private TextView label0 = (TextView) findViewById(R.id.label0); MyDialog d = new MyDialog(this); public MainActivity(){ } //other methods and stuff... } Here is the DialogFragment that must access the TextView: public class MyDialog extends DialogFragment { private Activity MainActivity; private TextView label0; public MyDialog(Activity parent) { this.MainActivity = parent; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.alert_content) .setPositiveButton(R.string.alert_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //here it is, trying to access label0. This is one of the many tries label0 = MainActivity.findViewById(R.id.label0); //do other stuff... } I also read many times to never make the views "public static", Is that right?
type: Question
has comment: http://stackoverflow.com/comment/39747959
answer count: 2
has comment: http://stackoverflow.com/comment/39747853
has answer: http://stackoverflow.com/a/25470265
has comment: http://stackoverflow.com/comment/39748030
has comment: http://stackoverflow.com/comment/39748284
has answer: http://stackoverflow.com/a/25470443
has comment: http://stackoverflow.com/comment/39748347
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39747907
has comment: http://stackoverflow.com/comment/39747954
has comment: http://stackoverflow.com/comment/39747855
tagged with: android
tagged with: java
possible better answer: http://stackoverflow.com/a/25470265
accepted answer: http://stackoverflow.com/a/25470443

http://stackoverflow.com/comment/39609502
type: Comment
type: QuestionComment
score: 0
has text: Could you please write that in an example code? My brain is very exhausted and I can't figure it out right now.
comment on: http://stackoverflow.com/q/25395700

http://stackoverflow.com/a/25548262
has body: Maybe I don't quite understand the problem, but why are you making everything so complicated, instead of just using polymorphism? This is what the Object Oriented Paradigm is designed to do. Example: Flash.java public class Flash { public void doSomething() { System.out.println("Flash doSomething()"); } } SuperFlash.java public class SuperFlash extends Flash { @Override public void doSomething() { System.out.println("SuperFlash doSomething()"); } } FlashyThings.java public class FlashyThings { private ArrayList&lt;Flash&gt; things = new ArrayList&lt;&gt;(); public ArrayList&lt;Flash&gt; getThings() { return things; } public void doSomething(){ for (Flash thing : things) { thing.doSomething(); } } } ExampleMain.java public class ExampleMain { public static void main(String[] args) { Flash first = new Flash(); SuperFlash second = new SuperFlash(); Flash third = new Flash(); FlashyThings things = new FlashyThings(); things.getThings().add(first); things.getThings().add(second); things.getThings().add(third); things.doSomething(); } }
has comment: http://stackoverflow.com/comment/39891681
answers question: http://stackoverflow.com/q/25547205
type: Answer
has comment: http://stackoverflow.com/comment/39891714
has comment: http://stackoverflow.com/comment/39891853
score: 0

http://stackoverflow.com/comment/39810379
type: QuestionComment
has text: You use a debugger for this purpose.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25501155

http://stackoverflow.com/comment/39711609
has text: Is it a typo or is there is missing `$` at `#foreach ( $key in subscriptionToGroupMap.keySet() )` (should be `$subscriptionToGroupMap.keySet()`) ?
comment on: http://stackoverflow.com/q/25449797
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39754937
score: 0
type: Comment
has text: @TDHofstetter then what this `--f;` is doing then?
comment on: http://stackoverflow.com/a/25473878
type: AnswerComment

http://stackoverflow.com/q/25405170
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
has title: Unable to build Spring-boot-sample-gae (deploy Spring Boot on GAE)
score: 1
tagged with: java
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25409427
favorite count: 0
has answer: http://stackoverflow.com/a/25409427
type: Question
has body: We want to repeat the instruction of spring-boot-sample-gae step-by-step, but we are still not able to create the WAR file with the following error message : [ERROR] Failed to execute goal on project gae-demo: Could not resolve dependencies for project org.demo:gae-demo:war:0.0.1-SNAPSHOT: Could not find artifact org.springframework.boot:spring-boot-legacy:jar:1.1.0.BUILD-SNAPSHOT in spring-snapshots (http://repo.spring.io/snapshot) Could someone let us know how to tell spring-boot-sample-gae to find this dependency? (We already have this jar (spring-boot-legacy-1.1.2.BUILD-SNAPSHOT.jar) locally.) Also, it seems that Spring boot is not compatible to GAE(Google App Engine). Is there any way to mitigate this issue? We wish our Spring boot project can be deployed to GAE as soon as possible. Thanks a lot !!
tagged with: google-app-engine
tagged with: maven
upvote count: 1

http://stackoverflow.com/comment/39725472
type: Comment
has text: I indeed do set the userDefinedHeaderPrefix ="". If I remember correctly, the reason I didn't utilize this initally for my proprietary pattern was that a set of headers was defined in an enum that both the Server and Client depended on, e.g. value: `myHdr`. In testing, I saw a lack of symmetry: When `myHdr` was sent from the client, it was prefixed, `myPrefix-myHdr`, and in the server the prefix was not stripped to turn the header back into `myHdr` which is what the server also expected. (cont'd)
type: AnswerComment
comment on: http://stackoverflow.com/a/25445843
score: 0

http://stackoverflow.com/a/25498468
type: Answer
answers question: http://stackoverflow.com/q/25498406
downvote count: 0
upvote count: 1
has body: You could restrict access to field or method by using aspect oriented programming (cf: aspectJ) You can add a joinpoint on all you setter and in the before advice throw an exception when it's coming from another class. But this add a great lot of complexity to your apps and you should really think about it before going that way. As you thought, you cannot restrict the visibility, but you can restrict the access in that way. *precision on the setter joinpoint: it can intercept setting a value directly to a class field, you doesn't have to have an actual setter method.
score: 1

http://stackoverflow.com/q/25475747
has body: I received the below message from logcat when attempting to run my application. Essentially I am trying to retrieve a list of information from parse using query. The code seems fine, so I am not too sure how to resolve this issue. Logcat Message 08-24 19:23:35.387: E/AndroidRuntime(3996): FATAL EXCEPTION: main 08-24 19:23:35.387: E/AndroidRuntime(3996): Process: com.dooba.beta, PID: 3996 08-24 19:23:35.387: E/AndroidRuntime(3996): java.lang.NullPointerException 08-24 19:23:35.387: E/AndroidRuntime(3996): at com.dooba.beta.Fragment1$2.done(Fragment1.java:154) 08-24 19:23:35.387: E/AndroidRuntime(3996): at com.parse.FindCallback.internalDone(FindCallback.java:45) 08-24 19:23:35.387: E/AndroidRuntime(3996): at com.parse.FindCallback.internalDone(FindCallback.java:1) 08-24 19:23:35.387: E/AndroidRuntime(3996): at com.parse.Parse$6$1.run(Parse.java:888) 08-24 19:23:35.387: E/AndroidRuntime(3996): at android.os.Handler.handleCallback(Handler.java:733) 08-24 19:23:35.387: E/AndroidRuntime(3996): at android.os.Handler.dispatchMessage(Handler.java:95) 08-24 19:23:35.387: E/AndroidRuntime(3996): at android.os.Looper.loop(Looper.java:136) 08-24 19:23:35.387: E/AndroidRuntime(3996): at android.app.ActivityThread.main(ActivityThread.java:5017) 08-24 19:23:35.387: E/AndroidRuntime(3996): at java.lang.reflect.Method.invokeNative(Native Method) 08-24 19:23:35.387: E/AndroidRuntime(3996): at java.lang.reflect.Method.invoke(Method.java:515) 08-24 19:23:35.387: E/AndroidRuntime(3996): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 08-24 19:23:35.387: E/AndroidRuntime(3996): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 08-24 19:23:35.387: E/AndroidRuntime(3996): at dalvik.system.NativeStart.main(Native Method) Code public class Fragment1 extends Fragment { public interface Constants { String LOG = "com.dooba.beta"; } private String currentUserId; private String currentUser; protected TextView mUserRetrieved; protected TextView mUse…
has comment: http://stackoverflow.com/comment/39758037
tagged with: android-activity
type: Question
tagged with: parse-platform
has title: NullPointerException - fragment
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/25475833
score: 0
tagged with: android-fragments
tagged with: android
tagged with: java

http://stackoverflow.com/comment/39685761
score: 0
has text: That's not Java. Also: what nice properties are you thinking of? md5 is a very slow hash function if you don't care about cryptographic security, and generally considered broken if you do.
comment on: http://stackoverflow.com/q/25436538
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25406600
has title: Apache Shiro getSubject in REST API's @Singleton EJB bean
favorite count: 0
type: Question
tagged with: shiro
tagged with: ejb
accepted answer: http://stackoverflow.com/a/25406889
answer count: 1
downvote count: 0
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/25406889
type: AnsweredQuestion
tagged with: rest
has body: I'm developing a web app using Java EE 6 and Shiro for REST backend and this is accessed via an Angular based frontend. Session creation is disabled in shiro (noSessionCreation in shiro.ini) and I'm authenticating the user on every request based on a token he/she received after he/she provided the credentials for login. In the custom Authenticating filter I'm calling SecurityUtils.getSubject().login(bearerToken); That calls the custom authentication realm and does the validation of the credentials. I have a Dao where I want to use the ID of the user which is stored in the Shiro Subject's principal information. final UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal(); final Long currentUserId = userInfo.getId(); The Dao itself is a @Singleton EJB @Singleton public class TaskDao { ... public List&lt;Task&gt; filterActiveTasks() { } } In this case I want to filter the active tasks that belong to the user that's accessing the service. My question and concern at the same time: Is this thread safe? Isn't it possible that upon concurrent usage the subjects might get mixed up? If so, how could it be avoided? EDIT: My concern is not just for the activeTasks but also apply for any @Singleton annotated classes where I want to use the SecurityUtils.getSubject() static method. public List&lt;SomeData&gt; getSomeDataRelatedToCurrentlyLoggedInUser() { // Since the following is a static call in a singleton, how can I be sure // that when 10 users are calling this at the same time, each call will get // the appropriate UserInfo that was "logged-in" at the AuthenticatingFilter level final UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal(); Long currentUserId = userInfo.getId(); return em.createNamedQuery("select s from SomeData s where s.userId = :userId"). setParameter("userId", currentUserId). getResultList(); } The login part is done in the custom AuthenticatingFilter which is -AFAIK- created for each user. So the question still remains:…
tagged with: java
tagged with: thread-safety

http://stackoverflow.com/comment/39656059
type: AnswerComment
comment on: http://stackoverflow.com/a/25420710
has text: I have just tried your first solution, and unfortunately nothing has changed. I will try the second solution now, Thankyou very much for your answer though!
score: 0
type: Comment

http://stackoverflow.com/comment/39738170
has text: I going through it right now. Another suggestion I got was to wrap the Date object in a class - lets say DateItem (either as String or epoch long value) and pass the array of DateItem. Sound a bit roundabout.
score: 0
comment on: http://stackoverflow.com/q/25464425
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25475084
has answer: http://stackoverflow.com/a/25475137
upvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/25475107
has title: Java Module Issues
downvote count: 1
favorite count: 0
type: Question
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39756773
has body: Hey I am making a game in java using slick and run into all these errors. It works on my friend's computer but not on mine. I've tried on both mac and pc. Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1119) at org.lwjgl.Sys$1.run(Sys.java:73) at java.security.AccessController.doPrivileged(Native Method) at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) at org.lwjgl.Sys.loadLibrary(Sys.java:95) at org.lwjgl.Sys.&lt;clinit&gt;(Sys.java:112) at org.lwjgl.opengl.Display.&lt;clinit&gt;(Display.java:135) at Game.start(Game.java:37) at Main.main(Main.java:5) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) What does above exception mean?? I do have it in my class path.
score: -1
has comment: http://stackoverflow.com/comment/39756779

http://stackoverflow.com/q/25517675
has comment: http://stackoverflow.com/comment/39836755
has comment: http://stackoverflow.com/comment/39836887
tagged with: swing
has comment: http://stackoverflow.com/comment/39836642
has comment: http://stackoverflow.com/comment/39836631
has body: I haven't looked at the code for this little game I made a while ago, and now all of the sudden the image won't move up when I click it? I know the clicks are being called because the counter goes up. But the image won't move up. Any help is appreciated. Batman class below package Clicky; import java.awt.Image; import javax.swing.ImageIcon; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; public class Batman { private String batz = "batbomb.png"; private int x; private int y; private Image image; private boolean visible; public Batman() { ImageIcon ii = new ImageIcon(this.getClass().getResource(batz)); image = ii.getImage(); visible = true; x = 145; y = 620; } public int getX() { return x; } public int getY() { return y; } public Image getImage() { return image; } public boolean isVisible() { return visible; } public void setVisible(boolean visible) { this.visible = visible; } public void mouseClicked(MouseEvent e) { int button = MouseEvent.BUTTON1; if (button == MouseEvent.MOUSE_CLICKED) { y -= 1; } } } Where everything is drawn here package Clicky; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JPanel; import javax.swing.Timer; import java.awt.Image; import javax.swing.ImageIcon; public class Clicky extends JPanel implements ActionListener { private Batman bat; private Timer timer; private int clicks = 0; private boolean visible; public Clicky() { addMouseListener(new TAdapter()); setFocusable(true); setBackground(Color.BLACK); setDoubleBuffered(true); timer = new Timer(5, this); timer.start(); bat = new Batman(); } public int getClickCount() { return clicks; } @Override public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D)g; g.setCol…
score: 0
has comment: http://stackoverflow.com/comment/39836676
has answer: http://stackoverflow.com/a/25517760
tagged with: java
answer count: 1
tagged with: user-interface
has title: Java image wont move on mouse click?
has comment: http://stackoverflow.com/comment/39836813
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/39836638
type: UnansweredQuestion

http://stackoverflow.com/comment/39697483
has text: @AnkitGarg Where is `setContentView(R.layout.yourlayout);`? Where is Initialization of `ImageView` and `ClickListener`?
comment on: http://stackoverflow.com/q/25443434
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25530451
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25530342
has comment: http://stackoverflow.com/comment/39859521
has comment: http://stackoverflow.com/comment/39860102
has body: I assume you mean to shift by 16 bits, not 32, to get 0x12345678. Shifting by 32 will overflow in Java, and in most C/C++ implementations. That is guaranteed, and independent of endianness. Endianness determines how multi-byte values are stored in memory, not which bits are logically in which position within the value. Left-shifting by N bits is always equivalent to multiplying by 2N.
type: Answer
score: 2

http://stackoverflow.com/a/25433040
has comment: http://stackoverflow.com/comment/39679089
has comment: http://stackoverflow.com/comment/39678564
has comment: http://stackoverflow.com/comment/39679158
answers question: http://stackoverflow.com/q/25405834
type: Answer
accepted answer of: http://stackoverflow.com/q/25405834
score: 2
upvote count: 2
downvote count: 0
has body: Try the following: task :some_name do puts "==================Building with Maven======================" run "cd #{deploy_to}/current &amp;&amp; mvn clean package" run "nohup java -jar #{deploy_to}/current/target/*dependencies.jar &gt; /dev/null 2&gt;&amp;1 &amp;" end after "deploy", "some_name" and run cap deploy
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39938860

http://stackoverflow.com/comment/39631467
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25406681
has text: @MindPeace Thanks for replying, unfortunately, it still doesn't seem to work. It gives the same error as before.
type: Comment

scaling
tags question: http://stackoverflow.com/q/25481610
type: Tag
tag name: scaling

http://stackoverflow.com/q/25448586
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25448969
has title: Java equivalent to MD5CryptoServiceProvider computeHash & ToBase64String
tagged with: c#
possible better answer: http://stackoverflow.com/a/25448969
has answer: http://stackoverflow.com/a/25448959
has body: I compute MD5 hash for a string in C# the following way: var provider = new System.Security.Cryptography.MD5CryptoServiceProvider(); var bytes= Encoding.Unicode.GetBytes(value); bytes = provider.ComputeHash(bytes); return Convert.ToBase64String(bytes); I need to do the same calculation in Java (Android) to match the hash produced using the above method. I tried the following with no luck: 1. byte[] encoded = Base64.encodeBase64(str.getBytes()); return new String(encoded); 2. String digest = null; MessageDigest md = MessageDigest.getInstance("MD5"); byte[] hash = md.digest(message.getBytes("UTF-8")); //converting byte array to Hexadecimal String StringBuilder sb = new StringBuilder(2*hash.length); for(byte b : hash){ sb.append(String.format("%02x", b&amp;0xff)); } digest = sb.toString(); 3. String resultHash = null; try { MessageDigest md5 = MessageDigest.getInstance("MD5"); byte[] result = new byte[md5.getDigestLength()]; md5.reset(); md5.update(buffer); result = md5.digest(); StringBuffer buf = new StringBuffer(result.length * 2); for (int i = 0; i &lt; result.length; i++) { int intVal = result[i] &amp; 0xff; if (intVal &lt; 0x10) { buf.append("0"); } buf.append(Integer.toHexString(intVal)); } resultHash = buf.toString(); } catch (NoSuchAlgorithmException e) { } return resultHash; EDIT: The Objective C method that produced the C# matching values is this: NSMutableString *encodedData = [NSMutableString string]; int i = 0, j = 0; unsigned char char_array_3[3]; unsigned char char_array_4[5]; memset(char_array_3, 0, 3*sizeof(char)); memset(char_array_4, 0, 5*sizeof(char)); int length = [md5Data length]; char *bytes = (char*)[md5Data bytes]; while(length--) { char_array_3[i++] = *(bytes++); if (i == 3) { char_array_4[0] = kBase64Alphabet[(char_array_3[0] &amp; 0xfc)&gt;&gt;2]; char_array_4[1] = kBase64Alphabet[((char_array_3[0] &amp; 0x03) &lt;&lt;4) + ((char_array_3[1] &amp; 0xf0) &gt;&gt;4)]; char_array_4[2] = kBase64Alphabet[((char_array_3[1] &amp; 0x0f) &lt;&lt;2) +…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39708575
tagged with: cryptography
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25448959
answer count: 2
has comment: http://stackoverflow.com/comment/39780411
upvote count: 2
tagged with: encryption
has comment: http://stackoverflow.com/comment/39734816
has comment: http://stackoverflow.com/comment/39710891

http://stackoverflow.com/q/25470997
score: 0
has answer: http://stackoverflow.com/a/25471070
linked to: http://stackoverflow.com/q/25463807
has comment: http://stackoverflow.com/comment/39749373
has body: I am trying to access the getActiveNotifications() from the NotificationListenerService class, however it doesn't work, I have tried these to ways: 1) NotificationListenerService nls = new NotificationListenerService(); activeNotifications = nls.getActiveNotifications(); 2) activeNotifications = NotificationListener.class.getActiveNotifications(); But for 1) I get this error: Cannot instantiate the type NotificationListenerService and for 2) I get this error: The method getActiveNotifications() is undefined for the type Class&lt;NotificationListenerService&gt; This seems to be simple Java but I can't get it to work, what am I doing wrong? Any help is much appreciated, thanks.
tagged with: java
linked to: http://stackoverflow.com/q/25209813
answer count: 1
type: Question
has title: Cannot instantiate the type NotificationListenerService in Android
tagged with: android
has comment: http://stackoverflow.com/comment/39749328
accepted answer: http://stackoverflow.com/a/25471070
type: AnsweredQuestion

http://stackoverflow.com/comment/112025315
has text: @RohitKumar - you may want to ask a separate question here on SO to address your issue.
comment on: http://stackoverflow.com/a/25502418
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/25502996
has answer: http://stackoverflow.com/a/25505009
score: 0
has title: How to make second layout on top of glview (openGL)
tagged with: java
answer count: 1
has body: I am trying to set other layout (in my case: a WebView) on top of my glView. glView = new GLSurfaceView(this); glView.setRenderer(this); setContentView(glView); I searched and read articles about this and as all suggest that i should do : set content view for my glview add content view (as parent view) (relative layout) add webview inside my parent view I followed the suggestion as follows: glview is declared in other class file (as i wrote above) then in my actual class.... webView = new WebView(glGame); glGame.addContentView(rl, null); rl.addView(webView); However, I got this error : 08-26 19:37:21.855: E/AndroidRuntime(23376): FATAL EXCEPTION: GLThread 23363 08-26 19:37:21.855: E/AndroidRuntime(23376): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.os.Handler.&lt;init&gt;(Handler.java:197) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.os.Handler.&lt;init&gt;(Handler.java:111) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.webkit.WebViewClassic$PrivateHandler.&lt;init&gt;(WebViewClassic.java:12520) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.webkit.WebViewClassic.&lt;init&gt;(WebViewClassic.java:2144) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.webkit.WebViewClassic$Factory.createWebView(WebViewClassic.java:3021) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.webkit.WebView.ensureProviderCreated(WebView.java:1980) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.webkit.WebView.setOverScrollMode(WebView.java:2033) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.view.View.&lt;init&gt;(View.java:3381) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.view.View.&lt;init&gt;(View.java:3434) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:446) 08-26 19:37:21.855: E/AndroidRuntime(23376): at android.widget.AbsoluteLayout.&lt;init&gt;(Absolute…
tagged with: webview
tagged with: opengl-es
type: Question
tagged with: android-layout
linked to: http://stackoverflow.com/q/3929412
tagged with: android
accepted answer: http://stackoverflow.com/a/25505009
type: AnsweredQuestion

http://stackoverflow.com/q/25441238
answer count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: java
has body: I want to create n number of job scheduler at runtime based on user input in web page. Basically I am developing a reporting web application where a user can schedule a report and give email-Id to get the report in email periodically. I am using Java 1.7, Spring 3.2.8, Spring JdbcTemplate, Birt for developing the application. Please suggest me the best way or design to achieve the above requirement. Thanks
tagged with: spring
has title: The best way to create job scheduler at runtime based on user input
has comment: http://stackoverflow.com/comment/39693363
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25441410
downvote count: 0

http://stackoverflow.com/a/25848023
has body: Whether you added this in manifest? &lt;activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /&gt; in java file: AdView adView = (AdView) this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder() // Add a test device to show Test Ads..comment for real app when launching // .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) //.addTestDevice("CC5F2C72DF2B356BBF0DA198") //test this in emulator .build(); // Load ads into Banner Ads adView.loadAd(adRequest);
answers question: http://stackoverflow.com/q/25473699
score: 0
type: Answer

http://stackoverflow.com/q/25488435
tagged with: maven
has comment: http://stackoverflow.com/comment/39782085
linked to: http://stackoverflow.com/q/1272648
has answer: http://stackoverflow.com/a/25488995
score: 0
tagged with: java
has body: i follow this Reading my own Jar&#39;s Manifest guidelines to get manifest entries programmatically. I am building jar file with maven-assembly-plugin. Manifest file is located in META-INF/MANIFEST.MF inside jar file. Problem is that i am getting empty entry in any case. I tried to load using JarFile, Using ClassLoaderResources not effect. But if add extra entries into pom file, using then i can read this entries if they are in separate section (separated with extra newline). If i add entries to main attributes section with then they are invisible. Is it possible that for some security reason reading programmatically manifest.mf file is disabled?
answer count: 1
tagged with: maven-assembly-plugin
has comment: http://stackoverflow.com/comment/39782117
has title: how to get entries from manifest.mf file bundled with jar
type: Question
has comment: http://stackoverflow.com/comment/39782226
has comment: http://stackoverflow.com/comment/39783473
type: UnansweredQuestion

http://stackoverflow.com/comment/39802278
comment on: http://stackoverflow.com/q/25499239
type: Comment
type: QuestionComment
score: 0
has text: Working great @pskink, also i have another issue when scale, it is transformed even i am not transform in matrix, code matrix.setScale(1f, 1f); path.transform(matrix);

http://stackoverflow.com/q/25455565
has comment: http://stackoverflow.com/comment/39720863
has title: Array not Recognized
answer count: 3
tagged with: exception
tagged with: java
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/39723825
has comment: http://stackoverflow.com/comment/39724895
upvote count: 0
type: UnansweredQuestion
has body: My program is to enter 10 numbers and add them together then display the result. Then I am to divide the smaller number by the larger number and display the result. Users cannot enter characters or zero. I am new and have been working on this for DAYS. I do not see my mistake. Now my problem is the Variable i isn't being recognized. I introduced an Exception (try..catch) and it wouldn't read. I tried moving things all over (I'm new, I'm guessing and seeing what does what..) I did something wrong and probably something stupidly small. I need some help and fresh eyes. I also need to end the program when the user enters 9999. Any idea where that would go? 'Cause I'm about to break out into tears. public static void main(String[] args) throws NumberFormatException { Scanner in = new Scanner(System.in); Scanner input = new Scanner(System.in); double[ ] digit = new double[11]; int sum = 0; //Declare an array System.out.print("Please Enter Ten Numbers:"); System.out.println(); try{ for (int i = 1; i &lt; digit.length; i++) System.out.print("Numbers " + i + ": "); digit[i] = (double)in.nextInt(); //Array Not recognized here sum += (int)digit[i];//Or recognized here // Input the data into array from the user. if(digit[i]==0.0)//None of these are recognized either, what did I do? { System.out.println("You can't enter zero. Try again"); --i; //nope in.nextLine();//dispose of wrong number } }catch (NumberFormatException e){ System.out.println("You Can Only Enter Numbers!"); --i; //nope, not recognizing here either in.nextLine();//dispose of wrong input } System.out.println("Total Values in Array:"+ sum); // Calculate the sum and print the total System.out.println(); System.out.println("Would you like to divide the values?"); System.out.println("Yes or No to Exit the Program"); String a = input.next(); if(a.equalsIgnoreCase("yes")){ double [] divisionResult = new double[digit.length / 2]; //Division array declared for (int i = 1; i &lt; digit.length; i += 2) //These are all good…
tagged with: arrays
has comment: http://stackoverflow.com/comment/39720906
has answer: http://stackoverflow.com/a/25465011
downvote count: 1
has answer: http://stackoverflow.com/a/25455629
has answer: http://stackoverflow.com/a/25455630
type: Question
tagged with: try-catch

http://stackoverflow.com/comment/52763914
type: QuestionComment
has text: I was trying to do the same thing with the class hierarchy (have the deserializer choose the right subclass based on fields) and this method didn't work for me with codehaus 1.9 or with fasterxml 2.4.1. I kept on getting a stackoverflow exception because readValue/treeToValue called the deserializer back. The work around was to use the technique above along with a DeserializerModifier - http://stackoverflow.com/questions/18313323/how-do-i-call-the-default-deserializer-from-a-custom-deserializer-in-jackson.
comment on: http://stackoverflow.com/q/25503005
score: 1
type: Comment

http://stackoverflow.com/a/25418888
type: Answer
has comment: http://stackoverflow.com/comment/39661228
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39690691
has body: Well, you're pretty close to what is one of the standard designs to working with databases. The main difference is in the name of the classes (e.g. DAO instead of Manager), and that you are extending the DB connection pool manager in order to create the DAOs. Let me elaborate a little bit: The database should be separated by abstraction from your application. In order to achieve this, you usually create what's known as a data abstraction layer on top of the database. This is a little bit similar to your RdbmsManager class, and its point is to abstract away the actual DB used. In order to achieve this, you normally have a database access interface of some kind which will be implemented by some class controlling all connections to the DB (try to avoid names containing 'Manager' since it doesn't really help clarify what those classes do). If later on you decide to change the DB you're using, all you need to do is create a new implementation to the interface that supports the new DB, and you're pretty much done ! Access to the actual data in the database should also be abstracted by another layer, usually called data access layer. This layer contains interfaces that encapsulate all access to specific type of data (per table usually), and enable CRUD operations to be performed on them. Those interfaces are generally named SomethingDAO where 'Something' stands for the type of object being accessed (the 'DAO' part stands for: 'Data Access Object'). Again, the implementations of those interfaces should be DB specific and be changed when you replace the DB you use with another. The data should be transferred to the client code (usually the business/application layer) using some other method, usually DTOs (stands for 'Data Transfer Object'). These are (again) interfaces which expose some functionality required from the objects being represented in the DB, which should be implemented by DB specific (or generic, it depends) classes. This is the theory in short. There are many d…
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25417053
has comment: http://stackoverflow.com/comment/39662228
has comment: http://stackoverflow.com/comment/39662092
answers question: http://stackoverflow.com/q/25417053
score: 1
has comment: http://stackoverflow.com/comment/39688050

http://stackoverflow.com/a/71332679
type: Answer
score: 0
has body: This is an old question, and I might be replying too late, but I would like to anyways share my experience in case anyone hits the issue. I was using port# 8000, but still unable to bind to the port from a java program. It was network filter running as part of eset endpoint security that was blocking the connection. I added a rule in eset firewall to allow port 8000, and it started working.
answers question: http://stackoverflow.com/q/25544849

http://stackoverflow.com/q/25543149
has body: If there is a unused socket instance, but it is not closed. If the jvm would gc it? If yes ,whether the tcp connection would close automatically?
tagged with: sockets
tagged with: garbage-collection
upvote count: 4
score: 4
accepted answer: http://stackoverflow.com/a/25543332
type: AnsweredQuestion
downvote count: 0
tagged with: java
answer count: 1
has title: If the jvm gc an unclosed socket instance what would happen to the underlying tcp connection?
favorite count: 0
has answer: http://stackoverflow.com/a/25543332
type: Question

http://stackoverflow.com/comment/39809387
score: 0
comment on: http://stackoverflow.com/a/25462908
type: Comment
type: AnswerComment
has text: Of course, I understand. However - static fields and classes are not always a bad idea (for example, if you use the object through all the application, at any time, making it static seems rational) and should not be avoided if there is a reason to use them (at least I believe so, tell me if I am wrong :)). I'll await your results :).

http://stackoverflow.com/q/25494191
downvote count: 1
tagged with: dcm4che
answer count: 1
has title: How can I reuse DCM4CHEE code to send patient data to an equipment?
has answer: http://stackoverflow.com/a/25527591
has comment: http://stackoverflow.com/comment/39797264
accepted answer: http://stackoverflow.com/a/25527591
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39877617
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39816013
has body: I use DCM4Chee to receive the DICOM from the equipments. All fine, DCM4Chee is a great software. I now would like to send the patient data in advance to the equipment, so that the patient data is prefilled when the doctor or technician starts the examination. I am not sure of how it works. Should I send a kind of DICOM message with no image data to the equipment? Using dcmsnd utility, or something else? I use the pacsdb database, and am able to create patient data. I think I will be able to create study data to be sent to the equipment, but how should I send this information to the equipment. Ideas and examples are welcome :D. Answer conclusion: The way to go i sing the Modality Worklist from DCM4CHEE, populating it using HL7 messages. Interesting links: DICOM Modality Worklist Java HL7 opensource API DCM4CHEE Modality Worklist HL7 message format
upvote count: 1
tagged with: java

http://stackoverflow.com/a/47420300
downvote count: 0
has comment: http://stackoverflow.com/comment/132006036
type: Answer
has comment: http://stackoverflow.com/comment/82785811
has comment: http://stackoverflow.com/comment/94556552
has body: I was facing the exact same issue: Maven complains about org.springframework.core.env.EnvironmentCapable, even with the file there, inside the JAR: C:\Users\fabio\.m2\repository\org\springframework\spring-core\4.3.12.RELEASE\spring-core-4.3.12.RELEASE.jar. The solution in my case was to delete the .m2 folder, so that Maven downloaded all the JARs again. Maybe it was some corrupted file. I hope it helps someone!
score: 5
answers question: http://stackoverflow.com/q/25488194
upvote count: 5

http://stackoverflow.com/comment/39810676
score: 7
type: QuestionComment
has text: What makes you think that package name comes after import statements.
comment on: http://stackoverflow.com/q/25504204
type: Comment

http://stackoverflow.com/q/25509667
has comment: http://stackoverflow.com/comment/39821625
has body: I'm trying to load a collection of images in an ArrayList but only the last picture looks. the first can not see on the panel. any info? the idea is that the images they appear sequentially in the JPanel. thanks. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package cargaimagenes; import java.awt.Graphics; import java.awt.Image; import java.awt.image.ImageObserver; import java.awt.image.ImageProducer; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.imageio.ImageIO; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JLabel; /** * * @author ZOUHIR */ public class PanelCarga extends javax.swing.JFrame { /** * Creates new form PanelCarga */ private List&lt;Image&gt; Imagenes = new ArrayList&lt;Image&gt;(); private JLabel eq = new JLabel(); private Image imagen = new Image() { @Override public int getWidth(ImageObserver observer) { throw new UnsupportedOperationException("Not supported yet."); } @Override public int getHeight(ImageObserver observer) { throw new UnsupportedOperationException("Not supported yet."); } @Override public ImageProducer getSource() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Graphics getGraphics() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object getProperty(String name, ImageObserver observer) { throw new UnsupportedOperationException("Not supported yet."); } }; public PanelCarga() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { PanelP = new javax.swing.JPanel(); lPrincipal = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jToggleButton1 = new javax…
tagged with: java
tagged with: jpanel
score: -1
has title: Load ArrayList <Image> on Jpanel Java
upvote count: 0
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39821468
has answer: http://stackoverflow.com/a/25509711
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/39624207
has text: @RafaelOsipov how to include file exe into project so that when I compile the file and I get the jar is all together?
score: 0
comment on: http://stackoverflow.com/q/25403420
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/108106201
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25751231
type: AnswerComment
has text: It does not work for me at all. And hasn't any sense, too - if it can't find TestNGException file, how can help exact pointing to test classes?

http://stackoverflow.com/q/25493986
favorite count: 0
type: Question
score: 3
has answer: http://stackoverflow.com/a/31117073
tagged with: windows
has comment: http://stackoverflow.com/comment/39815621
upvote count: 3
has title: jre install directory oddness
has answer: http://stackoverflow.com/a/25827738
answer count: 2
tagged with: installation
type: UnansweredQuestion
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39792455
has body: Here's something weird. Consider these two recent versions of the java environment: jre-8u11-windows-i586.exe jre-8u20-windows-i586.exe Install 8u11. It will place it into program files (x86)\java\jre8 Install 8u20. It will place it into program files (x86)\java\jre1.8.0_20 I don't know exactly when the naming changed between rev 11 and rev 20 but it's kind of annoying seeing that I need to have JAVA_HOME preset in a config file (for a windows service that will be installed after). Used to be that any earlier rev of java 1.8 would install to the jre8 folder... not any longer it seems. Why would this change?

http://stackoverflow.com/a/25500020
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25488561
type: Answer
has body: In case someone needs it in future, adding loadingView.animate().cancel() and contentView.animate().cancel() before animation cancels previous animations and everything works ok.
score: 1

http://stackoverflow.com/a/25440703
has body: change String line; System.out.println(".....reader.readLine().........."+reader.readLine()); while((line=reader.readLine())!=null) { builder.append(line); System.out.println("....builder.append(line);..."+builder.append(line)); } to while((line=reader.readLine())!=null) { System.out.println(".....reader.readLine().........."+ line); builder.append(line); System.out.println("....builder.append(line);..."+builder.append(line)); } otherwise you are reading the line, printing it and throwing it away, and will not be added to the jsonData variable
has comment: http://stackoverflow.com/comment/39693110
has comment: http://stackoverflow.com/comment/39692563
has comment: http://stackoverflow.com/comment/39693608
type: Answer
accepted answer of: http://stackoverflow.com/q/25440547
answers question: http://stackoverflow.com/q/25440547
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39692908

http://stackoverflow.com/a/25399807
has comment: http://stackoverflow.com/comment/39664910
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25399396
has body: Logic which moves your character should be called inside for circle. You should move your character every circle iteration (if button was clicked) Like this: for (int i = 0; i &lt; 2; i++) { if (Gdx.input.isTouched(i)) { final int iX = Gdx.input.getX(i); if (iX &gt; screenwidth - screenwidth / 14) { buttontouch = true; } else { buttontouch = false; } if (iX &lt;= screenwidth - screenwidth / 14) { playertouch = true; }else{ playertouch = false; } } //Logic here! if (playertouch){ etc... } if(buttontouch){ etc... } }

http://stackoverflow.com/comment/39787488
score: 0
comment on: http://stackoverflow.com/q/25491428
has text: you have to use websocket. http://www.abrandao.com/2013/06/25/websockets-using-modern-html5-technology-for-true-server-push/
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39809670
comment on: http://stackoverflow.com/a/25493128
type: Comment
has text: Thank-you. But actually I did. My server.properties file begins with server.remote_open=true. In fact, I can remotely open a database, but when I try to remotely open a second database, I obtain a connection to the first one.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39869784
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25535950
type: Comment
has text: I mean no disrespect, treeno. http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons

http://stackoverflow.com/q/25398469
has answer: http://stackoverflow.com/a/25398547
has comment: http://stackoverflow.com/comment/54114500
has title: @DefaultValue is not compatible with @PathParameter in RESTful framework
has comment: http://stackoverflow.com/comment/39614627
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39614379
favorite count: 0
type: Question
has body: I got a requirement that I need a default value for a @PathParameter. And this is how my code looks like: @GET @Path("/family/{member}") public Response responseMsg( @DefaultValue("Father") @PathParam("member") String pathParameter) {} The compiler will not show any error, and also the application of course will not act the way like what I've expected. because the uri "/family/null" will not match the Path "/family/{member}" but "/family/" May I know if there is any way to assign a default value for a @PathParam and how? and also I want to know if @DefaultValue only compatible with @QueryParameter?
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39614940
score: 6
upvote count: 6

http://stackoverflow.com/comment/39839257
type: AnswerComment
comment on: http://stackoverflow.com/a/25505129
score: 0
has text: @sndyuk sorry, but I can't use your solution.. The properties are already loaded, included in root XML context. Can't be moved also..
type: Comment

rendering
tags question: http://stackoverflow.com/q/25435823
tag name: rendering
type: Tag

http://stackoverflow.com/a/25539186
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25539144
type: Answer
has body: You need java in order to compile your java programs. You need the javac file in you bin folder within java to successfully compile them. Hope this helps!
score: 2

http://stackoverflow.com/a/25410880
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25410012
score: 1
has body: Without Generics I am not sure you will be able to achieve what you target. Depending on how tied you are to this 3rd party library, you could try and design around it. Pass in a wrapper object. If you have control over the constructor and implementation of the GenericObjectBuilder you could pass in a wrapper object. GenericObjectResult&lt;String&gt; result = new GenericObjectResult&lt;&gt;(String.class); GenericObjectBuilder builder = new GenericObjectBuilder(result); builder.build(); String object = result.getObject(); This is quite ugly but might as well get you going. Have only the getObject method generic. You should be able to have the following implementation. GenericObjectBuilder builder = new GenericObjectBuilder(); String value = builder.getObject(String.class) This last implementation is a bit cleaner but you still need to use generics for the getObject method. The class itself will not be generic, though. Maybe this will be OK with the 3rd party library. Make a wrapper builder This last approach creates a wrapper builder on top of the GenericObjectBuilder. GenericObjectBuilder builder = new GenericObjectBuilder(String.class); // We don't actually care what the constructor is GenericObjectBuilderWrapper wrapper = new GenericObjectBuilderWrapper(builder, String.class); // You could try and get the class from the `builder` if it has the proper API String value = wrapper.getObject(); What the wrapper would do internally, would be something of this kind. class GenericObjectBuilderWrapper&lt;T&gt; { private Class&lt;T&gt; clazz; private GenericObjectBuilder delegate; public GenericObjectBuilderWrapper(GenericObjectBuilder delegate, Class&lt;T&gt; clazz) { this.clazz = clazz; this.delegate = delegate; } public &lt;T&gt; getObject() { final Object value = delegate.getObject(); return clazz.cast(value); } } If you really cannot use any type of generic anywhere in the project because you are using older version of Java, then you will have to rely on explicit casti…
type: Answer

http://stackoverflow.com/a/25521998
upvote count: 16
answers question: http://stackoverflow.com/q/25520220
score: 16
type: Answer
has body: After reading here I could finally apply the workaround. Make sure you give the path till your android-jar in the "Other command line arguments" field viz: -bootclasspath D:\android-studio-.3.2\sdk\platforms\android-19\android.jar do not forget to add "-bootclasspath".
has comment: http://stackoverflow.com/comment/125823455
accepted answer of: http://stackoverflow.com/q/25520220
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/25455319
answers question: http://stackoverflow.com/q/25455253
has body: You should go to NAT section in your router and enable port forwarding, for example public ip:port will be 1.1.1.1:1 NATed to local 2.2.2.2:2, so you start your server on port 2 and connect with your client to 1.1.1.1 port 1.
downvote count: 1
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/39721599
upvote count: 0

http://stackoverflow.com/comment/39726823
comment on: http://stackoverflow.com/q/25457973
score: 0
type: Comment
type: QuestionComment
has text: The name of the class should be GetMealsByDayConnection, see Java naming conventions.

http://stackoverflow.com/q/25438803
tagged with: jtable
tagged with: jxtable
answer count: 2
score: 0
has title: JTable ToolTip as a JComponent or JPanel
tagged with: swing
tagged with: jfreechart
has body: I'm using a JTable (specifically a JXTable) and when I hover over a cell I would like to present some sort of JPanel or Component (to show some graphical data using JFreeChart) I know the JTable has this: http://docs.oracle.com/javase/7/docs/api/javax/swing/JTable.html#getToolTipText(java.awt.event.MouseEvent) but that is obviously just a way to show a textual tooltip. Any ideas or solutions to do this?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25439077
has answer: http://stackoverflow.com/a/25439077
tagged with: java
possible better answer: http://stackoverflow.com/a/25439247
linked to: http://stackoverflow.com/q/7126655
has answer: http://stackoverflow.com/a/25439247
type: Question
has comment: http://stackoverflow.com/comment/39689320
has comment: http://stackoverflow.com/comment/39691311

http://stackoverflow.com/comment/39614433
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25391203
score: 0
has text: have you tried to 'install' inner project first?

http://stackoverflow.com/comment/39824980
type: AnswerComment
score: 0
has text: @Leo and MawrCoffeePls thank you very much for your answers.This helped my issue!
type: Comment
comment on: http://stackoverflow.com/a/25498075

http://stackoverflow.com/q/25439971
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25440596
answer count: 2
has answer: http://stackoverflow.com/a/25440168
tagged with: java
has body: While reading 'Programming Clojure', I noticed that there are alternative ways to perform some operations in Clojure. For example, let's say we need to convert all characters of a string to their upper-case variants. We can use .toUpperCase: user&gt; (.toUpperCase "foo") ;; =&gt; "FOO" As well as clojure.string/upper-case: user&gt; (clojure.string/upper-case "foo") ;; =&gt; "FOO" While clojure.string/upper-case is a function and we can treat it as such: user&gt; (map clojure.string/upper-case ["foo" "bar" "baz"]) ;; =&gt; ("FOO" "BAR" "BAZ") ...we cannot do the same with .toUpperCase: user&gt; (map .toUpperCase ["foo" "bar" "baz"]) CompilerException java.lang.RuntimeException: Unable to resolve symbol... I guess that .toUpperCase is direct call of Java method, and Clojure knows how to deal with this symbol when it is first element of a form. Q: what should I use .toUpperCase or clojure.string/upper-case and what's difference between: (map clojure.string/upper-case ["foo" "bar" "baz"]) and (map (fn [x] (.toUpperCase x)) ["foo" "bar" "baz"])
score: 8
favorite count: 0
type: Question
has title: Library functions vs Java methods in Clojure
upvote count: 8
tagged with: function
downvote count: 0
accepted answer: http://stackoverflow.com/a/25440596
tagged with: clojure
possible better answer: http://stackoverflow.com/a/25440168

http://stackoverflow.com/a/25447673
downvote count: 0
has comment: http://stackoverflow.com/comment/39716927
type: AcceptedAnswer
has body: violates not-null constraint The first part that you're describing is a flaw (#3582), which is related to a previous issue (#2700), which enforced storing null values loaded from POJOs into jOOQ Records for database columns that are NOT NULL. The fix will be in jOOQ 3.5.0, 3.4.3, 3.3.4, and 3.2.7 duplicate key value violates unique constraint "pk_org_person" The second part probably is caused by the fact that you are really loading an existing record and then calling executeInsert() on it (observe the INSERT, which will always execute an INSERT statement). You might want to call executeUpdate(), instead
answers question: http://stackoverflow.com/q/25399183
has comment: http://stackoverflow.com/comment/39716894
type: Answer
has comment: http://stackoverflow.com/comment/39788718
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25399183
score: 2
has comment: http://stackoverflow.com/comment/39766841

http://stackoverflow.com/comment/39682176
score: 0
type: Comment
type: QuestionComment
has text: I feel like I dont quite understand the question, but this is the easiest API ive used for serializing to XML with a POJO type object, if using something other than XStream is an option: http://simple.sourceforge.net/
comment on: http://stackoverflow.com/q/25433862

http://stackoverflow.com/a/25691302
accepted answer of: http://stackoverflow.com/q/25403840
score: 0
answers question: http://stackoverflow.com/q/25403840
type: Answer
has body: At this time, it does not appear to be possible to do what I want to do. My current solution is to use a custom content handler (per my question above) and run its results through a standard XSLT identity transformation. A bit ugly and not very efficient, but it works.
type: AcceptedAnswer

http://stackoverflow.com/q/25455483
tagged with: java
downvote count: 2
answer count: 1
tagged with: loops
has answer: http://stackoverflow.com/a/25456321
has comment: http://stackoverflow.com/comment/39721632
favorite count: 0
type: Question
has body: I have a program that requires two classes. The player-Names class, and the Player-Model class. I want the player-Names class to repaint every half second, and the Player-Model class to repaint 60 times per second because i want the movement to be smooth. The problem that i am having is that i want all of this to be done on one J-frame. How would i go about doing this? If you could lead me in the right direction or give me a little example that would be great! Thank you :). for some reason it wont let me post so i'm going to put in some random code import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import javax.swing.JComponent; import javax.swing.JFrame; public class PlayerNames extends JFrame { static int connectionTimer = 0; static int connectionTimer2 = 0; static int reconnect = 0; static int reconnectValue = 1; static int x = 0; static int reconnectWait = connectionTimer + reconnectValue; private static final long serialVersionUID = 1L; public graph gg = new graph(); public graph g = new graph(); private static GameClient socketClient; private GameServer socketServer; public static void main(int width, int height) { PlayerNames tt = new PlayerNames(); // PlayerGraphics t = new PlayerGraphics(); tt.setSize(width, height); if (Game.ServerOwner == 1) { tt.setTitle("Server: " + Game.username); } else { tt.setTitle("Username: " + Game.username); } tt.setVisible(true); tt.getContentPane().add(tt.gg); tt.getContentPane().add(tt.g); tt.setDefaultCloseOperation(EXIT_ON_CLOSE); tt.setResizable(false); }
tagged with: jframe
score: -2
tagged with: drawing
has title: Two loops speeds drawing in a Jframe
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25405469
possible better answer: http://stackoverflow.com/a/25405556
tagged with: java
has comment: http://stackoverflow.com/comment/39627179
has answer: http://stackoverflow.com/a/25405556
has comment: http://stackoverflow.com/comment/39627386
has comment: http://stackoverflow.com/comment/39627546
has comment: http://stackoverflow.com/comment/39627038
has body: How can i return another class instance in my class contractor ? my pseudo code is : class test { private test() {} public static test getInstance() { if(Condition) { return new otherClass(); } else { return new test(); } } }
favorite count: 0
has comment: http://stackoverflow.com/comment/39627440
type: Question
score: 3
has answer: http://stackoverflow.com/a/25405866
accepted answer: http://stackoverflow.com/a/25405866
has comment: http://stackoverflow.com/comment/39627142
has comment: http://stackoverflow.com/comment/39627176
has comment: http://stackoverflow.com/comment/39627072
has comment: http://stackoverflow.com/comment/39627143
type: AnsweredQuestion
upvote count: 3
has title: How to return different types via a singleton instance method
answer count: 2
downvote count: 0

http://stackoverflow.com/q/25465518
has answer: http://stackoverflow.com/a/25466244
has answer: http://stackoverflow.com/a/25465597
answer count: 4
type: Question
has answer: http://stackoverflow.com/a/25465537
has answer: http://stackoverflow.com/a/25465625
type: UnansweredQuestion
has title: Input file to java through command line
upvote count: 1
downvote count: 1
favorite count: 0
score: 0
has body: public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new FileReader("Input.txt")); } I have to give input file through command line java -cp Projectfile.java &lt; Input.txt what change should I do in my program to fetch this file in BufferedReader?
tagged with: java

http://stackoverflow.com/comment/39854127
has text: After defining te following variables: `java.util.Date utilDate = new Date();`, `java.sql.Date sqlDate1 = new java.sql.Date(utilDate.getTime());` and `java.sql.Date sqlDate2 = java.sql.Date.valueOf("2014-08-27");` and binding them to the statement you proposed (`SELECT to_char(?, 'YYYY-MM-DD HH24:MI:SS') testDate FROM dual`), I think I got some more insight in the problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25450452
type: QuestionComment

http://stackoverflow.com/a/25457993
accepted answer of: http://stackoverflow.com/q/25457585
has body: This way still work. FrameLayout layout = (FrameLayout)findViewById(R.id.Frame01); LayoutParams params = layout.getLayoutParams(); int i = 100; params.height = i;
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25457585
type: Answer

http://stackoverflow.com/q/25500690
tagged with: special-characters
type: Question
tagged with: netbeans
score: 0
has title: Comparing words with scandinavian characters
tagged with: equals
has comment: http://stackoverflow.com/comment/39804325
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/388490
has answer: http://stackoverflow.com/a/25500816
has body: My program reads with Scanner class few words from a file and compare them to users output. My editor is NetBeans and OS Windows 7. I first ran the program in NetBeans and had no problems. When I ran it in the command prompt, scandinavian characters (ä, ö, å, Ä, Ö, Å) didn't display correctly. Well, I tested and gave different parameters for Scanner, like ISO-8859-1 but it didn't help. Finally, I gave UTF-8 for it and characters also display well. But I got a new problem. I use equals method to compare two words. But now it doesn't "work". Though the words should be equals method returns false. If I haven't any character set for Scanner the program works well in NetBeans but not in the command prompt. So what can I do and why doesn't equals method work? Should I create my own comparing method or something? public void readingWordsFromFile(String textfile){ try{ File f = new File("WordLists\\" + textfile + ".txt" ); Scanner l = new Scanner(f, "UTF-8"); try{ int i = 1; while( l.hasNext() ){ String temp = l.nextLine(); words.put(i, temp); i++; } } catch (Exception e){ } finally{ l.close(); } } catch (Exception e){ } } Edit: "Solved". The answer doesn't relate to character sets. Files contained BOM because I had accidentally saved them with Notepad. So now I use again Notepad++ and everything is fine. : )
answer count: 3
has answer: http://stackoverflow.com/a/25500972
has comment: http://stackoverflow.com/comment/39804327
has comment: http://stackoverflow.com/comment/39804391
tagged with: java
has answer: http://stackoverflow.com/a/25500805
has comment: http://stackoverflow.com/comment/39804705

http://stackoverflow.com/comment/39653926
comment on: http://stackoverflow.com/q/25408154
type: Comment
score: 1
type: QuestionComment
has text: `em.createQuery(criteria).getResultList()` is a List<String>. If you call `toString()` on any object, you get a String, obviously. Don't call toString().

http://stackoverflow.com/comment/39633207
comment on: http://stackoverflow.com/a/25406550
type: Comment
has text: that will cost a lot of instance time for no reason... why not the Push/Pull task queues? or a cron scheduled job to check the whole datastore and delete "old" entities?
score: 0
type: AnswerComment

http://stackoverflow.com/q/25427975
tagged with: testng
tagged with: selenium-webdriver
has body: I am currently running my selenium test from the command line using TestNG java -cp \lib\testng.jar; \lib\selenium-server-standalone-2.42.2.jar; \lib\log4j-1.2.17.jar; \bin\. org.testng.TestNG runTest.xml However I would ideally like to use as a command line argument what webdriver to use. Currently in my setUp() it just loads the firefox driver, and changing drivers means commenting and uncommenting out code So as an end goal I could use. -chrome -firefox To run tests on firefox and chrome. What method do you suggest is best to achieve this?
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/26854024
answer count: 1
tagged with: selenium
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
tagged with: testing
tagged with: java
has title: Running selenium tests using TestNG from the command line

http://stackoverflow.com/q/25412722
has title: Splash Screen activity runs twice
has comment: http://stackoverflow.com/comment/39641431
answer count: 1
has comment: http://stackoverflow.com/comment/39642194
tagged with: splash-screen
has body: So basically this is the class that starts at the launch of the app and it shows a splashscreen while getting a serverList from a server, once it has the list, it starts the next activity, the problem is that this activity seems to be getting called twice before the next activity is started, what could be causing that? public class SplashScreen extends Activity { public static DefaultHttpClient httpClient; private String resp; static String res; private String errorMsg; final Context context = this; public static String cookieValue; public static Cookie cookie; String now_playing, earned; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_splash_screen); String Wlcclient = "Yes"; String ClientType = "Android"; String Version = "0.103"; new PrefetchData().execute(Wlcclient,ClientType,Version); } public static String executeHttpPost(String url, ArrayList&lt;NameValuePair&gt; postParameters) throws Exception { BufferedReader in = null; try { SplashScreen.httpClient = new DefaultHttpClient(); HttpPost request = new HttpPost(url); UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(postParameters); request.setEntity(formEntity); HttpResponse response = SplashScreen.httpClient.execute(request); List&lt;Cookie&gt; cookies = SplashScreen.httpClient.getCookieStore().getCookies(); cookie = cookies.get(0); cookieValue = "ASPSESSIONIDCQTCRACT=" + cookie.getValue(); System.out.println("COOK" + cookieValue); Header[] headers = response.getAllHeaders(); System.out.println("length" + headers.length); for (int i=0; i &lt; headers.length; i++) { Header h = headers[i]; System.out.println( "Header names: "+h.getName()); System.out.println( "Header Value: "+h.getValue()); } CookieManager cookieManager = CookieManager.getInstance(); in = new BufferedReader(new InputStreamReader(response.g…
type: Question
has comment: http://stackoverflow.com/comment/39641637
linked to: http://stackoverflow.com/q/7084695
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39641603
tagged with: android
has answer: http://stackoverflow.com/a/67504335
has comment: http://stackoverflow.com/comment/39641838
has comment: http://stackoverflow.com/comment/39641573
score: 0
tagged with: http-post
tagged with: java

http://stackoverflow.com/q/25513019
tagged with: equals
has comment: http://stackoverflow.com/comment/39831368
has comment: http://stackoverflow.com/comment/39833708
has comment: http://stackoverflow.com/comment/39827801
has comment: http://stackoverflow.com/comment/39827851
has comment: http://stackoverflow.com/comment/39858073
accepted answer: http://stackoverflow.com/a/25530064
has comment: http://stackoverflow.com/comment/39828097
upvote count: 16
linked to: http://stackoverflow.com/q/15518731
score: 16
has comment: http://stackoverflow.com/comment/39831440
has answer: http://stackoverflow.com/a/25530064
has comment: http://stackoverflow.com/comment/39829039
has comment: http://stackoverflow.com/comment/39827862
has comment: http://stackoverflow.com/comment/39827923
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39838912
has title: String.equalsIgnoreCase - UpperCase v. LowerCase
has comment: http://stackoverflow.com/comment/39831433
has comment: http://stackoverflow.com/comment/39856361
has comment: http://stackoverflow.com/comment/39827830
tagged with: java
has body: I was browsing through the openjdk and noticed a weird code path in String.equalsIgnoreCase, specifically the method regionMatches: if (ignoreCase) { // If characters don't match but case may be ignored, // try converting both characters to uppercase. // If the results match, then the comparison scan should // continue. char u1 = Character.toUpperCase(c1); char u2 = Character.toUpperCase(c2); if (u1 == u2) { continue; } // Unfortunately, conversion to uppercase does not work properly // for the Georgian alphabet, which has strange rules about case // conversion. So we need to make one last check before // exiting. if (Character.toLowerCase(u1) == Character.toLowerCase(u2)) { continue; } } I understand the comment about adjusting for a specific alphabet to check the lower case equality, but was wondering why even have the upper case check? Why not just do all lower case?
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39829416
has comment: http://stackoverflow.com/comment/39828008

http://stackoverflow.com/comment/39808383
type: Comment
has text: build-helper-maven-plugin
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25502424

http://stackoverflow.com/q/25463427
has comment: http://stackoverflow.com/comment/39735912
tagged with: jsp
has answer: http://stackoverflow.com/a/25463481
possible better answer: http://stackoverflow.com/a/25463481
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25463498
has comment: http://stackoverflow.com/comment/39735514
tagged with: javascript
has answer: http://stackoverflow.com/a/25463493
tagged with: servlets
has comment: http://stackoverflow.com/comment/39735705
score: 0
has answer: http://stackoverflow.com/a/25463498
has title: can not perform form validation
answer count: 3
has body: I tried performing form validation on a registration form in jsp using javascript. I am not able to do it. The page, despite the fields being blank, is directed to next page on clicking the submit button. And strangely, the blank data is entered in the database(row is added with blank entries). Shop Online ShopOnline Home LOGIN REGISTER PRODUCTS CONTACT US <% Class.forName("oracle.jdbc.OracleDriver"); Connection con=DriverManager.getConnection ("jdbc:oracle:thin:@127.0.0.1:1521:xe","system","manhattan"); PreparedStatement ps=con.prepareStatement("select *from uinfo"); ResultSet rs=ps.executeQuery(); int n=0; while(rs.next()) { n=rs.getInt("lid"); } n++; //out.println(n); con.close(); %> REGISTRATION FORM First Name Last Name Address City Mobile No Email Login id <%=n %> Password
tagged with: java

http://stackoverflow.com/a/25528890
score: 9
has comment: http://stackoverflow.com/comment/75055474
downvote count: 0
has body: I would suggest that you only use the constructor where possible. There is one very very good reason to do so: testing When you are going to unit test a Spring bean, you'll want to be able to construct the class with minimum fuss. That means that you should only need to call the constructor, and not have to deal with calling various life-cycle methods on your own. The last thing you want when creating the class to be tested, is to have to know how the object is property initialized. With Spring's constructor injection support you can easily inject other other beans or project properties into the constructor therefor being able to cover almost every scenario.
has comment: http://stackoverflow.com/comment/39856772
upvote count: 9
type: Answer
answers question: http://stackoverflow.com/q/25528775

http://stackoverflow.com/a/25501843
upvote count: 4
answers question: http://stackoverflow.com/q/25501818
has body: No. It means a = a | b, where | is bitwise OR a || b is logical OR where a and b should evaluate to boolean Edit: If a and b are booleans, then a | b and a || b leads to same result
type: Answer
has comment: http://stackoverflow.com/comment/39806497
score: 3
has comment: http://stackoverflow.com/comment/39806923
downvote count: 1

http://stackoverflow.com/comment/54916228
has text: In idea 13, the "cache" directory is now "caches" - removing everything in there still works.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26739909
type: AnswerComment

http://stackoverflow.com/a/25396648
downvote count: 0
has comment: http://stackoverflow.com/comment/39674494
answers question: http://stackoverflow.com/q/25395933
has comment: http://stackoverflow.com/comment/39612922
has body: Try the below code ZipFile zipFile = new ZipFile("myzip.zip"); // Get the list of file headers from the zip file List fileHeaderList = zipFile.getFileHeaders(); // Loop through the file headers for (int i = 0; i &lt; fileHeaderList.size(); i++) { FileHeader fileHeader = (FileHeader)fileHeaderList.get(i); String fileName = fileHeader.getFileName(); if(fileName.contains(".java")){ zipFile.extractFile(fileHeader, "c:\\scrap\\"); } }
has comment: http://stackoverflow.com/comment/39619566
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/q/25465989
favorite count: 0
type: Question
tagged with: oracle-sqldeveloper
type: UnansweredQuestion
has body: I am seeking help with the subject error I received when trying to connect to a 2012 SSMS Express database through Oracle Developer Data Modeler. Connection settings in Oracle are: JDBC URL: jdbc:sqlserver://localhost;integratedSecurity=true;authenticationScheme=JavaKerberos Driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver I have put sqljdbc_auth.dll in the following directories with no success: C:\Oracle Data Modeler\datamodeler\datamodeler\bin C:\Program Files (x86)\Java\jre7\bin (64-bit put here) C:\Windows\System32 Can anyone offer any guidance? All files are on my local laptop, which is 64-bit processor running Windows 7 32-bit. The same error resulted when adding the additional property of serverName. Thank you for any ideas.
has title: Integrated authentication failed on JDBC connection to SQLEXPRESS with Windows authentication
tagged with: jdbc
tagged with: sql-server-2012
answer count: 0
score: 1
tagged with: java
tagged with: connection-string
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25470137
tagged with: web
has comment: http://stackoverflow.com/comment/39747902
has title: eclipse android load text from url
linked to: http://stackoverflow.com/q/6343166
has comment: http://stackoverflow.com/comment/39747891
type: Question
accepted answer: http://stackoverflow.com/a/25470514
has answer: http://stackoverflow.com/a/25470514
has comment: http://stackoverflow.com/comment/39747967
duplicate of: http://stackoverflow.com/q/6343166
tagged with: android
has comment: http://stackoverflow.com/comment/39747938
has comment: http://stackoverflow.com/comment/39747812
has body: I try to load a text file in a string. So I searched in google an found an example code: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class AndroidInternetTxt extends Activity { TextView textMsg, textPrompt; final String textSource = "http://sites.google.com/site/androidersite/text.txt"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); textPrompt = (TextView)findViewById(R.id.textprompt); textMsg = (TextView)findViewById(R.id.textmsg); textPrompt.setText("Wait..."); URL textUrl; try { textUrl = new URL(textSource); BufferedReader bufferReader = new BufferedReader(new InputStreamReader(textUrl.openStream())); String StringBuffer; String stringText = ""; while ((StringBuffer = bufferReader.readLine()) != null) { stringText += StringBuffer; } bufferReader.close(); textMsg.setText(stringText); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); textMsg.setText(e.toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); textMsg.setText(e.toString()); } textPrompt.setText("Finished!"); } } I put it in my project now it looks so: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.entity.BufferedHttpEntity; import org.apache.http.impl.client.DefaultHttpClient; import net.sourceforge.zbar.Config; import net.sourceforge.zbar.Image; import net.sourceforge.zbar.ImageScanner; import net.sourceforge.zbar.Symbol; i…
tagged with: eclipse
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39747830
has comment: http://stackoverflow.com/comment/39747725
tagged with: java
answer count: 1
tagged with: url

http://stackoverflow.com/q/25507434
tagged with: c++
has comment: http://stackoverflow.com/comment/39817348
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39817765
has title: Dummy email address and Email parser
score: 0
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/34199157
answer count: 1
tagged with: email
tagged with: parsing
has body: If you're not interested in helping a beginner in email parsing, don't read further. I have been programming for a while so I know the gist of things. But, I'm really interested in creating a dummy email address and then set up a parsing program inside of it (if thats even how you do it) Scenario: I have an email account which receives certain emails which need parsing. I want to be able to forward those emails to a "dummy" email address which is basically just a program which parses the email for sender, subject, and message. I would prefer to write a runnable jar program or something on windows but I'm willing to do web programming if need be. Android programming is also an option for me. What would I do to get started? I'm not asking for anyone to write out everything, I just need a starting point for all of this. Thanks!
type: Question

http://stackoverflow.com/comment/39827145
type: Comment
score: 0
has text: Sorry, maybe I wrote the things not too clearly. Now I found the solution, it is: private static class Matcher extends ArgumentMatcher { public boolean matches(Subject sub) { return sub.getName().equals("Math") && sub.getComplexity() == 10; } }
type: QuestionComment
comment on: http://stackoverflow.com/q/25510847

http://stackoverflow.com/a/25460132
score: 2
answers question: http://stackoverflow.com/q/25459933
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25459933
has body: I've read some things where my declarations should not depend on what was written above, and should be able to be moved around randomly and still function. This sounds like it is arguing for loose coupling. This is good generally. Example, this TouchPad class can only be used to move a Player: public class TouchPad { public TouchPad(Player player) { } } Where as this TouchPad can can control any object that's class implements Controllable. public interface Controllable { void move(int x, int y); } public class TouchPad { public TouchPad(Controllable player) { } } public class Player implements Controllable { This is cleaner as it limits the functionality of Player available to TouchPad. And TouchPad doesn't know it is controlling a Player. You can take two approaches, write the code first and then "refactor" it so that it is looser, or start your approach looser. You tend to do the former by default with experience and when doing unit tests/test driven developement.
has comment: http://stackoverflow.com/comment/39729332
upvote count: 2
type: Answer

http://stackoverflow.com/a/25461823
has comment: http://stackoverflow.com/comment/39732699
has comment: http://stackoverflow.com/comment/39733209
type: Answer
answers question: http://stackoverflow.com/q/25461691
has comment: http://stackoverflow.com/comment/39734360
has comment: http://stackoverflow.com/comment/39732647
score: 2
has body: Using a single instance of of class is not what makes the singleton pattern problematic. Being unable to extend it is not problematic either. What is problematic is the way this single instance is obtained: it couples every class using the singleton to this concrete class it makes it basically impossible to unit test every class using the singleton, because there is no way to replace this unique Singleton instance by a mock instance. A much better way to achieve what you want is to pass the singleton to the objects which need it. That is called dependency injection: public class AdminConsole implements PriceProvider { @Override public Map&lt;String, Integer&gt; getPriceMap() { ... } ... } public class SomeClassWhichNeedsThePrices { private PriceProvider priceProvider; public SomeClassWhichNeedsThePrices(PriceProvider priceProvider) { this.priceProvider = priceProvider; } } ... public static void main(String[] args) { AdminConsole console = new AdminConsole(); console.initialize(); // read the prices once SomeClassWhichNeedsThePrice sc = new SomeClassWhichNeedsThePrice(console); ... } Now, to unit-test the class SomeClassWhichNeedsThePrice, you can simply pass it a fake PriceProvider, without needing a real AdminConsole at all: PriceProvider fakePriceProvider = new PriceProvider() { @Override public Map&lt;String, Integer&gt; getPriceMap() { Map&lt;String, Integer&gt; fakePrices = new HashMap&lt;&gt;(); fakePrices.put("Coke", 2); return fakePrices; } }; // you could also use a mocking framework like Mockito SomeClassWhichNeedsThePrice sc = new SomeClassWhichNeedsThePrice(fakePriceProvider); assertThat(sc.computePriceForThreeCokes()).toBe(6);
downvote count: 0
has comment: http://stackoverflow.com/comment/39735109
upvote count: 2

http://stackoverflow.com/comment/39708558
has text: This might help you http://stackoverflow.com/questions/16683877/form-action-sampleservlet-giving-me-exception
type: QuestionComment
comment on: http://stackoverflow.com/q/25449130
type: Comment
score: 0

jsoup
tags question: http://stackoverflow.com/q/25524032
type: Tag
tags question: http://stackoverflow.com/q/25550616
tag name: jsoup
tags question: http://stackoverflow.com/q/25483061
tags question: http://stackoverflow.com/q/25420743
tags question: http://stackoverflow.com/q/25549413
tags question: http://stackoverflow.com/q/25466527
tags question: http://stackoverflow.com/q/25472391
tags question: http://stackoverflow.com/q/25391685
tags question: http://stackoverflow.com/q/25494544
tags question: http://stackoverflow.com/q/25421409
tags question: http://stackoverflow.com/q/25400403
tags question: http://stackoverflow.com/q/25471758
tags question: http://stackoverflow.com/q/25400841
tags question: http://stackoverflow.com/q/25411529
tags question: http://stackoverflow.com/q/25491424
tags question: http://stackoverflow.com/q/25461462
tags question: http://stackoverflow.com/q/25450822
tags question: http://stackoverflow.com/q/25517353
tags question: http://stackoverflow.com/q/25440375
tags question: http://stackoverflow.com/q/25526319
tags question: http://stackoverflow.com/q/25472770

http://stackoverflow.com/a/25509442
accepted answer of: http://stackoverflow.com/q/25508024
upvote count: 5
score: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25508024
has body: This could be for two reasons: Java execute a system/exec C routine, which except a binary. test.sh is not a binary. You should probably use bash: bash -f scripts/test.sh -> new ProcessBuilder()("bash", "-f", new File("scripts/test.sh").getAbsoluteFile()); The file scripts/test.sh does not exists, meaning the current directory is not good. You can try System.out.println(new File("scripts/test.sh").getAbsoluteFile()) to print the path Java is using.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/68042568
has comment: http://stackoverflow.com/comment/68042600
has comment: http://stackoverflow.com/comment/68042482

http://stackoverflow.com/comment/39632549
has text: @Xerath Updated my post. You can optimize the conditions as your way.
type: Comment
comment on: http://stackoverflow.com/q/25406887
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39694412
score: 0
type: QuestionComment
has text: I'm not sure I understand the question. Do you want the HashMap to use fewer buckets when entries are deleted? Why do you care?
comment on: http://stackoverflow.com/q/25441723
type: Comment

http://stackoverflow.com/q/25521046
type: UnansweredQuestion
tagged with: multithreading
tagged with: threadpool
has comment: http://stackoverflow.com/comment/39879312
has title: How to use preexisting runnables, limiting the number of runnables to create.?
has comment: http://stackoverflow.com/comment/39843134
score: 0
has comment: http://stackoverflow.com/comment/39855775
has comment: http://stackoverflow.com/comment/39842595
has comment: http://stackoverflow.com/comment/39848338
has comment: http://stackoverflow.com/comment/39847637
has comment: http://stackoverflow.com/comment/39886616
tagged with: java
has answer: http://stackoverflow.com/a/25524645
tagged with: runnable
answer count: 1
has comment: http://stackoverflow.com/comment/39848429
tagged with: executorservice
has comment: http://stackoverflow.com/comment/39845039
type: Question
linked to: http://stackoverflow.com/q/20396948
has comment: http://stackoverflow.com/comment/39847579
has body: Problem Statement: I have a 5000 id's that point to rows in a database.[ Could be more than 5000 ] Each Runnable retrieves the row in a database given an id and performs some time consuming tasks public class BORunnable implements Callable&lt;Properties&gt;{ public BORunnable(String branchID) { this.branchID=branchID; } public setBranchId(String branchID){ this.branchID=branchID; } public Properties call(){ //Get the branchID //Do some time consuming tasks. Merely takes 1 sec to complete return propObj; } } I am going to submit these runnables to the executor service. For that, I need to create and submit 5000 or even more runnables to the executor service. This creation of runnables, in my environment could throw out of memory exception. [given that 5000 is just an example] So I came up with a approach, I would be thankful if you provide anything different: Created a thread pool of fixed size 10. int corePoolSize = 10; ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize, corePoolSize + 5, 10, TimeUnit.SECONDS, new LinkedBlockingQueue&lt;Runnable&gt;()); Collection&lt;Future&lt;Properties&gt;&gt; futuresCollection = new LinkedList&lt;Future&lt;Properties&gt;&gt;(); Added all of the branchIDs to the branchIdQueue Queue&lt;String&gt; branchIdQueue = new LinkedList&lt;String&gt;(); Collections.addAll(branchIdQueue, branchIDs); I am trying to reuse runnable. Created a bunch of runnable Now i want this number of elements to be dequeued and create runnable for each int noOfElementsToDequeue = Math.min(corePoolSize, branchIdQueue.size()); ArrayList&lt;BORunnable&gt;runnablesList = dequeueAndSubmitRunnable( branchIdQueue,noOfElementsToDequeue); ArrayList&lt;BORunnable&gt; dequeueAndSubmitRunnable(branchIdQueue, noOFElementsToDequeue){ ArrayList&lt;BORunnable&gt; runnablesList= new ArrayList&lt;BORunnable&gt;(); for (int i = 0; i &lt; noOfElementsToDequeue; i++) { //Create this number of runnables runnablesList.add(new BORunnable(branchIdQueue.remove())); } ret…
has comment: http://stackoverflow.com/comment/39845114
has comment: http://stackoverflow.com/comment/39879269

http://stackoverflow.com/q/25487707
type: UnansweredQuestion
has body: Currently I am trying to figure out the best way to retrieve and save data. I am working on a spring batch program with masters and slaves, and I was iterating through some data and saving into a hashmap. Originally I was just saving data into a hashmap, thinking I would never need it again, but it turns out I will need some of it in a later step. It would be nice if I could just simply replace this hashmap with a namedcache. And use it in the step I created it in, and the following steps as well. However i'm worried it will cause excess overhead. Should I keep the hashmap, and eventually iterate it into the cache for using later? Or should I just simply replace this hashmap with a namedcache?
answer count: 1
tagged with: oracle-coherence
tagged with: spring-batch
tagged with: hashmap
tagged with: java
has answer: http://stackoverflow.com/a/25488384
tagged with: caching
has title: Using a Coherence NamedCache -- How much overhead is there?
type: Question
score: 0

http://stackoverflow.com/q/25474075
has answer: http://stackoverflow.com/a/25476355
possible better answer: http://stackoverflow.com/a/48425668
type: Question
has title: Executable jar with libgdx: asset not found
has body: I created a little Game using the libgdx libraries and exported it to an executable jar. In Eclipse the Game works fine but the jar crashes with: PS E:\Workspaces\JavaGames\Executable Jars&gt; java -jar Pk2.jar SetToNewScreen called Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: img/player/player_16_down.png at com.badlogic.gdx.graphics.Pixmap.&lt;init&gt;(Pixmap.java:140) at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64) at com.badlogic.gdx.graphics.Texture.load(Texture.java:130) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:121) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:100) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:92) at org.hofrob.entities.Player.&lt;init&gt;(Player.java:29) at org.hofrob.screens.misc.Play.show(Play.java:121) at com.badlogic.gdx.Game.setScreen(Game.java:61) at org.hofrob.screens.Screenmanager.setToNewScreen(Screenmanager.java:63) at org.hofrob.pkgame.MyPkGame.create(MyPkGame.java:20) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: img\player\player_16_down.png (Internal) at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136) at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:220) at com.badlogic.gdx.graphics.Pixmap.&lt;init&gt;(Pixmap.java:137) ... 12 more The problematic line is: private final Sprite player_down = new Sprite(new Texture("img/player/player_16_down.png")); I followed the libgdx wiki to create the jar. The assets folder is included in the build path and the content of the assets folder is in the exported jar: /com /img /javazoom /META_INF /net /org /tiles ... I also tried using Gdx.files.internal (also, removing final) private final Sprite player_down = new Sprite(new …
has answer: http://stackoverflow.com/a/48425668
upvote count: 3
linked to: http://stackoverflow.com/q/25305191
downvote count: 0
has comment: http://stackoverflow.com/comment/39756499
tagged with: executable-jar
favorite count: 0
tagged with: gradle-eclipse
has comment: http://stackoverflow.com/comment/39756331
type: AnsweredQuestion
answer count: 3
tagged with: libgdx
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25476311
tagged with: eclipse
has answer: http://stackoverflow.com/a/25476311

http://stackoverflow.com/comment/132066127
type: Comment
comment on: http://stackoverflow.com/a/36192138
type: AnswerComment
has text: You'll need to import org.apache.commons.lang3.ArrayUtils;
score: 0

http://stackoverflow.com/comment/39726525
type: AnswerComment
comment on: http://stackoverflow.com/a/25458023
score: 0
type: Comment
has text: but my problem is with adding the arguments to it i saw a couple of codes around the net with different approaches i want to now the simple code snippet for these special arguments here like -u --verbose,etc

http://stackoverflow.com/comment/70758337
score: 0
type: Comment
has text: @vach Care to teach us here how to write to shared memory accessible to different `processes` via `pure java` ? If not then lose the attitude.
type: AnswerComment
comment on: http://stackoverflow.com/a/25396866

http://stackoverflow.com/a/25477704
downvote count: 0
upvote count: 1
has body: From the error messages that I did not read well enough: Exception in thread "main" java.sql.SQLException: Table/View 'AUDIO_LIST' already exists in Schema 'APP'. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source) at DatabaseInit.main(DatabaseInit.java:48) When using Derby's embedded driver, if the database you want to create is created without a username- the default schema used is "APP". I added a user name to the DB creation. The DB is "created" but the scheme is somehow my username.
type: Answer
answers question: http://stackoverflow.com/q/25477341
score: 1

http://stackoverflow.com/a/25428675
accepted answer of: http://stackoverflow.com/q/25428651
type: Answer
answers question: http://stackoverflow.com/q/25428651
score: 0
type: AcceptedAnswer
upvote count: 1
downvote count: 1
has body: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txtDisplay = (TextView) findViewById(R.id.txtDisplay); txtDisplay.setText("0"); } public void shownum(String num) { if (clear_flag == 1) { txtDisplay.setText(""); clear_flag = 0; } else if (txtDisplay.getText() == "0") { txtDisplay.setText(""); } Integer lCurrentValue = Integer.valueOf(txtDisplay.getText().toString()); Integer lNewValue = Integer.valueOf(num); txtDisplay.setText(lCurrentValue+lNewValue); }

http://stackoverflow.com/comment/39791288
type: QuestionComment
has text: Please provide attempt.
comment on: http://stackoverflow.com/q/25493468
score: 1
type: Comment

http://stackoverflow.com/comment/39697083
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25443173
has text: Since Java 1.5 the problem of singletons implementation has been solved with enums: http://stackoverflow.com/a/8027815/32090

http://stackoverflow.com/comment/79056407
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25420598
has text: have you resolve this issue? I am facing the same issue. Please share your solution.

http://stackoverflow.com/q/25445500
answer count: 2
has body: I Want to do something like this with JasperReports if (sum(columns) == NULL) Write 0 ELSE Write Sum(Colones) I can do it with other columns when the type is java.lang.String ($V{Adress}==null?"":$V{Adress}+"") //work and show blank "" The problem is when the type is java.math.BigDecimal ($V{Sum_TAgraf}==null?:0,OO) //here its not working i want to show me 0 not Null
has answer: http://stackoverflow.com/a/25445710
has title: Test Null with JasperReports
accepted answer: http://stackoverflow.com/a/25445710
type: AnsweredQuestion
score: 0
tagged with: if-statement
tagged with: java
tagged with: ternary-operator
possible better answer: http://stackoverflow.com/a/25447705
has comment: http://stackoverflow.com/comment/39701288
has answer: http://stackoverflow.com/a/25447705
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/39701334

http://stackoverflow.com/a/25417631
answers question: http://stackoverflow.com/q/25417602
type: Answer
accepted answer of: http://stackoverflow.com/q/25417602
has body: You're printing out the DateFormat object -- don't do that! You need to use that DateFormat object to parse a String to a Date or format the date to a String and then print the String returned. Please look at the API for DateFormat and SimpleDateFormat to learn about the parse and format methods. You would need two SimpleDateFormat objects: One to be used to convert Strings in the first format into a Date. You would do by calling the format's parse(String s) method. And the other SimpleDateFormat would be used to format the Date into a String of the second type: You do this by calling the format's format(Date d) method. Then simply print out this String returned. You should never try to print the DateFormat object itself as that makes no sense.
type: AcceptedAnswer
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/q/25514807
downvote count: 1
has comment: http://stackoverflow.com/comment/39831317
favorite count: 0
type: AnsweredQuestion
has title: Yahoo Weather with JSON and Java
has body: I want to create a software (with Java SE and JSON) to display information about Yahoo's forecast. I get the information here (JSON format): Are there guides, articles, blogs, ... with example for my software? I see the Yahoo Centre but is deprecrate (from 2007) and I can't find a valid guide! Thanks! :-)
has comment: http://stackoverflow.com/comment/39831293
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
type: Question
has answer: http://stackoverflow.com/a/25515054
upvote count: 0
tagged with: yahoo-weather-api
answer count: 1
accepted answer: http://stackoverflow.com/a/25515054

http://stackoverflow.com/comment/39773910
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25484547
score: 4
has text: `unique_schemas` key is a `HashMap<Integer,String>`, and you are comparing it between `mapkey.get(0)` which is a `String`.

http://stackoverflow.com/a/25475762
has comment: http://stackoverflow.com/comment/39765190
score: 2
has comment: http://stackoverflow.com/comment/39764965
has comment: http://stackoverflow.com/comment/39767617
downvote count: 0
has body: A decorator is simply a wrapper. The "wrapping" of an action (method) allows you to "intervene" the action by applying all sort of things before/after it takes place. That in mind, let's take your first example and modify it to implement the decorator pattern (we can apply different implementations). Using inheritance: public class Logger { void log(String msg){ System.out.println("msg = " + msg); }; } public class BasicLogger extends Logger { @Override public void log(String msg) { System.out.println("BasicLogger - before logging: " + msg); super.log(msg); System.out.println("BasicLogger - after logging: " + msg); } } Using composition: public class Logger { void log(String msg){ System.out.println("msg = " + msg); }; } public class BasicLogger { Logger logger; public BasicLogger(Logger logger) { this.logger = logger; } public void log(String msg) { System.out.println("BasicLogger - before logging: " + msg); logger.log(msg); System.out.println("BasicLogger - after logging: " + msg); } }
answers question: http://stackoverflow.com/q/25474912
has comment: http://stackoverflow.com/comment/39767394
has comment: http://stackoverflow.com/comment/39768318
upvote count: 2
has comment: http://stackoverflow.com/comment/39767265
type: Answer

http://stackoverflow.com/comment/39643007
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25403122
has text: This is not true. HotSpot JIT is happy to optimize empty loops out when it can. C2 compiler (aka "server VM") can and does it. The second test case exits immediately on x64 JDK. But it seems that OP is running the test on C1 (aka "client VM") - this compiler is just not smart enough to remove an empty loop.
type: AnswerComment

http://stackoverflow.com/a/25445201
answers question: http://stackoverflow.com/q/25423855
type: Answer
has comment: http://stackoverflow.com/comment/39701721
score: 0
has body: You are using two time executeUpdate(); delete execute which one is in if case public int addPrivilege(String privilege) { PreparedStatement preparedStatement = null; String sqlprivilege; Connection dbConnection = null; int pinsert = 0; try { sqlprivilege = "insert into privilege(privilege) values(?)"; dbConnection = ConnectionDao.getDBConnection(); preparedStatement = dbConnection.prepareStatement(sqlprivilege); preparedStatement.setString(1, privilege); pinsert = preparedStatement.executeUpdate(); //try this if(pinsert ==1) pinsert=1; else pinsert=0; System.out.println("privilege is add and name is:- " +privilege); } catch (SQLException e) { System.out.println(e.getMessage()); } finally { if (preparedStatement != null) { try { preparedStatement.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (dbConnection != null) { try { dbConnection.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return pinsert; }

http://stackoverflow.com/comment/39889303
comment on: http://stackoverflow.com/a/25547079
score: 0
type: AnswerComment
has text: This breaks the code: OP is iteratively applying interpolation to the same array. You'd need a copy of the previous array.
type: Comment

http://stackoverflow.com/comment/39670268
comment on: http://stackoverflow.com/q/25428573
score: 1
type: QuestionComment
has text: Why do you want to do this? Feels a little like an XY problem.
type: Comment

http://stackoverflow.com/comment/39733407
comment on: http://stackoverflow.com/q/25462354
has text: What kind of fields do you add for debug purposes?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25420780
has comment: http://stackoverflow.com/comment/39655944
accepted answer: http://stackoverflow.com/a/51552923
upvote count: 1
tagged with: plugins
has comment: http://stackoverflow.com/comment/39655997
has body: I am writting a plugin that has to open a file at a certain line when a button is pressed. I have the following code to open the file at a certain line. String filePath = "file path" ; final IFile inputFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(Path.fromOSString(filePath)); if (inputFile != null) { IWorkbenchPage page1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IEditorPart openEditor11 = IDE.openEditor(page1, inputFile); } int Line = 20; if (openEditor11 instanceof ITextEditor) { ITextEditor textEditor = (ITextEditor) openEditor ; IDocument document= textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); textEditor.selectAndReveal(document.getLineOffset(Line - 1), document.getLineLength(Line-1)); } My problem is that the variable openEditor11 in the if statement gives the error: openEditor11 cannot be resolved to a variable. What can be the problem ?
has comment: http://stackoverflow.com/comment/39656144
possible better answer: http://stackoverflow.com/a/25420882
has comment: http://stackoverflow.com/comment/39656366
type: AnsweredQuestion
tagged with: java
has title: Open file to a certain line in Eclipse plugin
downvote count: 0
score: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39656107
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/39655624
favorite count: 0
has answer: http://stackoverflow.com/a/51552923
type: Question
has answer: http://stackoverflow.com/a/25420882
answer count: 2

http://stackoverflow.com/comment/39808842
has text: I put the serial port params before getting the output stream. Still not working. But thanks for the observation
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25502517
type: Comment

http://stackoverflow.com/comment/100263999
type: QuestionComment
comment on: http://stackoverflow.com/q/25482151
has text: @JoshuaD but lock comes before the try-block.
score: 0
type: Comment

http://stackoverflow.com/comment/39655703
type: Comment
score: 0
type: AnswerComment
has text: Hi. Thanks for your response! I am considering segregating my class files based off platform and just doing dependency injections when required as you said. You said " I really against preprocessing", why is that out of curiosity? Many thanks
comment on: http://stackoverflow.com/a/25420476

http://stackoverflow.com/a/26603569
answers question: http://stackoverflow.com/q/25480619
score: 1
type: Answer
has body: eC has a runtime reflection model which is aware of the layout of all classes, and distinguishes between struct (always allocated in place) and classes (classes are always allocated on the heap, by the runtime mechanism aware of the class layouts). The idea behind this is that small objects that may be numerous and/or contiguous (e.g. a Point) are better suited for a struct, whereas more complex object that will require memory management are better suited for a class. This can also allow swapping libraries with identical interface but completely different layout. The need for C++ 'pimpl' is just one of those things I could not stand about C++ (another one being header files) which had me design eC, after being dissatisfied trying to build a C++ class library for Ecere. I've seen C++ code proliferate to 4 different files for API, API header, Implementation, Implementation header with many lines in each instead of simply in eC: public class MyClass { public int myFunction() { } private int myPrivateMember; } Btw eC has a new website :) http://ec-lang.org (still to be improved). And I'm always happy to answer questions and help out on the forums and IRC!
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25520789
answers question: http://stackoverflow.com/q/25497040
score: 0
has body: Although there are many possibly important changes to a class other than its (single) parent, if that's really all you need I wouldn't bother with code, I'd just put both jars on a system with JDK and do: javap -classpath jar1 aclassname |grep extends javap -classpath jar2 aclassname |grep extends # or substitute findstr on unimproved Windows # repeat for multiple classes as desired If you want to look for any change in the "public API", the full javap output is a good start.
type: Answer

http://stackoverflow.com/a/25505833
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25505536
upvote count: 1
has body: If you cannot modify your object (maybe is auto-generated or something) you can achieve your goal through reflection: for(MyObject a: list){ Field[] fields = MyObject.class.getDeclaredFields(); for (Field f : fields) { try { if (f.get(a) instanceof String) { String str = ((String) f.get(a)).replace(".", ""); f.set(a, str); } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } If you don't want to modify the values of your objects you can create The Monster: List&lt;Map&lt;String, String&gt;&gt; monster = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); for(MyObject a: list){ Field[] fields = MyObject.class.getDeclaredFields(); Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); for (Field f : fields) { try { if (f.get(a) instanceof String) { String str = ((String) f.get(a)).replace(".", ""); map.put(f.getName(), str); } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } monster.add(map); } Now you have a beatiful list of maps for fields created through reflection. You can access to prop1 of first object via String obj1prop1 = monster.get(0).get("prop1"); //Value of prop1 for first object in list.
downvote count: 0

http://stackoverflow.com/a/25500535
downvote count: 1
answers question: http://stackoverflow.com/q/25500199
has body: int array[] = {-8,2,0,5,-3,6,0,9}; int minPos = Integer.MAX_VALUE; for (int number : array) { if (number &gt; 0) minPos = Math.min(number, minPos); }
type: Answer
score: 0
upvote count: 1

http://stackoverflow.com/comment/39778251
type: AnswerComment
comment on: http://stackoverflow.com/a/25486443
has text: Thanks a lot, It works, but it only print map and not thing in the map,I mean I have some marker that show path of an object but don't print that path.
score: 0
type: Comment

http://stackoverflow.com/a/25434449
type: Answer
has comment: http://stackoverflow.com/comment/39684325
score: 12
answers question: http://stackoverflow.com/q/25434380
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39681361
accepted answer of: http://stackoverflow.com/q/25434380
has body: If not specified,: primitive bytes, shorts, ints, longs, floats and doubles are initialized to 0 booleans are initialized to false Objects are initialized to null
upvote count: 12

http://stackoverflow.com/comment/39860696
comment on: http://stackoverflow.com/q/25529833
type: QuestionComment
has text: Thanks for the anwser. You have to consider that I cannot consume the WebService directly by JavaScript. It is accessible only by passing through the webapp.
score: 0
type: Comment

http://stackoverflow.com/comment/39673081
type: QuestionComment
comment on: http://stackoverflow.com/q/25429928
score: 0
has text: It should work, I have something similar. Did you clean your project?
type: Comment

http://stackoverflow.com/q/25463005
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25463098
tagged with: grayscale
possible better answer: http://stackoverflow.com/a/25463260
has body: I want to convert an image to a gray scale image where pixel intensities are between 0-255. I was able to convert images to a gray scale images with the following Java method. public void ConvertToGrayScale(BufferedImage bufImage, int ImgWidth, int ImgHeight) { for (int w = 0; w &lt; ImgWidth; w++) { for (int h = 0; h &lt; ImgHeight; h++) { Color color = new Color(bufImage.getRGB(w, h)); int ColAvgVal = ((color.getRed() + color.getGreen() + color.getBlue()) / 3); Color avg = new Color(ColAvgVal, ColAvgVal, ColAvgVal); bufImage.setRGB(w, h, avg.getRGB()); System.out.println(avg.getRGB()); } } } "System.out.println(avg.getRGB());" is used to see the pixel intensities but the all the grey levels are minus values and not between 0-255. Am I doing it wrong ? How would I convert an image to a gray scale image where pixel intensities are between 0-255. Thanks
has answer: http://stackoverflow.com/a/25463260
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25463098
downvote count: 0
upvote count: 1
score: 1
tagged with: java
tagged with: image-processing
favorite count: 0
has title: How to convert an image to a 0-255 grey scale image

http://stackoverflow.com/comment/39765019
type: AnswerComment
comment on: http://stackoverflow.com/a/25479191
has text: Thanks first.yes,it is a good way to get session user;but i want to use Spring annotation to deal with.do you know any other way? not session.getAttribute().
type: Comment
score: 0

http://stackoverflow.com/a/25414727
upvote count: 6
type: Answer
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25409103
has comment: http://stackoverflow.com/comment/39647496
accepted answer of: http://stackoverflow.com/q/25409103
has comment: http://stackoverflow.com/comment/39647887
has comment: http://stackoverflow.com/comment/108654193
has body: It's a bug in NetBeans. https://netbeans.org/bugzilla/show_bug.cgi?id=242627 Consider the following code: public class Test { public static void main(String[] args) { int[] ints = new int[]{1, 2, 3, 4, 5}; prints(ints); } static void prints(Object... ints) { for(Object i : ints) { System.out.println(i); } } } Output: [I@15db9742 // on my machine Versus this code: public class Test { public static void main(String[] args) { Integer[] ints = new Integer[]{1, 2, 3, 4, 5}; prints(ints); } static void prints(Object... ints) { for(Object i : ints) { System.out.println(i); } } } Output: 1 2 3 4 5 Notice in my examples the signature of prints(). It accepts Object..., not int.... NetBeans is trying to warn you that something "strange" (unexpected) might happen, but erroneously reports that prints(int...) could do something "unexpected".
score: 6

http://stackoverflow.com/comment/39721009
comment on: http://stackoverflow.com/q/25455650
type: QuestionComment
score: 5
has text: Post the code that you've written, tell us the expected result, and the actual result. Without that, your question is not clear enough to be able to help.
type: Comment

gmail-imap
tags question: http://stackoverflow.com/q/25506899
tag name: gmail-imap
type: Tag

http://stackoverflow.com/a/25399942
type: Answer
has comment: http://stackoverflow.com/comment/39617196
has body: When you write: public interface PVBean { public Map&lt;EnumTP, EnumP[]&gt; getMapP(); public Map&lt;EnumTP, EnumP[]&gt; getMapC(); public Map&lt;EnumTP, EnumP[]&gt; getMapT(); public Map&lt;EnumTP, EnumP[]&gt; getMapV(); } ... how is EnumTP in scope?
has comment: http://stackoverflow.com/comment/39617527
score: 0
has comment: http://stackoverflow.com/comment/39618138
has comment: http://stackoverflow.com/comment/39622810
answers question: http://stackoverflow.com/q/25399520

http://stackoverflow.com/comment/39776420
has text: I have, it's below it.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25485716
type: QuestionComment

http://stackoverflow.com/q/25437177
favorite count: 0
has answer: http://stackoverflow.com/a/25445843
tagged with: spring-integration
score: 1
has comment: http://stackoverflow.com/comment/39688024
tagged with: java
tagged with: http-headers
has body: Using Spring Integration 4.0.3.RELEASE, I see in the documentation that customization of the DefaultHttpHeaderMapper instances is supported but I am finding some unexpected results from doing so. I have created a DefaultHttpHeaderMapper instance that allows for our proprietary header prefix in addition to the standard ones. For example (response): private static final String[] RESPONSE_HEADER_NAME_PATTERNS = {DefaultHttpHeaderMapper.HTTP_RESPONSE_HEADER_NAME_PATTERN, MY_HTTP_PREFIX_PATT}; ... mapper.setOutboundHeaderNames(RESPONSE_HEADER_NAME_PATTERNS); I have done similar for the request side of things. There are methods to set exclusions on the instance as well: public void setExcludedOutboundStandardRequestHeaderNames(String[] excludedOutboundStandardRequestHeaderNames); public void setExcludedInboundStandardResponseHeaderNames(String[] excludedInboundStandardResponseHeaderNames) It appears the only place the exclusions might be processed in the class is in the shouldMapOutboundHeader(String headerName) method. However, the exclusion pathway does not execute if customization has been done. Line 419: if (this.outboundHeaderNames == HTTP_RESPONSE_HEADER_NAMES) Line 431: else if (this.outboundHeaderNames == HTTP_REQUEST_HEADER_NAMES) Even though I also included the standard header set, these conditions aren't true since I also added my own header pattern. The effect is some standard headers that I need to be to be excluded (e.g. Content-Length for response, as set by default via the HTTP_RESPONSE_HEADER_NAMES_INBOUND_EXCLUSIONS field) are not being excluded. It seems odd to me that headers can be set and exclusions can be set but if you don't use one of the static factory methods to create a completely unaltered instance, you're not going to get those exclusions removed. I can think of a couple hacky ways around this, but since this seems like a simple enough use case (just adding my own header pattern) I am led to believe that I am not using the correct construct. …
type: Question
type: UnansweredQuestion
answer count: 1
downvote count: 0
upvote count: 1
has title: DefaultHttpHeaderMapper allows customization but then does not perform exclusion logic

http://stackoverflow.com/q/25534559
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25534763
tagged with: web-services
linked to: http://stackoverflow.com/q/15940234
score: 0
tagged with: java
answer count: 1
tagged with: wsdl
has title: which is the best way of accessing webservice
has comment: http://stackoverflow.com/comment/39866720
has body: i have worked on some projects under experience people and i saw them calling a web service by writing code in java that makes HTTP connection and send data using SOAP envelop in XML format. I have been using same thing for long time. Now i watched a tutorial on youtube where the trainer used wsimport command to generate java classes from wsdl url and copied that classes in project, initialized object of service and called appropriate method for communicating with web service. Now i got confused, means i think using java classes for accessing web service is much easy than soap envelop. so i searched on google but did not get any proper answer. Please explain it which way is better and why?
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/a/25440148
answers question: http://stackoverflow.com/q/25440062
has body: it is very simple you have create more your code more complex let try this code Use TextUtils TextUtils.isEmpty-Returns true if the string is null or 0-length. EditText txtusername = (EditText) findViewById(R.id.txtusername); EditText txtpassword = (EditText) findViewById(R.id.txtpassword); if(TextUtils.isEmpty(txtusername.getText().toString())){ txtusername.setError("Username cannot be left blank"); txtusername.requestFocus(); } if(TextUtils.isEmpty(txtpassword.getText().toString())){ txtpassword.setError("password cannot be left blank"); txtpassword.requestFocus(); } //do logging process
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39691451

http://stackoverflow.com/q/25448855
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25454910
score: 0
tagged with: freemarker
accepted answer: http://stackoverflow.com/a/25454910
tagged with: java
type: Question
has title: Freemarker StringTemplateLoader
answer count: 1
has body: I am trying to load some Freemarker templating from the DB using stringLoader and executing them through template.process, but here is the problem, freemarker stuff like &lt;#if... is executing but when I try to execute assign JspTaglibs it breaks. Here is a simple example: From the DB I get &lt;#assign bean=JspTaglibs["/WEB-INF/struts-bean.tld]>, which i put in a in StringTemplateLoader. I create configuration, template.. so far everything is working. When I do template.process(data, out), the page reports: Starting output:FreeMarker template error: The following has evaluated to null or missing: ==> JspTaglibs [in template "temp" at line 1, column 15] Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use &lt;#if myOptionalVar??>when-present&lt;#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)?? The failing instruction (FTL stack trace): ---------- ==> #assign bean = JspTaglibs["/WEB-INF/s... [in template "temp" at line 1, column 1] ---------- Java stack trace (for programmers): ---------- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98) at freemarker.core.DynamicKeyName._eval(DynamicKeyName.java:87) at freemarker.core.Expression.eval(Expression.java:111) at freemarker.core.Assignment.accept(Assignment.java:106) at freemarker.core.Environment.visit(Environment.java:265) at freemarker.core.Environment.process(Environment.java:243) at freemarker.template.Template.process(Template.java:277) at org.apache.jsp.test5_jsp._jspService(test5_jsp.java:109) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.jasper.servlet.JspServletWrapper.…

testng
tag name: testng
tags question: http://stackoverflow.com/q/25427975
tags question: http://stackoverflow.com/q/25423624
tags question: http://stackoverflow.com/q/25391136
tags question: http://stackoverflow.com/q/25506618
tags question: http://stackoverflow.com/q/25549443
tags question: http://stackoverflow.com/q/25543910
tags question: http://stackoverflow.com/q/25427193
tags question: http://stackoverflow.com/q/25412345
tags question: http://stackoverflow.com/q/25435117
type: Tag

http://stackoverflow.com/comment/39630811
type: Comment
has text: These are not the entries needed for an Eclipse plugin.
comment on: http://stackoverflow.com/a/25406350
type: AnswerComment
score: 0

http://stackoverflow.com/q/25415345
linked to: http://stackoverflow.com/q/12372302
accepted answer: http://stackoverflow.com/a/25417151
tagged with: java
answer count: 1
tagged with: swing
has body: I am trying to create a JFrame with a JRootPane that takes up the whole screen, however for some reason the content of the JRootPane does not fill up the the screen like it should. I believe the issue is that the JRootPane does not fill its parent, but it could be possible that somehow the JRootPane's child panel doesn't fill up the root pane. This is what it currently shows: Here is the relevant code: public class Runner { public static void main(String[] args){ GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices(); new MainFrame(devices[0]); } } This is the JFrame with a rootPane that should fill it completely: public class MainFrame extends JFrame{ private GraphicsDevice graphicsDevice; private DisplayMode origDisplay; private final JRootPane rootPane; public MainFrame(GraphicsDevice graphicsDevice){ super(); this.setGraphicsDevice(graphicsDevice); this.setOrigDisplay(graphicsDevice.getDisplayMode()); rootPane = new JRootPane(); rootPane.setContentPane(TitleScreenPanel.getInstance(this)); this.add(rootPane, BorderLayout.CENTER); if (graphicsDevice.isFullScreenSupported()){ setUndecorated(true); setResizable(false); graphicsDevice.setFullScreenWindow(this); revalidate(); }else{ System.out.println("Full-screen mode not supported"); } try { Theme.loadTheme(new File("res/IS.theme")); UIManager.setLookAndFeel(new TinyLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } SwingUtilities.updateComponentTreeUI(this); Toolkit.getDefaultToolkit().setDynamicLayout(true); System.setProperty("sun.awt.noerasebackground", "true"); JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); rootPane.revalidate(); } public DisplayMode getOrigDisplay() { return origDisplay; } public void setOrigDisplay(DisplayMode origDisplay) { this.origDisplay = origDisplay; } public GraphicsDevice getGraphicsDevice() { return graph…
tagged with: sizing
has title: JRootPane in full screen mode sizing issue
type: Question
tagged with: fullscreen
has answer: http://stackoverflow.com/a/25417151
tagged with: jpanel
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39737956
comment on: http://stackoverflow.com/q/25464869
has text: You need to override the getView of ArrayAdapter
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39877083
comment on: http://stackoverflow.com/q/25539987
type: Comment
type: QuestionComment
score: 0
has text: @SotiriosDelimanolis Ok, I'll have a try.

http://stackoverflow.com/comment/39747249
has text: also how is `cards` defined?
score: 0
comment on: http://stackoverflow.com/q/25469913
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39743316
comment on: http://stackoverflow.com/q/25467722
score: 0
type: Comment
type: QuestionComment
has text: Please look again at the code you posted. Does it have anything close to what your assignment is?

http://stackoverflow.com/q/25519595
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25519685
has title: how to access image folder in spring application
has answer: http://stackoverflow.com/a/25520736
tagged with: java
has body: I like to access an image from the web/images directory. I like to access this image in the spring controller, so I can convert this image to byte[]. I am creating a chart and this image is part of the chart display. So, I am using this byte[] to construct Graphic2d object. Closest I have got to it is using this: FileSystemResource resource = new FileSystemResource("images/"+imageName); Currently, I have stored this image in the package structure. I like to do better than this. I like to read directly from web/images directory. Please give me some advice, Thanks.
tagged with: spring
type: Question
linked to: http://stackoverflow.com/q/8582577
score: 0

http://stackoverflow.com/a/25425005
upvote count: 4
score: 4
accepted answer of: http://stackoverflow.com/q/25424841
downvote count: 0
answers question: http://stackoverflow.com/q/25424841
has body: Try removing the extra curly-braces: public void initialize() {} { ^^ b.someMethod(); //GETTING A NULL POINTER EXCEPTION, //in fact all the beans are null } I suspect the initializer block, where you call b.someMethod(), is invoked prior to Spring wiring the dependencies. Therefore b is null at this point.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/28451334
type: Answer
answers question: http://stackoverflow.com/q/25403911
score: 10
upvote count: 10
has body: If you are using JRE 8 then change your spring version to 4. It will work perfectly..
downvote count: 0

http://stackoverflow.com/a/25458400
has comment: http://stackoverflow.com/comment/39798900
has comment: http://stackoverflow.com/comment/39762873
has comment: http://stackoverflow.com/comment/39727734
has comment: http://stackoverflow.com/comment/39734251
has comment: http://stackoverflow.com/comment/39727587
has comment: http://stackoverflow.com/comment/39796943
has body: Take a look at Activity.runOnUiThread I think part of the problem might be that you are trying to use setContentView() in a service, but it needs an activity/UI to actually set the content for. So you might do something like YourActivity.runOnUiThread(new Runnable() { @Override public void run() { // your setContentView code } }); EDIT 1: Intent localIntent = new Intent("android.intent.action.VIEW"); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setClassName("com.example.applockerservice", "com.example.applockerservice.AppLockerScreen"); startActivity(localIntent);
has comment: http://stackoverflow.com/comment/39798874
has comment: http://stackoverflow.com/comment/39726505
score: 1
has comment: http://stackoverflow.com/comment/39726359
answers question: http://stackoverflow.com/q/25458319
type: Answer
has comment: http://stackoverflow.com/comment/39798817
has comment: http://stackoverflow.com/comment/39726724
has comment: http://stackoverflow.com/comment/39798563
has comment: http://stackoverflow.com/comment/39737000
has comment: http://stackoverflow.com/comment/39789272
has comment: http://stackoverflow.com/comment/39726374
has comment: http://stackoverflow.com/comment/39786918
has comment: http://stackoverflow.com/comment/39726147
has comment: http://stackoverflow.com/comment/39726182
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/63691521
has body: You can define below beans and make sure you application.properties file has entries needed for @Configuration @PropertySource("classpath:application.properties") public class DataSourceConfig { @Primary @Bean(name = "abcDataSource") @ConfigurationProperties(prefix = "abc.datasource") public DataSource dataSource() { return DataSourceBuilder.create().type(HikariDataSource.class).build(); } @Bean(name = "xyzDataSource") @ConfigurationProperties(prefix = "xyz.datasource") public DataSource xyzDataSource() { return DataSourceBuilder.create().type(HikariDataSource.class).build(); } } application.properties abc.datasource.jdbc-url=XXXXX abc.datasource.username=XXXXX abc.datasource.password=xxxxx abc.datasource.driver-class-name=org.postgresql.Driver ........... ........... ........... ........... Here you can refer: Spring Boot Configure and Use Two DataSources
answers question: http://stackoverflow.com/q/25540502
type: Answer
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/comment/39632006
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25407527
has text: Use a library to generate JSON: http://stackoverflow.com/search?q=%5Bjava%5D+convert+object+to+json
type: Comment

http://stackoverflow.com/comment/39731327
score: 0
has text: And why do you cast the result of `parse` to Date? It returns a Date object.
type: Comment
comment on: http://stackoverflow.com/a/25461010
type: AnswerComment

http://stackoverflow.com/a/25451022
answers question: http://stackoverflow.com/q/25450671
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39714006
has comment: http://stackoverflow.com/comment/39714439
has comment: http://stackoverflow.com/comment/39715010
has comment: http://stackoverflow.com/comment/39717732
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39712333
downvote count: 0
has comment: http://stackoverflow.com/comment/39712404
has comment: http://stackoverflow.com/comment/39712741
upvote count: 1
has body: In your servlet method: // check the credentials boolean loggedIn = verify(username, password); // store the result in a request attribute, so that the JSP can retrieve it request.setAttribute("loggedIn", loggedIn); // let a JSP display the result request.getRequestDispatcher("/loginResult.jsp").forward(request, response); In the JSP (using the JSTL), test the value of the loggedIn request parameter: &lt;c:if test="${loggedIn}"&gt; Congratulations: you're now logged in. &lt;/c:if&gt; &lt;c:if test="${!loggedIn}"&gt; Sorry. Wrong user name or password &lt;/c:if&gt;
has comment: http://stackoverflow.com/comment/39717368
accepted answer of: http://stackoverflow.com/q/25450671
has comment: http://stackoverflow.com/comment/39713735
has comment: http://stackoverflow.com/comment/39712621

http://stackoverflow.com/comment/39806891
type: Comment
comment on: http://stackoverflow.com/a/25501806
type: AnswerComment
score: 0
has text: It is almost rite, How to set the display based on the key, eg if it is prdstk it should come under the Product Name column.

http://stackoverflow.com/q/25524126
tagged with: phonegap-plugins
has comment: http://stackoverflow.com/comment/39872428
has title: Cordova: Add native code without plugins in config.xml
has body: How can I add android native code to a Cordova based project without creating a plugin? what are the entries to put in config.xml? I'm asking because I have native code that I want to add which is specific to my project and I don't want to always have to remove and re-add the plugin, it will also make svn cycles more complicated. Is it even possible? The only part in config.xml that I see that might be related are- &lt;feature name="NiceNativeFeature"&gt; &lt;param name="android-package" value="com.mycomp.plugins.YourClass"/&gt; &lt;param name="onload" value="true" /&gt; &lt;/feature&gt; Thanks.
has comment: http://stackoverflow.com/comment/39848853
tagged with: java
has comment: http://stackoverflow.com/comment/39848817
favorite count: 0
tagged with: cordova-plugins
has comment: http://stackoverflow.com/comment/39921850
tagged with: cordova
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39848751
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25518830
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25518831
tagged with: java
has answer: http://stackoverflow.com/a/25518831
favorite count: 0
type: Question
tagged with: hadoop
has body: I am building Hadoop using following command: mvn package -Pdist,native,docs -DskipTests -Dtar It gives following error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (module-javadocs) on project hadoop-annotations: MavenReportException: Error while creating archive: [ERROR] Exit code: 1 - /tmp/hadoop-2.5.0-src/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/InterfaceStability.java:27: error: unexpected end tag: &lt;/ul&gt; [ERROR] * &lt;/ul&gt; This error is happening while building the Apache Hadoop Annotations module: [INFO] Apache Hadoop Main ................................ SUCCESS [1.000s] [INFO] Apache Hadoop Project POM ......................... SUCCESS [1.350s] [INFO] Apache Hadoop Annotations ......................... FAILURE [2.393s]
score: 2
has title: Building hadoop with Maven error: maven-javadoc-plugin
upvote count: 2
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/39754285
comment on: http://stackoverflow.com/q/25471892
type: Comment
score: 1
has text: "...if it's not been passed to another thread..." If thread A creates an object O, and it does not store a reference to O where any other thread can see it, then it should be pretty obvious that no other thread will be able to use object O.
type: QuestionComment

http://stackoverflow.com/comment/39847096
comment on: http://stackoverflow.com/a/25508111
score: 0
type: AnswerComment
type: Comment
has text: Hm. Try then to remove C:\Users\user\.IdeaIC13\ settings. Im pretty sure that settings files are corrupted/contain BOM

http://stackoverflow.com/a/25556939
score: 0
answers question: http://stackoverflow.com/q/25534308
has body: Try public class NullOutputStream extends OutputStream { @Override public void write(int b) throws IOException { } } and then setOut(new NullOutputStream());
type: Answer

http://stackoverflow.com/q/25504094
has answer: http://stackoverflow.com/a/25504495
score: 0
has comment: http://stackoverflow.com/comment/39834220
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39812471
type: Question
has body: //Java Socket Programming In Java a client knows IP address and Port Number of the server, but how is the server able to make a Socket Connection with the client(and make input and output streams)? i.e how/when/where the server gets knowledge about the client.
tagged with: network-programming
has comment: http://stackoverflow.com/comment/39812435
has title: Networking differences in Java
accepted answer: http://stackoverflow.com/a/25504495
type: AnsweredQuestion

http://stackoverflow.com/q/25405463
has comment: http://stackoverflow.com/comment/39628504
has comment: http://stackoverflow.com/comment/39630348
type: AnsweredQuestion
tagged with: android-fragments
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
has title: Finding fragment dynamically in Android
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/41703207
has body: Unless there is some way for the fragment to capturing the volume button click I was looking into this type of approach. I have any one of several Fragments that could be committed at any one time. In the main Activity I am capturing the volume button up/down click. I need some way for the main Activity to tell the Fragment the volume button was clicked. I have read communicating with Other Fragments and was wondering if I could dynamically initiate a Fragment. ArticleFragment articleFrag = (ArticleFragment) getSupportFragmentManager().findFragmentById(R.id.article_fragment); In the above example I need to some how replace ArticleFragment with a String value and run it through some type of method that would return the needed Fragment. Otherwise I create a method for each possible fragment in the main Activity and when the volume button is clicked I pass through a switch that determines the correct method to call. Any thoughts on this?
has answer: http://stackoverflow.com/a/41703207
tagged with: android

http://stackoverflow.com/q/25442725
has comment: http://stackoverflow.com/comment/39696213
tagged with: decode
has comment: http://stackoverflow.com/comment/39698363
has comment: http://stackoverflow.com/comment/39696532
tagged with: decoding
has answer: http://stackoverflow.com/a/25444025
answer count: 1
accepted answer: http://stackoverflow.com/a/25444025
has body: I'm trying to parse XML files produced by a third party tool ( [HTC Sync Manager][hsm] ) , since said tool refuses to work anymore. XML parsing is simple enough, but I'm stuck with trying to decode binary image data serialized into those XML files. As an example, I have a 886 character string which I know represents an image. The full string is [binary] decoding it leads to garbage, so that's not the answer. How can I decode this kind of data?
has comment: http://stackoverflow.com/comment/39698399
has comment: http://stackoverflow.com/comment/39696135
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39698375
score: 0
has title: Decoding binary data stored in XML by a third party tool
tagged with: java
has comment: http://stackoverflow.com/comment/39697611
has comment: http://stackoverflow.com/comment/39697729
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/25435403
has comment: http://stackoverflow.com/comment/39709039
has comment: http://stackoverflow.com/comment/39685617
answer count: 2
has comment: http://stackoverflow.com/comment/39707780
downvote count: 0
has body: When retrieving a column from a ResultSet object using the getObject method, the class is chosen by the JDBC driver. I am looking for a way to choose which class the column is retrieved as at runtime. In the example below type Class1 is created with variable T as an Integer. Class Class1&lt;T&gt; { public T getColumn(DataSource ds) { T value = null; Connection con = null; try { con = ds.getConnection(); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select 1 from dual"); rs.next(); Object o = rs.getObject(1); // I want an Integer but a BigDecimal is created! value = (T) o; // ClassCastException here! rs.close(); st.close(); } finally { if (con != null) { con.close(); } } return i; } } The ResultSet class provides a method called getObject that accepts a column argument and a type Map argument. This type Map is only used for UDT (user defined types). I need this functionality applied to basic SQL types as well. I know I can implement a solution to this using a switch/case statement but I'm trying to avoid that. Is this possible? EDIT I should've mentioned I am on Java 1.6. It looks like this may have been solved in 1.7. Thanks JB Nizet for the reference.
accepted answer: http://stackoverflow.com/a/25449387
has comment: http://stackoverflow.com/comment/39683425
score: 4
has comment: http://stackoverflow.com/comment/39711010
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25436084
linked to: http://stackoverflow.com/q/14524751
has answer: http://stackoverflow.com/a/25436084
has title: Is it possible to map basic JDBC SQL types to a Java class?
tagged with: java
has comment: http://stackoverflow.com/comment/39705406
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39683409
favorite count: 0
has answer: http://stackoverflow.com/a/25449387
linked to: http://stackoverflow.com/q/25448560
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/39683784

http://stackoverflow.com/comment/39706844
score: 0
type: Comment
type: QuestionComment
has text: What's your question?
comment on: http://stackoverflow.com/q/25448528

http://stackoverflow.com/q/25400307
type: Question
has comment: http://stackoverflow.com/comment/39618545
tagged with: java
has answer: http://stackoverflow.com/a/25401396
has answer: http://stackoverflow.com/a/25401270
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39618898
tagged with: mongodb
score: 0
has title: MongoDB Date query JAVA
answer count: 2
has body: Im trying to do a query to get all the values from my DB wich each have a date. One example: leadTime: [ { date: ISODate("2014-03-19T23:00:00Z"), value: 25.8 }, { date: ISODate("2014-03-20T23:00:00Z"), value: 31.299999999999997 }, { date: ISODate("2014-03-21T23:00:00Z"), value: 34.4 } ] enter code here My code is: DBObject query=new BasicDBObject("group",group); DBObject serieData= col.findOne(query,new BasicDBObject(serie, 1)); if (serieData != null) { List&lt;DBObject&gt; data = (List&lt;DBObject&gt;) serieData.get(serie); for (DBObject item : data) { result.add(new HistoryData((Date) item.get("date"),(Double) item.get("value"))); } Now I want to get the values that the date is bigger than a date that I pass by parameter. The query I did is this: DBObject query=new BasicDBObject("group",group) .append("date", new BasicDBObject("$gte", parameterDate)) ; But I always receive the result empty, can you help me? sorry for my english and than
has comment: http://stackoverflow.com/comment/39619288

http://stackoverflow.com/q/25513868
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39829326
tagged with: parcelable
type: Question
score: 0
has answer: http://stackoverflow.com/a/25514472
has answer: http://stackoverflow.com/a/25517812
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25517812
has title: Parcelable with optionally populated values
answer count: 3
has body: I am getting information from Google Place Search API. I can decode the JSON Object just fine on my first Activity. I would like to take the user to a details page so I am trying to pass the information via a Parcelable. When an attribute isn't provided by Google (maybe they don't have ratings or something) I was able to get around it in the writeToParcel function by doing a null check on the class's attributes. However, it messes up the ordering of my decoding in the Constructor so that the wrong values get assigned to each subsequent attribute. 1) How should I handle when an attribute isn't provided? 2) Is there a more abstract way to decode / encode using reflections? public static final Parcelable.Creator&lt;Place&gt; CREATOR = new Parcelable.Creator&lt;Place&gt;() { public Place createFromParcel(Parcel in) { return new Place(in); } public Place[] newArray(int size) { return new Place[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel out, int flags) { if(capacity != null) { out.writeInt(capacity); } if(icon != null) { out.writeString(icon); } if(latitude != null) { out.writeDouble(latitude); } if(longitude != null) { out.writeDouble(longitude); } if(name != null) { out.writeString(name); } if(priceLevel != null) { out.writeInt(priceLevel); } if(rating != null) { out.writeDouble(rating); } if(vicinity != null) { out.writeString(vicinity); } } private Place(Parcel in) { this.capacity = in.readInt(); this.icon = in.readString(); this.latitude = in.readDouble(); this.longitude = in.readDouble(); this.name = in.readString(); this.priceLevel = in.readInt(); this.rating = in.readDouble(); this.vicinity = in.readString(); }
has answer: http://stackoverflow.com/a/25514008
possible better answer: http://stackoverflow.com/a/25514008
tagged with: android

jvm
tags question: http://stackoverflow.com/q/25398374
tags question: http://stackoverflow.com/q/25541778
tag name: jvm
tags question: http://stackoverflow.com/q/25406681
tags question: http://stackoverflow.com/q/25398385
tags question: http://stackoverflow.com/q/25402947
tags question: http://stackoverflow.com/q/25465987
tags question: http://stackoverflow.com/q/25512146
type: Tag
tags question: http://stackoverflow.com/q/25442323
tags question: http://stackoverflow.com/q/25518115
tags question: http://stackoverflow.com/q/25497599
tags question: http://stackoverflow.com/q/25460660
tags question: http://stackoverflow.com/q/25396664
tags question: http://stackoverflow.com/q/25518875
tags question: http://stackoverflow.com/q/25454502
tags question: http://stackoverflow.com/q/25491233
tags question: http://stackoverflow.com/q/25443290
tags question: http://stackoverflow.com/q/25458941
tags question: http://stackoverflow.com/q/25543301
tags question: http://stackoverflow.com/q/25489639
tags question: http://stackoverflow.com/q/25488498
tags question: http://stackoverflow.com/q/25548699
tags question: http://stackoverflow.com/q/25544629
tags question: http://stackoverflow.com/q/25550036
tags question: http://stackoverflow.com/q/25550578
tags question: http://stackoverflow.com/q/25549684
tags question: http://stackoverflow.com/q/25522542

http://stackoverflow.com/comment/39772325
type: QuestionComment
score: 2
has text: Quickly scanning the code, it may be that your WelcomeServlet needs to accept requests via doGet rather than doPost. One standard trick is to have doPost call doGet with the same parameters. I suggest you use some standard debugging methods to try to track down precisely where the failure is occuring.
comment on: http://stackoverflow.com/q/25483296
type: Comment

http://stackoverflow.com/a/25463789
score: 3
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25462354
has body: Put your code inside an if statement that refers to a final static boolean constant in another class. An if statement like if (DEBUG) that effectively says if (false) (because DEBUG is false) is not compiled by the Java compiler. public class Debug { public final static boolean DEBUG = true; // or false } public class X { public m() { if (Debug.DEBUG) { // Do some timing or displaying mouse positions, or whatever. } } } If you want to verify that this works, you can use the javap disassembler: the compiler won't generate code if your DEBUG constant is false, but if DEBUG is true it will. For further reference, the Java Language Specification (linked) has a section on conditional compilation, "Example 13.4.9-2". This explains what I've described above.
accepted answer of: http://stackoverflow.com/q/25462354
has comment: http://stackoverflow.com/comment/39736152
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39806689
has comment: http://stackoverflow.com/comment/39806493

http://stackoverflow.com/comment/39842621
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25520971
has text: I am not sure how to use it .
score: 0

http://stackoverflow.com/a/25473726
downvote count: 0
has body: You can simply do it if Main class extends SeparateClass and your method is not private. public class SeparateClass { public void myMethod() { } } public class Main extends SeparateClass{ public void testMethod() { myMethod(); } }
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25473569
has comment: http://stackoverflow.com/comment/39754534
has comment: http://stackoverflow.com/comment/39754418
has comment: http://stackoverflow.com/comment/39754484
upvote count: 1

http://stackoverflow.com/comment/39801967
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25486379
has text: @user3280711 im not suggesting it's you :) No problem.
score: 0

http://stackoverflow.com/comment/39750863
comment on: http://stackoverflow.com/q/25471239
score: 0
has text: What is `authenticationProvider.manualAuthentication` supposed to do ? And do you verify it does it effectively ?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/39763586
score: 1
upvote count: 1
type: Answer
has body: This worked for me on 1.6.2 spring-data-mongodb. But having issues with latest versions. public interface SomeObjectRepository extends MongoRepository&lt;SomeObject, String&gt; { public List&lt;SomeObject&gt; findByName(String name); @Query("nestedObjectProperty._id : { $oid : ?0}") public List&lt;SomeObject&gt; findByNestedObjectId(String id); //some other find functions }
downvote count: 0
answers question: http://stackoverflow.com/q/25441514

http://stackoverflow.com/q/25449739
answer count: 2
has title: Strings in Java
has body: I'm curious to know the exact reasons for the behavior of String objects in the following case. I'm eager to learn about the following snippet and how it works. Snippet String s1 = "I belong to String pool"; String s2 = new String("I'm present on Heap space"); Question: Where are those string text, that is, character arrays stored in memory? Is the "I belong to String pool" character array present inside String pool and "I'm present on Heap space" character array actually present on the Heap Space? In short, can anyone please explain the storage locations of String literal reference, String literal text, String object reference s2, String object text etc. A diagrammatic representation like the following post will be much useful. http://theopentutorials.com/tutorials/Java/strings/string-literal-pool/
possible better answer: http://stackoverflow.com/a/25450031
tagged with: string
downvote count: 1
has answer: http://stackoverflow.com/a/25450031
favorite count: 0
score: 2
type: AnsweredQuestion
tagged with: string-pool
has comment: http://stackoverflow.com/comment/39709314
has answer: http://stackoverflow.com/a/25452836
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39714595
tagged with: memory
has comment: http://stackoverflow.com/comment/39711361
linked to: http://stackoverflow.com/q/11700320
type: Question
accepted answer: http://stackoverflow.com/a/25452836

http://stackoverflow.com/comment/39752180
type: QuestionComment
comment on: http://stackoverflow.com/q/25472534
has text: I hope your code and deployed one are in sync
score: 0
type: Comment

http://stackoverflow.com/comment/39797207
type: AnswerComment
comment on: http://stackoverflow.com/a/25495738
score: 0
has text: Hi Sherz, i want Ink before Hilton, but the list doesn't end there, so i really can't leave it at the end. The problem is, i just need to switch the places of those two objects. Thanks for your help.
type: Comment

http://stackoverflow.com/q/25451331
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/65611567
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/31005313
tagged with: java
has title: How to remove empty results after splitting with regex in Java?
answer count: 7
has body: I want to find all numbers from a given string (all numbers are mixed with letters but are separated by space).I try to split the input String but when check the result array I find that there are a lot of empty Strings, so how to change my split regex to remove this empty spaces? Pattern reg = Pattern.compile("\\D0*"); String[] numbers = reg.split("asd0085 sa223 9349x"); for(String s:numbers){ System.out.println(s); } And the result: 85 223 9349 I know that I can iterate over the array and to remove empty results. But how to do it only with regex?
has answer: http://stackoverflow.com/a/25451459
has comment: http://stackoverflow.com/comment/39712414
tagged with: regex
accepted answer: http://stackoverflow.com/a/25451459
has answer: http://stackoverflow.com/a/25451448
has answer: http://stackoverflow.com/a/25451455
downvote count: 0
has answer: http://stackoverflow.com/a/25451511
has answer: http://stackoverflow.com/a/31005313
has answer: http://stackoverflow.com/a/25451512
favorite count: 0
has answer: http://stackoverflow.com/a/25451451
type: Question

http://stackoverflow.com/comment/44214437
comment on: http://stackoverflow.com/a/25548109
has text: Heres a direct-link to the sample @WaynePiekarski mentioned for future reference: https://github.com/googlesamples/android-SynchronizedNotifications
type: AnswerComment
score: 4
type: Comment

http://stackoverflow.com/a/25412060
type: Answer
answers question: http://stackoverflow.com/q/25402232
score: 0
has body: So I have come across this multiple times. And in a lot of cases getting the before and after time (as suggested) works well. However, I have had problems with this in cases where the time is converted to a String or some such where I need the exact time to be able to create a good test. For this reason I created a mechanism to control time (just not the space-time continuum). I have a class called DateSupplier which has methods like getCurrentTime() and getCurrentDateTime. The default behavior returns new Date(). I then have a JUnit Rule DateController that can be used to control explicitly what DateSupplier returns. The DateController Rule is in a test library so should not be deployed with production code. After each test it sets the behavior of DateSupplier back to the default behavior of returning the correct current Date. public Date getCurrentUtcDateTime() { // Return UTC time Date date = DateSupplier.getCurrentDate(); } public class MyTest{ @Rule public DateController dateController = new DateController(); private Date currentTime; @Before public void setup(){ dateController.setCurrentTimeToNow(); currentTime = DateSupplier.getCurrentTime(); } @Test public void myTest(){ Date value = getCurrentUtcDateTime(); // verify Date utcDate = // convert currentTime to UTC assertThat(value, equalTo(utcDate)); } }

http://stackoverflow.com/comment/39814889
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25506173
type: Comment
has text: Your code example would have been easier to understand if you included a definition for `A` and didn't bother including `C.getValue(int b)`, since it's irrelevant.

http://stackoverflow.com/q/25535769
favorite count: 0
has answer: http://stackoverflow.com/a/25535790
possible better answer: http://stackoverflow.com/a/25535790
tagged with: indexing
type: AnsweredQuestion
tagged with: java
answer count: 3
has body: Is it possible to re-arrange indexes on arrays? Lets say String myArray [] = {"a","b","c","d"} and rearrange the indexes to acbd as the output, sorry for the noob question.
has comment: http://stackoverflow.com/comment/39869519
has title: Rearrange index on array
has answer: http://stackoverflow.com/a/25535954
accepted answer: http://stackoverflow.com/a/25535954
has answer: http://stackoverflow.com/a/25536035
type: Question
upvote count: 0
tagged with: arrays
score: -3
downvote count: 3
linked to: http://stackoverflow.com/q/25434551

http://stackoverflow.com/q/25438479
score: 0
has answer: http://stackoverflow.com/a/25438912
has title: What does "unhandled exception type FileUploadException" and how can I fix this?
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39688988
tagged with: file-upload
has comment: http://stackoverflow.com/comment/39689102
has comment: http://stackoverflow.com/comment/39688855
type: Question
has comment: http://stackoverflow.com/comment/39689255
accepted answer: http://stackoverflow.com/a/25438912
tagged with: google-app-engine
has body: I'm using Google App Engine on Eclipse and I want the users to be able to upload documents. I have used the example given on How to upload and store an image with google app engine (java). What should I do to get rid of the error that says "unhandled exception type FileUploadException" on the two lines right after ServletFileUpload upload = ... Here's the exact code I've used: package com.example.test; import java.io.*; import javax.jdo.PersistenceManager; import javax.jdo.PersistenceManagerFactory; import javax.servlet.http.*; import org.apache.commons.fileupload.FileItemIterator; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.fileupload.*; import org.apache.commons.io.IOUtils; import com.google.appengine.api.datastore.Blob; @SuppressWarnings("serial") public class TestServlet extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException { // Get the image representation ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iter = upload.getItemIterator(req); FileItemStream imageItem = iter.next(); InputStream imgStream = imageItem.openStream(); // construct our entity objects Blob imageBlob = new Blob(IOUtils.toByteArray(imgStream)); MyImage myImage = new MyImage(imageItem.getName(), imageBlob); // persist image PersistenceManager pm = PMF.get().getPersistenceManager(); pm.makePersistent(myImage); pm.close(); // respond to query res.setContentType("text/plain"); res.getOutputStream().write("OK!".getBytes()); } } MyImage.java: package com.example.test; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import javax.persistence.Entity; import com.google.appengine.api.datastore.Blob; @Entity public class MyImage { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent private String n…
linked to: http://stackoverflow.com/q/1513603
type: AnsweredQuestion

http://stackoverflow.com/q/25498303
tagged with: php
has title: Get $_SESSION parameters via Java in Selenium Webdriver
score: 0
tagged with: java
tagged with: selenium
answer count: 1
tagged with: webdriver
type: Question
linked to: http://stackoverflow.com/q/15679451
tagged with: session
has answer: http://stackoverflow.com/a/25498446
has body: I am new with Selenium Webdriver and trying to create my first test cases for application that is constructed mostly with PHP. I am creating test cases with Java. My first test case is testing login into the system. When I run my test, browser instance is started, login information is set into login form fields and login form is submitted. After that browser dericets to used users start page as it should. So the test works as it should. The problem is, I would like to check if the login was successful and save it in a testing report without a need for me to see the process trough in person. I figured most valid way to ensure login success is to see if PHP code have created variable $_SESSION['logged_in'] = true as it does when login process is successful. Is there any way for me to seek through $_SESSION variables with Java in my Selenium Webdriver test class?
type: UnansweredQuestion

http://stackoverflow.com/a/25414160
has comment: http://stackoverflow.com/comment/39660258
has comment: http://stackoverflow.com/comment/39644638
accepted answer of: http://stackoverflow.com/q/25414060
downvote count: 0
score: 1
upvote count: 1
has body: You should never sub class JTable. You should create a class that extends AbstractTableModel and implement the data call methods. Then instead of this: jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); you would jTable1.setModel(new MyBasicTableModel()); Your MyBasicTableModel class will then hold all the data that will be displayed in the table. You may need to add extra methods so your program will be able to update the the data as needed. You also have to notify listeners when you get data updates so the table will be updated visually. You can find more information at http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#data
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25414060

http://stackoverflow.com/a/25485710
score: 2
has comment: http://stackoverflow.com/comment/39777044
has comment: http://stackoverflow.com/comment/39776985
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39776653
accepted answer of: http://stackoverflow.com/q/25485507
type: Answer
has body: You wrote line 225 (source of the NullPointerException) is: this.Jlabel_imagen.setIcon(icon); JLabel.setIcon() accepts null (in which case the label will have no icon) which leaves us one option: this.Jlabel_imagen is null. Initialize this.Jlabel_imagen properly before you call its setIcon() method. And as mKorbel pointed out a call to JLabel.updateUI() is unnecessary, you can remove it.
has comment: http://stackoverflow.com/comment/39777157
answers question: http://stackoverflow.com/q/25485507
has comment: http://stackoverflow.com/comment/39776164
has comment: http://stackoverflow.com/comment/39776774

http://stackoverflow.com/a/25462665
answers question: http://stackoverflow.com/q/25462646
has comment: http://stackoverflow.com/comment/39733974
type: Answer
upvote count: 3
downvote count: 0
has body: You are missing a space between the number and the AND operator: rs = stmt.executeQuery("select count(*) from users_transition where phoneNumber =" +number +" and randKey="+key); // ^ You should replace the query with prepared statement, and use query parameters. This would help you not only avoid simple errors like this, but also make your code immune to SQL injection attacks. String sql = "select count(*) from users_transition where phoneNumber =? and randKey=?"; PreparedStatement getCount = con.prepareStatement(sql); getCount.setBigDecimal(1, new BigDecimal(number)); getCount.setBigDecimal(2, new BigDecimal(randKey));
score: 3

mule
tags question: http://stackoverflow.com/q/25500413
tag name: mule
tags question: http://stackoverflow.com/q/25487736
tags question: http://stackoverflow.com/q/25491241
tags question: http://stackoverflow.com/q/25442704
tags question: http://stackoverflow.com/q/25482141
tags question: http://stackoverflow.com/q/25521390
type: Tag
tags question: http://stackoverflow.com/q/25545431

http://stackoverflow.com/q/25522623
tagged with: java
score: 1
has comment: http://stackoverflow.com/comment/39848367
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39847125
tagged with: libgdx
downvote count: 0
answer count: 1
has body: I have a camera that renders a TiledMap. I would like to simulate vertical scrolling, moving down the tiledmap inside the camera (the camera remains firm). how can I achieve this? EDIT In the create method map=new TmxMapLoader().load("Map.tmx"); this.renderer=new OrthogonalTiledMapRenderer(map); this.camera=new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); this.camera.translate(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2); this.camera.update(); In the render method this.renderer.setView(camera); this.renderer.render(); camera.update();
upvote count: 1
accepted answer: http://stackoverflow.com/a/25525703
has title: Move the tilemap in a camera
has answer: http://stackoverflow.com/a/25525703
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39848758

http://stackoverflow.com/a/25474741
has comment: http://stackoverflow.com/comment/39905974
answers question: http://stackoverflow.com/q/25473808
score: 3
has body: The prefix in your query is wrong. You have http://www.xmlns.com/foaf/0.1 That means that when you use foaf:name in the query, it expands to http://www.xmlns.com/foaf/0.1name In the data, however, the foaf prefix is http://xmlns.com/foaf/0.1/ so that foaf:name is http://xmlns.com/foaf/0.1/name That is, you need to add a final slash, and you need to remove the initial www. Thus, you'd end up with a query and results like this: prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; select * where { ?s foaf:name ?o . } ------------------------------ | s | o | ============================== | _:b0 | "Charlie" | | &lt;data.rdf#me&gt; | "George V" | ------------------------------ Note that the data doesn't specify any xml:base. Since the document uses a relative URI for the subject in &lt;#me&gt; foaf:name "George V", you may see a different URI as the subject than what I've shown in my results here.
upvote count: 3
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39772489
comment on: http://stackoverflow.com/a/25483232
has text: @user3676199 What he meant was that you should check the `doc` you get when calling `Document doc =Jsoup.connect("myurl") .cookies(loginCookies).get()`. It is possible that the doc you retrieve does not contain the ` ` from the website, perhaps due to a login error.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25392946
tagged with: java
answer count: 1
tagged with: jpa
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39605965
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25394917
has body: Im making an app with JPA 2.1, EclipseLink 2.5.0, a SQLite3 database and Swing. I have two entities, EntityClient and EntityPhone, where the first one has a OneToMany relationship with the second one. Both entities have their own primary key and their relationship is represented by a JoinTable. To access and persist all the data i use a generic DAO. I was trying to delete on cascade, so if delete a client his phones also get deleted. I already achieved this by adding orphanRemoval=true and cascade={CascadeType.ALL} to the OneToMany annotation and the CascadeOnDelete annotation. The problem is that, because of the orphanRemoval=true, if i insert a new client and then i try to delete it i will get a NullPointerException. But if i close the app and start it again it will let me delete the client without any problem. These are the entities: @Entity @Table(name="clientes") public class EntityClient { @Id @Column(name="id_cliente") private Integer idClient; @Column(name="nombre") private String name; @Column(name="apellidos") private String surname; @OneToMany(mappedBy="client", targetEntity=EntityPhone.class, fetch=FetchType.EAGER, orphanRemoval=true, cascade={CascadeType.ALL}) @CascadeOnDelete private ArrayList&lt;EntityPhone&gt; phones; //The rest of the fields and the getters and setters... } @Entity @Table(name="telefonos") public class EntityPhone { @Id @Column(name="id_telefono") private Integer idPhone; @Column(name="telefono") private String phone; @Column(name="descripcion") private String description; @ManyToOne(fetch=FetchType.EAGER) @JoinTable(name="clientes_telefonos", joinColumns=@JoinColumn(name="id_telefono", referencedColumnName="id_telefono"), inverseJoinColumns=@JoinColumn(name="id_cliente", referencedColumnName="id_cliente")) private EntityClient client; //Getters and setters... } This is the generic DAO which obviously has a delete method: public abstract class DAO&lt;Entity, ID extends Serializable&gt; { private Class&lt;Entity&gt; entityClass; priv…
accepted answer: http://stackoverflow.com/a/25394917
type: AnsweredQuestion
tagged with: nullpointerexception
has title: JPA: orphanRemoval=true sometimes throws NullPointerException when deleting
tagged with: eclipselink
score: 1

http://stackoverflow.com/comment/39605702
type: Comment
type: QuestionComment
has text: This is the way remote debugging works. The connection goes from the debugger to the remote JVM being debugged. If you want you can add the `suspend=y` option to have the remote JVM pause until the debugger connects. The remote JVM will not initiate an outgoing JDWP connection.
comment on: http://stackoverflow.com/q/25393488
score: 1

http://stackoverflow.com/comment/39814287
comment on: http://stackoverflow.com/a/25504426
score: 0
type: Comment
has text: Glad to help you. Try your best to describe what you are trying to do in the question clearly. Your question didn't have a single word telling that you want to access svn through Java. It is very misleading. So next time make sure to put question more clearly. Upvote or mark as answer if any answer helped you.
type: AnswerComment

http://stackoverflow.com/q/25438994
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/44398343
linked to: http://stackoverflow.com/q/14210051
type: UnansweredQuestion
has body: I first tried Actions class and the drag-and-drop does work on different elements, however it was unable to locate the a specific draggable element on it's exact screen/webpage position. Here's the code I've used: Point loc = driver.findElement(By.id("thiselement")).getLocation(); System.out.println(loc); WebElement drag = driver.findElement(By.id("thiselement")); Actions test = new Actions(driver); test.dragAndDropBy(drag, 0, 60).build().perform(); I checked the element with it's pixel location and it prints (837, -52), which was somewhere on top of the webpage and was pixels away from the actual element. Then I tried using the Robot class and works perfectly fine on my script, but can only provide constant successful runs on a single test machine, running it with a different machine with different screen resolution and screen size will render the script to fail due to the dependency of Robot on the pixel location of the element. The sample code of the Robot script I'm using: Robot dragAndDrop = new Robot(); dragAndDrop.mouseMove(945, 166); //actual pixel location of the draggable element dragAndDrop.mousePress(InputEvent.BUTTON1_MASK); sleep(3000); dragAndDrop.mouseMove(945, 226); dragAndDrop.mouseRelease(InputEvent.BUTTON1_MASK); sleep(3000); Is there any alternative for Actions and Robot to automate drag-and-drop? Or maybe a help on working the script to work on Actions as I really can't use Robot. Thanks in advance.
tagged with: selenium-webdriver
has title: Selenium Webdriver Java - looking for alternatives for Actions and Robot when performing drag-and-drop
downvote count: 0
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/25446367
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39624892
type: Comment
has text: I'm not sure this quite works - it allows access, but when basic auth credentials are provided the current Subject doesn't seem to be authenticated. That's even with calling super.isAccessAllowed(), but returning true regardless, if it's a GET request.
type: AnswerComment
comment on: http://stackoverflow.com/a/25399530
score: 0

http://stackoverflow.com/q/25486726
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xslt
type: Question
tagged with: jaxp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39778115
tagged with: xalan
score: 0
has answer: http://stackoverflow.com/a/25487390
has comment: http://stackoverflow.com/comment/39813904
upvote count: 1
has body: My requirement is to do a XML A to XML B transformation. The Tag in which I read from XML A should be configurable, it is a kind of iteartion of lists. If there is any new tag present in XML A, it should be dealt by adding entries in configuration file for Java and programatically which in turn should be reflected in XSLT and transformed to XML B. I'm using Java. Is it possible by passing parameters? as my requirement need the parameters are passed in a loop or a List. I'm new to XSLT and any info link on this would be very much appreciated. Source XML - There can be more like yearly, weekly etc here <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 1234 8678 Target XML <?xml version="1.0" encoding="UTF-8" standalone="yes"?> Daily 1234 Monthly 8678
linked to: http://stackoverflow.com/q/2154533
tagged with: java
answer count: 1
downvote count: 1
has title: XSLT for dynamic tag passed from Java Program

http://stackoverflow.com/comment/39986744
comment on: http://stackoverflow.com/q/25470536
score: 0
type: Comment
has text: as you also having same problem as mine, take a look here http://stackoverflow.com/questions/25565628/unable-to-start-activity-nullpointerexception
type: QuestionComment

http://stackoverflow.com/a/46462988
answers question: http://stackoverflow.com/q/25447611
has comment: http://stackoverflow.com/comment/130038957
score: 10
type: Answer
upvote count: 10
has body: You can use jackson library for convert map object to direct POJO. Map&lt;String, String&gt; map = new HashMap&lt;&gt;(); map.put("id", "5"); map.put("name", "Bob"); map.put("age", "23"); map.put("savings", "2500.39"); ObjectMapper mapper = new ObjectMapper(); MyPojo pojo = mapper.convertValue(map, MyPojo.class);
downvote count: 0

http://stackoverflow.com/comment/39738646
type: AnswerComment
comment on: http://stackoverflow.com/a/25464402
score: 1
has text: thanks for your answer. That's the problem. But, Udacity's Course says it's a composite index, and the instructor is a Google Developer. I think they used a older GAE version.
type: Comment

http://stackoverflow.com/comment/39818759
type: Comment
has text: As far as I understand it, this is not true (the first sentence) or only applies to primitive variables (I don't know as I am not that familiar with either the internal workings of C/C++ or Java) and doesn't answer the question (Can one achive the same effect with making the class final vs. making all methods final?)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25505104

http://stackoverflow.com/q/25475515
tagged with: swing
tagged with: tablecellrenderer
type: Question
has comment: http://stackoverflow.com/comment/39760018
type: UnansweredQuestion
has title: JTable Rows Not Rendered in Expected Colors
tagged with: jtable
tagged with: netbeans
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39758417
has comment: http://stackoverflow.com/comment/39758613
has body: I have a jtable , a customtablemodel and a customcellrenderer with the NetBeans IDE. I want to have different colors for different rows. But anytime I run the application , the rows are not painted as expected. The code snippets are provided below. This code is from the jtable : duesTable = new javax.swing.JTable(); duesTable.setModel(duestableModel); TableColumn tcol = duesTable.getColumnModel().getColumn(2); tcol.setCellRenderer(new CustomTableCellRenderer2()); duesTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); this code is from the TableCellRenderer public class CustomTableCellRenderer2 extends DefaultTableCellRenderer{ @Override public Component getTableCellRendererComponent (JTable table, Object obj, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent( table, obj, isSelected, hasFocus, row, column); if (isSelected) { cell.setBackground(Color.green); } else { if (row % 2 == 0) { cell.setBackground(Color.green); } else { cell.setBackground(Color.lightGray); } } return cell; } } This is from the Table Model. public class DuesTableModel extends AbstractTableModel implements TableModelListener { private List&lt;List&lt;Object&gt;&gt; dataList = new ArrayList&lt;&gt;(); private String[] header = { "ID"," PAYMENT YEAR" , "AMOUNT"}; // Payment year is a date datatype private int minRowCount = 5; public DuesTableModel() { super(); } public List&lt;List&lt;Object&gt;&gt; getDataList() { return dataList; } public void setDataList(List&lt;List&lt;Object&gt;&gt; dataList) { this.dataList = dataList; fireTableDataChanged(); fireTableStructureChanged(); } @Override public int getRowCount() { return Math.max(minRowCount, dataList.size()); } @Override public int getColumnCount() { return header.length; } public void setHeader(String[] header) { this.header = header; } public String[] getHeader() { return header; } @Override public void setValueAt(Object value, int row, int col) { int x = 0; for(List&lt;…

http://stackoverflow.com/q/25412032
tagged with: jnlp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39684573
has title: Application's associated file (JNLP) does not have a digital signature
score: 2
tagged with: security
has body: I have a unique problem with web start certificate pop up. - We generate our jnlp file on the fly when a user request comes in handled by a special Jnlp servlet we wrote that provides parameter values at runtime. - These parameters are read in from the jnlp file as system property later by the client. So the actual jnlp that is dynamically generated is not signed but rest all of the jars/resources are signed properly. But we get this annoying pop up warning that not all the resources of this application are signed and upon clicking on details the message is this: "Although the application has a digital signature, the application's associated file (JNLP) does not have one. A digital signature ensures that a file is from the vendor and that it has not been altered." Has anyone seen this and is there way to handle this? Any help greatly appreciated
has comment: http://stackoverflow.com/comment/39668810
has comment: http://stackoverflow.com/comment/39668167
answer count: 0
upvote count: 2
tagged with: java
tagged with: certificate
downvote count: 0
has comment: http://stackoverflow.com/comment/39640230
has comment: http://stackoverflow.com/comment/39679641
favorite count: 0
type: Question

encoding
tags question: http://stackoverflow.com/q/25548646
tags question: http://stackoverflow.com/q/25462660
tags question: http://stackoverflow.com/q/25392533
tag name: encoding
tags question: http://stackoverflow.com/q/25404373
type: Tag
tags question: http://stackoverflow.com/q/25537357
tags question: http://stackoverflow.com/q/25519780
tags question: http://stackoverflow.com/q/25449772

http://stackoverflow.com/q/25441088
tagged with: functional-programming
has answer: http://stackoverflow.com/a/44378079
has body: I want to collect the items in a stream into a map which groups equal objects together, and maps to the number of occurrences. List<String> list = Arrays.asList("Hello", "Hello", "World"); Map<String, Long> wordToFrequency = // what goes here? So in this case, I would like the map to consist of these entries: Hello -> 2 World -> 1 How can I do that?
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/52489180
upvote count: 261
has answer: http://stackoverflow.com/a/51106247
possible better answer: http://stackoverflow.com/a/51106247
tagged with: java-8
has answer: http://stackoverflow.com/a/40591504
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25441208
accepted answer: http://stackoverflow.com/a/25441208
score: 261
tagged with: java
has answer: http://stackoverflow.com/a/51541841
has answer: http://stackoverflow.com/a/79086230
has title: How can I count occurrences with groupBy?
type: AnsweredQuestion
tagged with: java-stream

deployment
tags question: http://stackoverflow.com/q/25490514
tags question: http://stackoverflow.com/q/25534421
tag name: deployment
type: Tag
tags question: http://stackoverflow.com/q/25451316
tags question: http://stackoverflow.com/q/25483627
tags question: http://stackoverflow.com/q/25482562

http://stackoverflow.com/comment/39646636
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25415360
has text: @Celeritas That was just an example. In that case, it would be `abc`.

http://stackoverflow.com/a/27561334
answers question: http://stackoverflow.com/q/25425813
type: Answer
has body: Problem is solved using these steps: Use always db2jcc4.jar not db2jcc.jar (JDBC 4) (In some places JDBC level 2 was configured in the OS classpath with db2jcc instead DB2jcc4 ) Set the environment variable DISABLEUNICODE=0 There is a complete information in this page Understanding DB2 Universal Database character conversion about unicode on DB2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25425813
score: 2

http://stackoverflow.com/q/25495472
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25495604
tagged with: regex
has body: I want to remove the forward slash at the end of the String which is repeating twice using Java. Here is what I have: String s = "http://almaden.ibm.com//"; length = s.length(); Char buff = s.charAt((length); if(buff == '//') { } else LOGGER.info("Doesnt end with trailing doubleslash"); Please suggest how can i remove extra forward slash when i'm displaying the URL.Thanks.
has comment: http://stackoverflow.com/comment/39795473
tagged with: replace
score: 0
has answer: http://stackoverflow.com/a/25495609
has answer: http://stackoverflow.com/a/25495637
upvote count: 1
has title: java code to remove extra forward slash
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/25495573
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39795175
has answer: http://stackoverflow.com/a/25495646
answer count: 5

http://stackoverflow.com/comment/39881784
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25534123
has text: While Node is the base class for all scenegraph components, extending something more concrete such as AnchorPane or StackPane might prove more beneficial for your purposes.
type: Comment

http://stackoverflow.com/q/25413184
has comment: http://stackoverflow.com/comment/39642537
has comment: http://stackoverflow.com/comment/39642343
has comment: http://stackoverflow.com/comment/39642419
has comment: http://stackoverflow.com/comment/39642757
answer count: 1
tagged with: maven
accepted answer: http://stackoverflow.com/a/25413712
has comment: http://stackoverflow.com/comment/39642624
linked to: http://stackoverflow.com/q/20546962
has comment: http://stackoverflow.com/comment/39642457
tagged with: git
type: Question
type: AnsweredQuestion
score: 0
has title: Your projects contains error please fix them before running:Eclipse
tagged with: android
tagged with: java
has body: I am building android application in which I have imported one of the maven library from this link https://github.com/devnied/EMV-NFC-Paycard-Enrollment.My project name is Nfcs and I have no errors in the project and I have added all of the dependencies in my project successfully but when I run the project error window opens saying "Your projects contains error please fix them before running".Please help me find out the error... pom.xml of the library project. 4.0.0 library jar EMV paycard library com.github.devnied.emvnfccard parent 1.1.1-SNAPSHOT com.github.devnied bit-lib4j org.apache.commons commons-lang3 org.apache.commons commons-collections4 commons-io commons-io junit junit 4.11 test org.easytesting fest-assert 1.4 test org.powermock powermock-module-junit4 test org.powermock powermock-api-easymock test cglib cglib test org.eluder.coveralls coveralls-maven-plugin org.codehaus.mojo cobertura-maven-plugin
has comment: http://stackoverflow.com/comment/39642408
has answer: http://stackoverflow.com/a/25413712
has comment: http://stackoverflow.com/comment/39642172
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39642447
has comment: http://stackoverflow.com/comment/39643071
has comment: http://stackoverflow.com/comment/39642229

http://stackoverflow.com/comment/39880975
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25542268
type: Comment
has text: Illegal character in query at index 355 check InterestTabFragment.java:308

http://stackoverflow.com/comment/39889185
type: QuestionComment
has text: Use, just use the [DOM](http://docs.oracle.com/javase/tutorial/jaxp/dom/). What's the problem you're having? Please show some effort you have made.
comment on: http://stackoverflow.com/q/25547096
score: 0
type: Comment

http://stackoverflow.com/q/25482245
tagged with: swing
has comment: http://stackoverflow.com/comment/39770999
type: Question
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/39770909
has comment: http://stackoverflow.com/comment/39770813
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39774888
has title: JTableCellRenderer causing program to go black when minimized
tagged with: jtable
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39770082
answer count: 0
tagged with: cellrenderer
has body: I'm making a program that selects classes from a database via a jcombo box and then populates a time table with the class times. I've used a custom cellrenderer that extends DefaultTableCellRenderer to text wrap the information and change the background of the cells. It works but when i minimize the program it goes all black and if I double click I get a new JTextArea opening up on the timetable. Anyone have any idea why this is happening? Here's the code i used and thanks for any help. public class TimesTableCellRenderer extends DefaultTableCellRenderer { private int minHeight = -1; private final JLabel label = new JLabel(); private final JTextArea textArea = new JTextArea(); public TimesTableCellRenderer(){ super(); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setBackground(Color.cyan); } public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = null; if(value.toString()!=null){ textArea.setText(value.toString()); c = textArea; setSize(table.getColumnModel().getColumn(column).getWidth(),130); setVisible(true); }else{ System.out.println("error"); } return c; } } and how they go on the timetable is like so timeTable.getColumnModel().getColumn(1).setCellRenderer(new TimesTableCellRenderer()); And this is an example of the code in action to see the error for yourselves although some things have been changed to make it easier to represent as it is part of a larger program. public class NewTimeTable { JFrame s; public NewTimeTable(JFrame s){ this.s=s; timetable(); s.setVisible(true); } private JTable table; public JComboBox ModuleComboBox; public JTextArea DemonstratorTextArea; // public JTextPane DemonNamesTextPane; public JList demonNamesJList; public JPanel DemonNamesJPanel; JTable timeTable; JPanel frmMain; Container pane; static DefaultTableModel defaultTimeTableModule; // Table model JScrollPane scrollbarTT; // The scrollpane JPanel TimeTablePanel;…

http://stackoverflow.com/q/25460368
answer count: 2
tagged with: mocking
score: 0
tagged with: mockito
tagged with: junit
accepted answer: http://stackoverflow.com/a/25460683
has comment: http://stackoverflow.com/comment/39730286
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/25460683
has title: why is mockito not called when executing mocked method?
has body: Here is my test: @Test public void myTest() throws Exception { String aVenueId = "1.2.3"; Venue2 aVenue = new Venue2(aVenueId); VenuesRepository repository = mock(VenuesRepository.class); when(repository.getVenue(anyString())).thenReturn(new VenueThumb(aVenue)); aMethodWithInnerCallToRepositoryGetVenue(); ... } However when test runs my real code, this line returns null (as there is no venue with venueId = "1.2.3" that's why i used my mock for the first place). public void aMethodWithInnerCallToRepositoryGetVenue(){ ... IVenue v = repository.getVenue(r.venueId); .. }
tagged with: java
possible better answer: http://stackoverflow.com/a/25536146
has answer: http://stackoverflow.com/a/25536146
type: AnsweredQuestion

http://stackoverflow.com/a/25518454
answers question: http://stackoverflow.com/q/25466902
has comment: http://stackoverflow.com/comment/96152191
upvote count: 4
score: 3
downvote count: 1
has body: This Link will summerize the main features added to specific version with each version name and it's relase date. Hope this helps you.
type: Answer

http://stackoverflow.com/comment/39890721
type: Comment
score: 1
has text: Please show us how you tried to use `Collections.reverse()`. That *is* the normal way to reverse a collection, so show us how you tried to use it and explain what went wrong.
type: QuestionComment
comment on: http://stackoverflow.com/q/25547722

http://stackoverflow.com/comment/39634992
score: 0
has text: What @JaqenH'ghar said.
type: Comment
comment on: http://stackoverflow.com/a/25409348
type: AnswerComment

http://stackoverflow.com/q/25436097
tagged with: javafx
has answer: http://stackoverflow.com/a/25437004
tagged with: css
has body: I started to style one of my applications and I noticed something weird. This is an example that reflects that behavior. As you may notice, there is a menu with three items. I styled context menu (orange), but it appears that context menu is in some other wider container that holds it. What is that container and how it can be styled to get natural looking menu. Here is a code too: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Menu; import javafx.scene.control.MenuBar; import javafx.scene.control.MenuItem; import javafx.scene.control.TextField; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class TestMenu extends Application { @Override public void start(Stage stage) throws Exception { BorderPane borderPane = new BorderPane(); MenuBar menuBar = new MenuBar(); Menu menu = new Menu("File"); MenuItem menuItemSettings = new MenuItem("Settings"); MenuItem menuItemOpen = new MenuItem("Open"); MenuItem menuItemFile = new MenuItem("Exit"); TextField textField = new TextField(); textField.setPrefColumnCount(25); menuBar.getMenus().addAll(menu); menu.getItems().addAll(menuItemSettings, menuItemOpen, menuItemFile); borderPane.setTop(menuBar); borderPane.setCenter(textField); Scene scene = new Scene(borderPane, 320, 200); scene.getStylesheets().addAll("/testcss/style.css"); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } } And stylesheet: .root { -fx-background-color: #222; } .text { -fx-fill: white; } .menu-bar { -fx-background-color: #007fa8; } .menu-item { -fx-background-color: #222; } .menu-item:hover { -fx-background-color: #3399B9; } .menu-item:pressed { -fx-background-color: #004C65; } .context-menu { -fx-background-color: orange; } Thanks in advance.
type: AnsweredQuestion
upvote count: 3
downvote count: 0
has title: JavaFX - what is this weird container that holds context menu
linked to: http://stackoverflow.com/q/25336796
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39685345
type: Question
accepted answer: http://stackoverflow.com/a/25437004
has comment: http://stackoverflow.com/comment/39686056
score: 3
has comment: http://stackoverflow.com/comment/39685083
tagged with: java

http://stackoverflow.com/comment/39803360
has text: @ pratik thank you so much for upVote and @ Divya .. check your webservice please , might be you were missing some perameter to pass
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25499373

http://stackoverflow.com/a/35724833
accepted answer of: http://stackoverflow.com/q/25543250
downvote count: 0
has body: You can use a custom VerificationMode to count the invocations, here you go: public class InvocationCounter { public static &lt;T&gt; T countInvocations(T mock, AtomicInteger count) { return Mockito.verify(mock, new Counter(count)); } private InvocationCounter(){} private static class Counter implements VerificationInOrderMode, VerificationMode { private final AtomicInteger count; private Counter(AtomicInteger count) { this.count = count; } public void verify(VerificationData data) { count.set(data.getAllInvocations().size()); } public void verifyInOrder(VerificationDataInOrder data) { count.set(data.getAllInvocations().size()); } @Override public VerificationMode description(String description) { return VerificationModeFactory.description(this, description); } } } And then use it like this (works also with void return types): @Mock private Function&lt;String, Integer&gt; callable; AtomicInteger count= new AtomicInteger(); //here is the actual invocation count stored countInvocations(callable,count).apply( anyString()); assertThat(count.get(),is(2));
has comment: http://stackoverflow.com/comment/67233418
type: Answer
answers question: http://stackoverflow.com/q/25543250
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/69717868
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25432588
score: 0
has text: "\" symbol cannot be resolved, do you have any idea about this?

queue
tags question: http://stackoverflow.com/q/25424484
tag name: queue
tags question: http://stackoverflow.com/q/25393612
type: Tag
tags question: http://stackoverflow.com/q/25399933
tags question: http://stackoverflow.com/q/25501563

http://stackoverflow.com/comment/39721078
score: 0
has text: Thanks for your reply, Yes I am copying from an entity to a Bean. Please Let me know if I can add any specific code snippets that could explain it better?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25455497

http://stackoverflow.com/comment/39846902
score: 0
type: AnswerComment
has text: No, this would result in every symbol to be followed by a space. See my edit in my post.
type: Comment
comment on: http://stackoverflow.com/a/25521454

http://stackoverflow.com/comment/39823675
type: QuestionComment
score: 0
has text: @OliverGierke (thanks for stepping in) no that made no difference [public class AgentEventHandler extends AbstractRepositoryEventListener] nor [public class AgentEventHandler extends AbstractRepositoryEventListener<Agent>]
comment on: http://stackoverflow.com/q/25510530
type: Comment

http://stackoverflow.com/comment/39656673
comment on: http://stackoverflow.com/q/25420999
type: QuestionComment
has text: Is it possible that some of your connections are not correctly closed?
type: Comment
score: 2

http://stackoverflow.com/q/25426971
has answer: http://stackoverflow.com/a/25439925
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39670438
tagged with: cluster-analysis
answer count: 1
downvote count: 0
tagged with: machine-learning
upvote count: 1
has comment: http://stackoverflow.com/comment/39689660
favorite count: 0
type: Question
tagged with: algorithm
type: UnansweredQuestion
tagged with: mahout
has title: Geo location clustering
has body: Problem: Need to identify the home location of the IMEI no (User's home location). I have a set of lat and long,imei and time it was recorded; Note: 1.Recorded IMEI locations are not periodic. 2.Recorded IMEI locations doesn't has any pattern 3.Lat long locations are may not be recorded on every day. So what I planned is,using a clustering algorithm. If we cluster the lat and long locations means we can get set of cluster.In which I will concentrate two cluster.Cluster in which most of the latlong recorded on day time and cluster in which most of the latlong points recorded on night time.Then if cluster that has most of the latlong recorded at night times, will be considered as home location. what I expect is which clustering algorithm is best suitable for this clustering job and how to use algorithm in java....? Any one can suggest on it...?
has comment: http://stackoverflow.com/comment/39671000

http://stackoverflow.com/comment/39891228
score: 0
type: Comment
has text: @GrIsHu :- See above i have post my whole code and log cat response also.
type: AnswerComment
comment on: http://stackoverflow.com/a/25547889

http://stackoverflow.com/q/25540698
has answer: http://stackoverflow.com/a/25540740
tagged with: java
has answer: http://stackoverflow.com/a/29140206
has title: Using Android button to open new class/activity
tagged with: android-studio
answer count: 4
has answer: http://stackoverflow.com/a/25540747
type: Question
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25540760
tagged with: class
has body: I have created a text button on my activity_main that when clicked I want to open a new xml called gallery. I have created an xml and class for this. When I click the button it doesn't take me anywhere. activity_main.xml &lt;Button android:text="@string/Gallery" android:id="@+id/Button01" android:layout_width="200dp" android:textSize="28sp" android:background="@color/black" android:textColor="@color/pink" android:layout_height="70dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"&gt; &lt;/Button&gt; android manifest &lt;activity android:name=".Gallery" android:label="@string/app_name" /&gt; two.java import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.view.View; import android.widget.Button; public class Two extends Activity { Button Button01; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gallery); Button next = (Button) findViewById(R.id.Button01); next.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent myIntent = new Intent(view.getContext(), Gallery.class); startActivityForResult(myIntent, 0); } }); } } gallery.java import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; public class Gallery extends FragmentActivity { ViewPager mPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gallery); mPager = (ViewPager) findViewById(R.id.frame); mPager.setOffscreenPageLimit(1); mPager.setAdapter(new EndLessAdapter(this, mImageArray)); // Look up the AdView as a resource and load a request. AdView adView = (AdView) this.findViewById(R.id.adView); AdRequest adRequest = new …
score: 0

http://stackoverflow.com/q/25427104
has comment: http://stackoverflow.com/comment/39747104
linked to: http://stackoverflow.com/q/20325051
tagged with: android-emulator
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39747011
answer count: 1
downvote count: 0
upvote count: 1
has body: I downloaded Android Studio about 3 months ago and have not been able to get the emulator to work. I've checked out so many pages on Stackoverflow about the emulator and they say use GenyMotion (which caused another set of problems for me) and other things like lower the Emulator ram. I have tried all these things and not succeeded. My emulator shows a black screen and incredibly small buttons which I know is not how it should look (I watched video's on youtube) I would really appreciate some help, here are my PC's stats Ram:2GB Processor: Pentium(R) Dual-Core CPU E5800 @ 3.20GHz 3.20GHz 32 bit windows 7 If you can help me I'll be extremely grateful, I'm a student with not enough to buy an Android Device.
favorite count: 0
has title: Android Studio Emulator not working
has comment: http://stackoverflow.com/comment/39667513
score: 1
has answer: http://stackoverflow.com/a/25427496
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39715046

http://stackoverflow.com/q/25454063
has answer: http://stackoverflow.com/a/25454177
has title: Global variable creation order in Java
answer count: 4
has answer: http://stackoverflow.com/a/25454085
type: AnsweredQuestion
score: 0
has body: Is it guaranteed that below instances are created in order? For example, can we assume B is always created before E? public class Example { public static final Integer A = new Integer(1); public static final Integer B = new Integer(2); public static final Integer C = new Integer(3); public static final Integer D = new Integer(4); public static final Integer E = new Integer(5); public static final Integer F = new Integer(6); }
has comment: http://stackoverflow.com/comment/39717776
upvote count: 2
accepted answer: http://stackoverflow.com/a/25454087
tagged with: java
has answer: http://stackoverflow.com/a/25454268
downvote count: 2
has answer: http://stackoverflow.com/a/25454087
possible better answer: http://stackoverflow.com/a/25454085
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39717910

http://stackoverflow.com/a/25400176
has comment: http://stackoverflow.com/comment/39617376
has body: Is there a reason for you to use Enum? Because my guess judging by your problem statement that there isn't. So (also guessing) searchText is a String you split then you should not use split with " " but instead split your initial String with your desired delimiter as: String[] keywords = searchText.split("AND"); and you will get the array you expect. If on the other hand you need all delimiters simultaneously then use a regex inside split with multiple delimiters: String[] keywords = searchText.split("(AND)|(OR)");
type: Answer
answers question: http://stackoverflow.com/q/25399823
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/q/25416034
downvote count: 0
tagged with: wifi
upvote count: 1
has body: I have an android app . User can get wifi password nearby using my app, then could connect to wifi network. But if user kill my app after connected to wifi, my app have no chance to get notification, and user can still using wifi . How could I resolve the problem cause I want to know who is using my wifi and get the networktraffic of every user. In some mobile phone, user can kill ererything about the app include service, this make me confused. Please, thank you!
has title: get chance to do something when my app was killed
score: 1
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/25416158
type: UnansweredQuestion
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39627982
has text: I don't know either, it renders fine here.
score: 0
comment on: http://stackoverflow.com/q/25405780
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25393571
has comment: http://stackoverflow.com/comment/39619899
has comment: http://stackoverflow.com/comment/39617938
upvote count: 3
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39617078
answers question: http://stackoverflow.com/q/25392716
has comment: http://stackoverflow.com/comment/39625170
has comment: http://stackoverflow.com/comment/39626321
has body: Use new ByteArrayInputStream(request).
downvote count: 0
has comment: http://stackoverflow.com/comment/39621307

http://stackoverflow.com/comment/39875906
has text: "Added" to what? And no, different objects (with different addresses) can have the same hash code.
comment on: http://stackoverflow.com/a/25539398
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25445981
has body: I am trying to run an application (on MacOSX) that relies on Java. Docs are telling me that I need to update from Java 1.6 to 1.7. I then found, downloaded and installed java 7 from Java.com, but I'm still getting java version error when running app. when I enter 'java -version' into terminal it tells me I am still running 1.6? I'm sure there is a logical explanation for this, but at the moment I feel Like I am in the twilight zone. What is the current version, 1.7 or 7? Why is it that in System Preferences it says I have Java 7 installed, but 'java -version' says I have 1.6? Help!
has comment: http://stackoverflow.com/comment/39702450
answer count: 1
has comment: http://stackoverflow.com/comment/39702114
has title: Mac OSX. Java 7 or 1.7, which is the current version?
has comment: http://stackoverflow.com/comment/39702558
type: Question
has comment: http://stackoverflow.com/comment/39701987
has comment: http://stackoverflow.com/comment/39702319
linked to: http://stackoverflow.com/q/12757558
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39702016
tagged with: macos
has answer: http://stackoverflow.com/a/25446109
has comment: http://stackoverflow.com/comment/39703191
has comment: http://stackoverflow.com/comment/39701948
has comment: http://stackoverflow.com/comment/39702039
score: 0

http://stackoverflow.com/comment/39862104
type: QuestionComment
comment on: http://stackoverflow.com/q/25516980
has text: I do not think I have right solution in provided example, I should not change any DB settings to accomplish it.
score: 0
type: Comment

http://stackoverflow.com/q/25544378
type: Question
has answer: http://stackoverflow.com/a/25544717
score: 0
answer count: 2
has body: What is the best way to format the following number that is given to me as a String? String number = "1.574e10" //assume my value will always be a String I want this to be a String with the value: 1000500000.57 How can I format it as such?
has comment: http://stackoverflow.com/comment/39884449
has title: Formatting troubles: How to power to number?
possible better answer: http://stackoverflow.com/a/25544717
has comment: http://stackoverflow.com/comment/39884388
has comment: http://stackoverflow.com/comment/39884477
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25544441
has answer: http://stackoverflow.com/a/25544441
has comment: http://stackoverflow.com/comment/39886841

http://stackoverflow.com/comment/39932222
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25471195
has text: Actually the foreign key would go to the comments table. Picture{ private Comment comment; } So its Picture->Comment instead of Comment->Picture

http://stackoverflow.com/q/25511592
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25511778
has answer: http://stackoverflow.com/a/25511694
tagged with: http
has answer: http://stackoverflow.com/a/25512016
type: Question
tagged with: get
score: 0
tagged with: android
tagged with: java
has title: Authenticated POST/GET request for Android
has body: I'm new to http requests in general, but I think I've gotten the hang of it in Java now, at least for unauthenticated requests. I'm wondering how to form a GET request given the proper api URL, the authorization token and user_id (which is to be my parameter). I'm assuming this is basic http authentication but it seems as though that requires username and password. I was told by the backend developer that I simply need the token and user id. I've seen lots of examples of headers being created but none that have worked for me since I don't fully understand what the contents of the header must be. Any help is really appreciated.
tagged with: post

http://stackoverflow.com/comment/39666273
type: AnswerComment
comment on: http://stackoverflow.com/a/25425744
type: Comment
has text: @ Sam Dunk: I mean to say why not Alarm notify to me at 06:01 PM
score: 0

http://stackoverflow.com/comment/39745603
type: QuestionComment
has text: where does the java program record the data.A log file? Your question is incomplete and unclear. Why do you want to run a script for this?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25469006

http://stackoverflow.com/comment/39794247
score: 0
comment on: http://stackoverflow.com/a/25484243
type: Comment
type: AnswerComment
has text: To use this I need instance option likely `BitmapFactory.decodeFile(filePath, options);` but my bitmap have not any path.I tried to convert bitmap to byteArray which use `BitmapFactory.decodeFile(byteArray, options);` but it too faced outOfMemory problem.I know that I have to use this but I don't Know how?

http://stackoverflow.com/q/25490687
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39793874
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7794621
has body: I have difficulty understanding the following behaviour. class A { public String string = "a"; public String toString() { return string; } } class B extends A { } public class Demo { public static void main(String[] args) { B b = new B(); b.string = "c"; System.out.println(b); } } The output of the program is 'c'. This is expexted behaviour. But if class B is changed as follows, class B extends A { public String string = "b"; } Now the program prints 'a' instead of 'c'. Why the statement: b.string = "c"; is not taken into account? Thanks in advance..
answer count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/7794621
downvote count: 0
has title: Effect of hiding in polymorphism
upvote count: 1

http://stackoverflow.com/a/25485176
downvote count: 0
has comment: http://stackoverflow.com/comment/39775498
has comment: http://stackoverflow.com/comment/39775553
answers question: http://stackoverflow.com/q/25485091
has comment: http://stackoverflow.com/comment/39775622
type: Answer
has body: My Question is what should be its solution AllTest.MyTest test = new AllTest.MyTest(); should be either Test.MyTest test = new Test.MyTest(); or Test2.MyTest test = new Test2.MyTest(); why java allows to let it be? I don't really see the problem. As shown above, there's a trivial workaround.
upvote count: 2
score: 2

http://stackoverflow.com/comment/39879822
score: 0
type: Comment
type: QuestionComment
has text: Please post the code that you have so far.
comment on: http://stackoverflow.com/q/25541645

http://stackoverflow.com/q/25491966
tagged with: stack-trace
accepted answer: http://stackoverflow.com/a/25507871
has comment: http://stackoverflow.com/comment/39788858
possible better answer: http://stackoverflow.com/a/25492884
tagged with: unit-testing
has answer: http://stackoverflow.com/a/25507871
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25492884
score: 0
tagged with: spock
has comment: http://stackoverflow.com/comment/39791338
tagged with: java
has title: JUnit assertion failures are hideous. What can be done?
has body: I run my unit tests from the command line, invoking org.junit.runner.JUnitCore, and I find the way JUnit vomits assertion failures in my face with 35 lines of stack trace of which only 1 is relevant to me quite annoying. I’ve been playing around with the Spock Framework recently, and I find its output beautiful. However, its documentation seems to be lacking and the whole framework seems to be too much magic, so for now I prefer to stick with simpler, more well-known tools. So my question is if there’s a way to get JUnit display more to the point output without the irrelevant stack frames, at least in the case of assertion errors. Getting the detailed descriptions of assertions and concise exception reports of Spock would be nice, though. I use the command line, so IDEs are off the table, but I’m willing to trade JUnit for other solutions as long as they are simple, elegant and have good support.
has comment: http://stackoverflow.com/comment/39789920
type: Question
answer count: 2
tagged with: junit

http://stackoverflow.com/q/25544420
has comment: http://stackoverflow.com/comment/39885560
answer count: 0
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has body: I am getting the following error: *** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at ../../../src/share/instrument/JPLISAgent.c line: 844 *** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at ../../../src/share/instrument/JPLISAgent.c line: 844 | Error 2014-08-28 09:25:11,399 [http-bio-8080-exec-5] ERROR errors.GrailsExceptionResolver - StackOverflowError occurred when processing request: [GET] /api/getProduct - parameters: id: 14 Stacktrace follows: Message: Executing action [getProduct] of controller [project.ApiController] caused exception: Runtime error executing action Line | Method -&gt;&gt; 198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter | 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 745 | run . . . in java.lang.Thread my domains are as follows: class Product { String name String comments static hasMany = [components:Components] public asJSON(){ println "product: "+this.id def builder = new groovy.json.JsonBuilder() def root = builder { id this.id name this.name comments this.comments components this.components.collect {it.asJSON()} } return builder.toString().replaceAll(/\\"/, '"').replaceAll(/\"\{/,'{').replaceAll(/\}\"/,'}') } } Component: class Components { Product part_of static hasMany = [alternatives:Alternatives] public String asJSON(){ def builder = new groovy.json.JsonBuilder() def root = builder { id this.id product (this.part_of)?this.part_of.asJSON():null // alternatives (this.alternatives)?this.alternatives.collect {it.product.productAsJSON()} :null } return builder.toString() } } When I do the following I get the exception Product.get(1).asJSON() I have checked that it is not recursively c…
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39885716
has title: Java ASSERTION error in grails
tagged with: grails

http://stackoverflow.com/q/25503005
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39817745
has answer: http://stackoverflow.com/a/27538461
accepted answer: http://stackoverflow.com/a/27538461
has comment: http://stackoverflow.com/comment/52763914
favorite count: 0
has comment: http://stackoverflow.com/comment/52767358
type: Question
linked to: http://stackoverflow.com/q/18313323
score: 5
upvote count: 5
has body: Let there be an abstract class A with a property a and three non-abstract subclasses B, C and D. B has no additional property, C contains the property c and D contains both properties c and d. I would like to subclass StdDeserializer for the abstract class A to be able to decide based on the existence of properties to be deserialized which subclass to choose. I did that with some Jackson release from Codehaus before and it was working fine using the following implementation: class AbstractADeserializer extends StdDeserializer&lt;A&gt; { AbstractADeserializer () { super(A.class); } @Override public A deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectMapper mapper = (ObjectMapper) jp.getCodec(); ObjectNode root = (ObjectNode) mapper.readTree(jp); Class&lt;? extends A&gt; requestClass = null; // root.getFieldNames() is an iterator over all field names JsonNode cValue = root.findValue("c"); JsonNode dValue = root.findValue("d"); /* * Check for existence of required fields and choose the * corresponding request class. */ logger.debug(Boolean.toString(c != null)); logger.debug(Boolean.toString(d != null)); if(c != null &amp;&amp; d == null) { logger.debug("Found C"); requestClass = C.class; } else if(c != null &amp;&amp; d != null) { logger.debug("Found D"); requestClass = D.class; } else { logger.debug("Found B"); requestClass = B.class; } return mapper.readValue(root, requestClass); } } This worked fine but after migration to Jackson 2.4 from FasterXML ObjectMapper does not allow ObjectNode as a parameter for it's readValue method. When I modified the code to use return mapper.readValue(jp, requestClass); I always get com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input at [Source: org.apache.catalina.connector.CoyoteInputStream@1286ec89; line: 1, column: 559] at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148) at com.fasterxml.jackson.d…
has title: StdDeserializer for abstract class and it's subtypes
answer count: 1
has comment: http://stackoverflow.com/comment/39808527
tagged with: jackson
has comment: http://stackoverflow.com/comment/39824531
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/q/25523950
has comment: http://stackoverflow.com/comment/39847411
has comment: http://stackoverflow.com/comment/39848181
type: UnansweredQuestion
has title: Java MySQL query slower than expected
has body: I am trying to connect to my MySQL database using Java. Here is the code: Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD); java.sql.Statement stmt = connection.createStatement(); long startTime = System.currentTimeMillis(); stmt.execute("SELECT row_1, row_2, row_3, row_4 FROM dataset where row_5 is null and row_6 is null limit 100"); long endTime = System.currentTimeMillis(); System.out.println("That took " + (endTime - startTime) + " milliseconds"); ResultSet rs = stmt.getResultSet(); while (rs.next()) { System.out.println(rs.getString("row_1")); } stmt.close(); The table 'dataset' is 5 million rows, and is indexed on primary(row_1, row_2, row_3, row_4), and a second index (row_5 and row_6). Uncached, this query takes 1.9 ms using SequelPro for Mac (database management software). However when I run the code above in Java, it takes about 1800 ms (uncached). Please let me know if it's just Java that's slow or there is something I can do to optimise the query in Java, because it works perfectly fine using SequelPro or using other scripting languages.
has answer: http://stackoverflow.com/a/25527381
score: 0
has comment: http://stackoverflow.com/comment/39847462
tagged with: sql
tagged with: java
has comment: http://stackoverflow.com/comment/39847393
answer count: 1
tagged with: mysql
has comment: http://stackoverflow.com/comment/39848460
has comment: http://stackoverflow.com/comment/39848332
type: Question

http://stackoverflow.com/a/25454493
has body: Is there a way to capture the type of an anonymous class? No. You can only access it for reflection. If i can't invoke it, what's the use of being able to define it (if any-- other than being a helper to other methods of the anonymous class itself) in the anonymous class? Since they can only be referenced from within the anonymous type itself, they are of no use outside of it. So, as you say, they may be used to organize the logic within the class, but that's about it. The only exception is the edge case that @bcsb1001 describes, in which you invoke the method directly on the anonymous object creation expression (and not the variable to which it is assigned). the below worked... That's because the type of the expression new HelloWorld() { ... } is the type of the anonymous class. Since the creation expression has the actual anonymous class type, you can use it to access any members it declares. However, since the class is anonymous, it has no name, so you cannot declare a variable of the concrete anonymous type. The closest you can get is declaring a variable of HelloWorld. Since the variable is declared as HelloWorld, you can only use it to access members declared on HelloWorld or one of its supertypes. If Java added support for inferred types in declarations, you could write something like var g = new HelloWorld() { ... }; (C# style) or auto g = new HelloWorld() { ... }; (C++ style), and the type of g would be inferred from the assignment. That would allow you to capture the anonymous type without needing a type name. However, Java has no such capabilities at this time.
downvote count: 0
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25453209

http://stackoverflow.com/q/25512316
has answer: http://stackoverflow.com/a/25512627
tagged with: java
answer count: 1
has title: Set up catalina environment in ubuntu
type: Question
type: UnansweredQuestion
tagged with: javascript
tagged with: tomcat7
tagged with: ubuntu
tagged with: servlets
score: 0
has body: I have set up Tomcat7 and now i am being told to set up the CLASSPATH for Java servlets in the .cshrc file.But i don't have any .cshrc files.SO where do i set them up.Will setting it up in bashrc work?Also my Catalina in in /etc so i should just point to the Catalina folder in /etc right? The path of my Catalina folder is: /etc/tomcat7 So the path set up by me should be: setenv CATALINA=/etc/tomcat7 However there are 2 tomcat7 folders one in /etc and another in /var. What should i do? I am trying to implement the last section on this http://www.tutorialspoint.com/servlets/servlets-environment-setup.htm.But it is highly unclear to me.

http://stackoverflow.com/comment/39679519
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25433547
has text: Also did you try any of those? If so, what went wrong?
score: 1

http://stackoverflow.com/a/25503520
has comment: http://stackoverflow.com/comment/39837628
has comment: http://stackoverflow.com/comment/39845965
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25503486
upvote count: 1
has body: You forgot incrementing i in while loop. Iterator&lt;String&gt; i1 = processesOccupyingHugeMemory.iterator(); TextView[] text = new TextView[processesOccupyingHugeMemory.size()]; int i=0; while(i1.hasNext()) { text[i] = new TextView(this); text[i].setText(i1.next()); text[i].setAllCaps(true); text[i].setId(i); text[i].setLayoutParams(params); myLinearLayout.addView(text[i]); i++; } Other than that: Make sure you have used width WRAP_CONTENT in params, you use for textview. And if you want each textview in new line, then you will need to set orientation vertical for linear layout in xml. &lt;LinearLayout android:id="@+id/LinearLayout1" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt;
answers question: http://stackoverflow.com/q/25503486
has comment: http://stackoverflow.com/comment/39877493
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39845524
has comment: http://stackoverflow.com/comment/39845872

http://stackoverflow.com/a/25431164
answers question: http://stackoverflow.com/q/25430891
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39720991
downvote count: 0
score: 1
type: Answer
has body: Because Double is both final and immutable, you will have to encapsulate Double in a custom class, 'Value' for example. Then, you will update the Double field in the Value class each time you do a summation. Therefore, only the object of type Value strored in results will be updated. for(int x = 0;x&lt; 1000;x++){ for (int i = 0; i &lt; results.size(); i++) { for (int j = 0; j &lt; simSource.size(); j++) { Value buffer = results.get(i); buffer.doubleField += (simSource.get(j) * 0.5)/3; //System.out.println(results.get(i) + (simSource.get(j) * 0.5)/3); } } } BTW, since you are accessing the LinkedList by index, it will be better to use an ArrayList instead.
accepted answer of: http://stackoverflow.com/q/25430891
has comment: http://stackoverflow.com/comment/39718778
upvote count: 1

http://stackoverflow.com/comment/65032569
type: AnswerComment
comment on: http://stackoverflow.com/a/25677459
has text: Any stacktrace? Feel free to open an issue at https://issues.jboss.org/browse/FORGEPLUGINS
type: Comment
score: 0

http://stackoverflow.com/comment/39683858
type: AnswerComment
has text: Thanks Qualiture. I was hoping that I could avoid using the container provided javax.* classes by configuring the heavy resource classloader to not look to the parent classloader first (a child-first type class loader so to speak). Since I'm not relying on any NW JPA services I was thinking I could bundle the 2.1 JPA jars in the referenced Hibernate.ear file, but since the HeavyResources ClassLoader firsts looks to its parent when loading classes it was loading the JPA 1.0 jars from there and not the jar I provided. I punted and used the 3.3.2.GA version of Hibernate, which utilizes JPA 1.0.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25401487

http://stackoverflow.com/comment/39716704
comment on: http://stackoverflow.com/q/25419550
has text: How would I store the value when the phone gets turned off? I can store everything else with SharedPreferences but how would I achieve that? Does it account for time zone changes?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25541391
has body: I had Tomcat 8 installed on Eclipse and however I have removed that. Now I need it back. When I try to install tomcat 8 again, I get an issue. I do not get a window to direct the path where I have Tomcat 8 downloaded. It just gives the window which prompts to add the projects. But when I try to install another version of tomcat, everything is fine. I cannot work with other versions of tomcat since I have developed my projects using java 7. Could someone help me to solve the problem
upvote count: 1
type: UnansweredQuestion
score: 1
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25546649
tagged with: tomcat
favorite count: 0
type: Question
tagged with: eclipse
has title: Issue with Tomcat new installation in to Eclipse
downvote count: 0

http://stackoverflow.com/comment/39803836
has text: @Yogu depends on OP's needs. He said he has a list, so maybe he needs to get elements by index. Caching the hashcode will only work if the arrays are never modified.
type: Comment
comment on: http://stackoverflow.com/a/25420952
score: 0
type: AnswerComment

http://stackoverflow.com/a/25510654
has comment: http://stackoverflow.com/comment/39870518
has comment: http://stackoverflow.com/comment/39826450
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39823942
answers question: http://stackoverflow.com/q/25510417
has comment: http://stackoverflow.com/comment/39824096
type: Answer
score: 2
has body: From https://www.dropbox.com/developers/datastore/docs/android#com.dropbox.sync.android.DbxAccountManager.addListener: void addListener(AccountListener l) Adds an DbxAccountManager.AccountListener which will be called whenever a new account is linked or an existing account is unlinked. The listener will be called regardless of whether the account was unlinked using DbxAccount.unlink() or by the user on the Dropbox website. This notification will still presumably only fire after some communication with the server, since that's the only way for the client to know that something happened outside of the app.

http://stackoverflow.com/a/25435230
answers question: http://stackoverflow.com/q/25435090
type: Answer
downvote count: 0
has body: When compiling both Java and Groovy source in Gradle, you should generally put all your source in the 'src/main/groovy' directory to allow for cross-compiling. They can be separate (java in java, groovy in groovy); however, if there are cross-language dependencies you can run into compilation issues - this is what is seems you are running into. Also, as a side note, you don't need to apply the java plugin when you apply the groovy plugin - the groovy plugin depends on the java plugin so it will already be available.
upvote count: 1
score: 1

http://stackoverflow.com/comment/39789658
type: Comment
type: QuestionComment
has text: @DziNeIT it's a duplicate. Just check the answers on those questions, where concatenation inside a loop is covered as well.
comment on: http://stackoverflow.com/q/25492475
score: 0

http://stackoverflow.com/q/25529833
accepted answer: http://stackoverflow.com/a/25530827
type: Question
score: 2
has comment: http://stackoverflow.com/comment/39860521
has title: Realtime data management on webapp in a SOA environment (remote backend)
answer count: 1
downvote count: 0
tagged with: websocket
tagged with: web-services
favorite count: 0
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/25530827
tagged with: java
tagged with: spring
tagged with: asynchronous
has body: My system is composed by a web portal (Spring-based) and a remote backend (J2EE-based) that exposes APIs to provide services. An user should be capable to deploy a certain PaaS service on cloud (this process is managed by the backend) starting from the web portal and see the deployment status in realtime. Note: the mentioned deployment just represents a complex operation. In order to deploy a service as said, I defined on the backend a long running transaction that includes two parts: synchronous and asynchronous. The first one exposes a RESTful WebService, used to start the deploy process. It returns the unique id of the started transaction. String lrtId = myRESTClient.startDeploy(someInfo); The other part is useful to check the state of progress: it have to return an information that summarizes the deployment status (e.g. in progress, finished, stopped, a percentage of completion, a timestamp, etc.). To fetch this info in realtime, I thought about two solutions: Exposing this second part as another WebService and calling it by polling; Exposing it through WebSocket (and by using also other tools, for instance STOMP). Note that, for security reasons, backend endpoints have to be private, thus users cannot call directly the asynchronous part (by script): only the webapp must be able to communicate with the backend. To overcome this constraint, I thought to define a dedicated web-resource by Spring Web: its controller should hide the communication between portal and backend, retrieve and provided realtime data to another web-resouce (in this case, a web page). The image below summarizes the scenario: Being newbie on this use-case, I would like to know some suggestions about the proposed solutions. Are they adequate? Which is the better? There are important info to know in order to implement them? Is there something wrong?
has comment: http://stackoverflow.com/comment/39860696

http://stackoverflow.com/comment/39931776
type: QuestionComment
has text: If you consider doing more with your application, consider using `BigDecimal`. Cumbersome to use, but `double` is just an approximation of real numbers; 0.20 cannot be represented exacty for instance. _After your first rewrite._
score: 2
comment on: http://stackoverflow.com/q/25472446
type: Comment

http://stackoverflow.com/comment/39666934
comment on: http://stackoverflow.com/q/25426917
type: QuestionComment
score: 2
has text: This link could be helpful: http://stackoverflow.com/questions/3345857/how-to-get-list-of-ip-connected-in-lan-using-java
type: Comment

http://stackoverflow.com/comment/39744377
type: Comment
score: 0
type: AnswerComment
has text: ok and this doesn't throw exception but it never matches `\\s*c:(?:[\\/\\\\]{1,2}\\w+)+\\.\\w+`<< never matches `\\s*c:(?:[\\/\\]{1,2}\\w+)+\\.\\w+` << exception
comment on: http://stackoverflow.com/a/25468300

http://stackoverflow.com/comment/39676128
comment on: http://stackoverflow.com/a/25431144
type: AnswerComment
type: Comment
has text: Okay, But when I try to call my `DatabaseHandler` I got an error. You can see it at my question on Add edited Code
score: 0

http://stackoverflow.com/q/25540751
tagged with: file
favorite count: 0
type: Question
tagged with: file-io
has answer: http://stackoverflow.com/a/25540824
type: UnansweredQuestion
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/25541389
has body: This is my code so far but it overwrites what I have in the text file already. What I want is for it to add it to a new line in the text file. import java.io.*; import java.util.Scanner; public class Login{ public static void main(String[] args) throws IOException { Scanner s1,s2; s1 = new Scanner(new FileInputStream("login.txt")); s2 = new Scanner(System.in); boolean loggedIn = false; String name,pword,n,p; System.out.println("Are you a new user? (Type y for yes or n for no)"); String nU = s2.next(); if (nU.equals("n")) { System.out.println("Enter username:"); n=s2.next(); System.out.println("Enter password:"); p=s2.next(); while(s1.hasNext()){ name=s1.next(); pword=s1.next(); if(n.equals(name) &amp;&amp; p.equals(pword)){ System.out.println("You are logged in."); loggedIn = true; break; } } if(!loggedIn) System.out.println("Incorrect password or username."); } else if (nU.equals("y")) { Down here is where the problem with my code will be as this is where it is writing it to the file. PrintWriter out = new PrintWriter("login.txt"); System.out.println("Enter username:"); n=s2.next(); System.out.println("Enter password:"); p=s2.next(); out.append(n); out.append(p); out.close(); System.out.println("Account has been created and you are logged in."); } else System.out.println("Invalid response.");
upvote count: 0
answer count: 3
has title: How do I add data to text file and not overwrite what I have in Java
has answer: http://stackoverflow.com/a/25540826
has comment: http://stackoverflow.com/comment/39878726
downvote count: 2

http://stackoverflow.com/comment/39801066
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25498874
has text: what is the pupose of the id array? do you really need it or is it 'just' for sorting the list?

http://stackoverflow.com/q/25466856
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
score: 1
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25487700
has title: Can someone explain (in detail) how the various options in a Dagger @Module annotation work and interact with each other?
tagged with: dagger
has body: I see some documentation and blogs, but nothing that pulls it all together. If that exists, a pointer to that might be sufficient. I think I understand some of the basics, but please correct me if I am wrong. library = true means Dagger should verify that every @Provides in a module is used to inject something in the the list of classes listed in the injects = { ... } list library = false disables this check, becuase maybe you use this module in several places/projects and not every @Provides is used. complete = true means that this module can satisfy all of the dependencies needed for all the classes listed in the injects = { ... } I don't understand how includes and addsTo work, and how they can (or even should) be used to enable setting complete = true. For example, say I create an initial graph by using ObjectGraph graph = ObjectGraph.create(moduleA, moduleB); and then I extend that graph using ModuleC. ObjectGraph extendedGraph = graph.plus(new ModuleA()); It seems to me that the graph was constructed from ModuleA and ModuleB, so I would want to say ModuleC addsTo both ModuleA and ModuleB, but addsTo only allows one. Should we say that ModuleC includes ModuleA and ModuleB and then say ModuleC is complete?
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/comment/39853316
score: 0
type: Comment
has text: You may add `consumes` and `produces` to your `RequestMapping`.
type: QuestionComment
comment on: http://stackoverflow.com/q/25527256

http://stackoverflow.com/a/50974462
answers question: http://stackoverflow.com/q/25465771
type: Answer
has body: I think the latest javamail version available from oracle is javamail 1.4.7 (the TLS issue sending mails was fixed on version 1.4.5). You can download the javamail_1.4.7 from oracle and follow the intructions above. Or, I have the plugin updated and ready to copy and paste, you can download it on this link Paste and replace the updated file (com.ibm.ws.prereq.javamail.jar) in WebSphere\AppServer\plugins (You have to replace the default com.ibm.ws.prereq.javamail.jar with the file you downloaded from my link, please make sure to backup the file before make some changes) Note: This fix was tested on IBM WAS 8.5
score: 0

http://stackoverflow.com/comment/39867861
has text: There must be some way. Writing a manual function to do it or something.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25535057

set
tags question: http://stackoverflow.com/q/25423526
tag name: set
tags question: http://stackoverflow.com/q/25399199
tags question: http://stackoverflow.com/q/25516294
type: Tag
tags question: http://stackoverflow.com/q/25469115
tags question: http://stackoverflow.com/q/25415970
tags question: http://stackoverflow.com/q/25514213
tags question: http://stackoverflow.com/q/25519377

http://stackoverflow.com/comment/39814583
has text: @ fpsColton thanks your answer , i have tried close() function in my smack code but when i tried to attach on strophe ,bosh manages was not accepting the attach!!!can you please tell me what would be the reasons??again i am using same rid and sid which is passed by app server ,i am also increasing rid to rid+1.
type: AnswerComment
comment on: http://stackoverflow.com/a/25456112
score: 0
type: Comment

http://stackoverflow.com/a/25462338
answers question: http://stackoverflow.com/q/25461587
score: 1
upvote count: 1
downvote count: 0
type: Answer
has body: Using in.nextDouble() instead of in.nextInt() you can get rid of the error.

regex
tags question: http://stackoverflow.com/q/25508309
tags question: http://stackoverflow.com/q/25389880
tags question: http://stackoverflow.com/q/25510402
tags question: http://stackoverflow.com/q/25391459
tags question: http://stackoverflow.com/q/25512968
tags question: http://stackoverflow.com/q/25528710
tags question: http://stackoverflow.com/q/25445169
tags question: http://stackoverflow.com/q/25435327
tags question: http://stackoverflow.com/q/25425755
tags question: http://stackoverflow.com/q/25427065
tags question: http://stackoverflow.com/q/25446633
tags question: http://stackoverflow.com/q/25492100
tags question: http://stackoverflow.com/q/25466693
tags question: http://stackoverflow.com/q/25540636
tags question: http://stackoverflow.com/q/25549820
tags question: http://stackoverflow.com/q/25508878
tags question: http://stackoverflow.com/q/25544617
tags question: http://stackoverflow.com/q/25451331
tags question: http://stackoverflow.com/q/25501539
tags question: http://stackoverflow.com/q/25531215
tags question: http://stackoverflow.com/q/25425386
tags question: http://stackoverflow.com/q/25397135
tags question: http://stackoverflow.com/q/25393482
tags question: http://stackoverflow.com/q/25408290
tags question: http://stackoverflow.com/q/25549362
tag name: regex
tags question: http://stackoverflow.com/q/25527138
tags question: http://stackoverflow.com/q/25463796
tags question: http://stackoverflow.com/q/25548466
tags question: http://stackoverflow.com/q/25497802
tags question: http://stackoverflow.com/q/25483256
tags question: http://stackoverflow.com/q/25400968
tags question: http://stackoverflow.com/q/25487736
tags question: http://stackoverflow.com/q/25418729
tags question: http://stackoverflow.com/q/25497954
tags question: http://stackoverflow.com/q/25533726
tags question: http://stackoverflow.com/q/25461161
tags question: http://stackoverflow.com/q/25395233
tags question: http://stackoverflow.com/q/25415691
tags question: http://stackoverflow.com/q/25483586
tags question: http://stackoverflow.com/q/25392999
tags question: http://stackoverflow.com/q/25407342
tags question: http://stackoverflow.com/q/25428573
tags question: http://stackoverflow.com/q/25539405
tags question: http://stackoverflow.com/q/25480496
tags question: http://stackoverflow.com/q/25410312
tags question: http://stackoverflow.com/q/25546080
tags question: http://stackoverflow.com/q/25495472
tags question: http://stackoverflow.com/q/25484164
tags question: http://stackoverflow.com/q/25429659
tags question: http://stackoverflow.com/q/25399798
tags question: http://stackoverflow.com/q/25485579
tags question: http://stackoverflow.com/q/25443038
tags question: http://stackoverflow.com/q/25458258
tags question: http://stackoverflow.com/q/25511198
tags question: http://stackoverflow.com/q/25392533
tags question: http://stackoverflow.com/q/25481435
tags question: http://stackoverflow.com/q/25406728
tags question: http://stackoverflow.com/q/25456951
tags question: http://stackoverflow.com/q/25483023
tags question: http://stackoverflow.com/q/25521100
tags question: http://stackoverflow.com/q/25440338
tags question: http://stackoverflow.com/q/25419070
tags question: http://stackoverflow.com/q/25401557
tags question: http://stackoverflow.com/q/25452940
tags question: http://stackoverflow.com/q/25538220
tags question: http://stackoverflow.com/q/25427711
tags question: http://stackoverflow.com/q/25397469
tags question: http://stackoverflow.com/q/25477939
type: Tag
tags question: http://stackoverflow.com/q/25509234
tags question: http://stackoverflow.com/q/25468220
tags question: http://stackoverflow.com/q/25494450
tags question: http://stackoverflow.com/q/25464729
tags question: http://stackoverflow.com/q/25447222

http://stackoverflow.com/q/25473626
has title: Deleting unit tests during TDD process
answer count: 3
possible better answer: http://stackoverflow.com/a/25477520
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25477520
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/39754270
favorite count: 0
type: Question
downvote count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/5142103
accepted answer: http://stackoverflow.com/a/25476165
has body: I am currently reading a book about testing with testNG and Mockito in order to refine my skills of using that tools, widen my knowledge about testing in general and improve the quality of code I create. After the 4th chapter, "Test Driven Development" there are plenty of exercises I should do to harden what I have just learnt about TDD and to get a habit of the cycle Red Test -> Implement code -> Green Test -> Refactor. One of them is called "PasswordValidator", which should, well, validate strength of a password. One of recommended approaches to such development is to start with the easiest possible test and incrementally, by writing more complicated test cases, implement more complex functionality. Truth be told, normally I would solve that problem by writing a proper regex ( like for instance this one: https://stackoverflow.com/a/5142164/2576122), write a few tests that will cover whatever border cases I might imagine and be done with that. And here, I go with firstly creating PasswordValidatorTest class and in it tests such as: @Test public void returnsTrueWhenPasswordIsAtLeastEightCharsLong() { assertTrue(atLeastEightCharactersLong(EIGHT_CHARACTERS_LONG_PASSWORD)); } I check that it fails, implement logic in PasswordValidator: public static boolean atLeastEightCharactersLong(String passwordToValidate) { if (passwordToValidate.length() &gt;= 8) { return true; } else { return false; } } I check that it is green, then I refactor: public static boolean atLeastEightCharactersLong(String passwordToValidate) { return (passwordToValidate.length() &gt;= 8); } The same goes with tests for containing digits, special signs etc. At some point of such procedure, I end up with a final test: @Test public void shouldReturnTrueIfPasswordIsValid() { assertTrue(PasswordValidator.isValid(VALID_PASSWORD_EXAMPLE)); } For which implementation is: public static boolean isValid(String passwordToValidate) { return atLeastEightCharactersLong(passwordToValidate) &amp;&amp; containsAtLeast…
tagged with: tdd
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25729758
has answer: http://stackoverflow.com/a/25476165

http://stackoverflow.com/comment/39888599
comment on: http://stackoverflow.com/a/25546217
score: 0
type: AnswerComment
has text: Thank you for the reply. I will edit the question to clarify some more problems of session scope use : there is a spring based pool scheduler in our application, that can call Component1 method, in this case we will not have any session at all. The second problem is that my problem is not big enough to change exist session management in application.
type: Comment

http://stackoverflow.com/comment/70146676
score: 0
has text: There is an answer to your question here: http://stackoverflow.com/questions/39529042/apache-poi-how-to-add-diagonal-border
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25522103

solace
tags question: http://stackoverflow.com/q/25533961
tag name: solace
type: Tag

http://stackoverflow.com/a/25451045
has comment: http://stackoverflow.com/comment/39731499
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25450955
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39736482
answers question: http://stackoverflow.com/q/25450955
score: 2
has body: At first, the List has no type, so how can it add a String? So it should be: private ArrayList<String> list; So the first compile error ist the add method It is a raw List, so it's like List<Object>, it can accept everything that is an Object, and String is an Object. You should not declare it as ArrayList because that's the specific implementation, instead keep it like List<String>. If you declare it raw, it won't raise a compiler error, but a warning. Now, this code: public LinkedList addHello() { this.list.add("Hello"); return this.list; } This simply won't compile because you state you have to return a (raw) LinkedList but you instead return a (raw) List. This is wrong because you cannot return a super type when you state you will return a more specific type. If moving this example for fruits, it's like your method states I will always return oranges but the implementation returns a fruit, which may be an apple, a strawberry or whatever that is not an orange. To solve this, just change the return type: public List addHello() { this.list.add("Hello"); return this.list; } And, as @ElliotFrisch covered in his answer, just don't use raw types in your code, instead add the generic check for compilation (because at runtime it will be erased). if you have a interface, and you use it as a variable and then you refer to a class that has implemented the interface ( this.list = new LinkedList(); ), It does not mean that the List technically became a LinkedList, right? Covered here: What does it mean to "program to an interface"?
type: Answer

http://stackoverflow.com/a/25529633
score: 0
answers question: http://stackoverflow.com/q/25529385
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39857973
has comment: http://stackoverflow.com/comment/39857923
has comment: http://stackoverflow.com/comment/39858528
type: Answer
accepted answer of: http://stackoverflow.com/q/25529385
has body: You can't convert a Swing application to a web application, at least not in an easy way. An option would be to create your 2nd application as an Applet, that way you could use Swing and you could integrate it fairly easily into your web application. There is another option: Deploy and run Java Swing applications in browser by automatically converting them to HTML/JavaScript. This is however not a free service/solution and I can't give further advice on this. But since you have to rewrite the 2nd app from start (which you wanted to do using Swing), you'd better do that as a webapp as well, and then you will have no problem integrating it into your first application. GWT is already very similar to Swing (you can create GWT apps mostly using Java code, it uses components called widgets, panels, events and event handlers) so if you create your webapp using Google GWT, it will be easy to do your 2nd app too.

http://stackoverflow.com/comment/40295314
has text: That doesn't make any sense. I don't want to provide the property. I want to ignore it when the client sends it to me.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25767146

http://stackoverflow.com/q/25422297
has title: Sonarqube - documented API configuration
score: 1
tagged with: java
answer count: 1
tagged with: javadoc
has body: I use sonarqube 4.3.2 for java project. Is there any way to configure sonarqube settings when checking javadoc for public API? Right now all uncodumented public classes/methods/constructors are checked for javadoc. I would like to skip checking on default constructors and setters/getters.
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25425643
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: sonarqube

arraylist
tags question: http://stackoverflow.com/q/25449615
tags question: http://stackoverflow.com/q/25449543
tags question: http://stackoverflow.com/q/25525646
tags question: http://stackoverflow.com/q/25485648
tags question: http://stackoverflow.com/q/25539525
tags question: http://stackoverflow.com/q/25503556
tags question: http://stackoverflow.com/q/25448434
tags question: http://stackoverflow.com/q/25487931
tags question: http://stackoverflow.com/q/25537953
tags question: http://stackoverflow.com/q/25501441
tags question: http://stackoverflow.com/q/25484363
tags question: http://stackoverflow.com/q/25468811
tags question: http://stackoverflow.com/q/25489528
tags question: http://stackoverflow.com/q/25499874
tags question: http://stackoverflow.com/q/25411503
tags question: http://stackoverflow.com/q/25476133
tags question: http://stackoverflow.com/q/25457973
tags question: http://stackoverflow.com/q/25461794
tags question: http://stackoverflow.com/q/25403314
tags question: http://stackoverflow.com/q/25510808
tags question: http://stackoverflow.com/q/25515064
tags question: http://stackoverflow.com/q/25416251
tags question: http://stackoverflow.com/q/25421992
tags question: http://stackoverflow.com/q/25523082
tags question: http://stackoverflow.com/q/25504596
tags question: http://stackoverflow.com/q/25436043
tags question: http://stackoverflow.com/q/25467466
tags question: http://stackoverflow.com/q/25472891
tags question: http://stackoverflow.com/q/25498481
tags question: http://stackoverflow.com/q/25513751
tags question: http://stackoverflow.com/q/25409232
tags question: http://stackoverflow.com/q/25455056
tags question: http://stackoverflow.com/q/25467705
tags question: http://stackoverflow.com/q/25416657
tags question: http://stackoverflow.com/q/25501746
tags question: http://stackoverflow.com/q/25396472
tags question: http://stackoverflow.com/q/25425801
tags question: http://stackoverflow.com/q/25487991
tags question: http://stackoverflow.com/q/25460409
tags question: http://stackoverflow.com/q/25401007
tags question: http://stackoverflow.com/q/25505648
tags question: http://stackoverflow.com/q/25507741
tags question: http://stackoverflow.com/q/25432408
tags question: http://stackoverflow.com/q/25468514
tags question: http://stackoverflow.com/q/25496420
tags question: http://stackoverflow.com/q/25448145
tags question: http://stackoverflow.com/q/25507271
tags question: http://stackoverflow.com/q/25542091
tags question: http://stackoverflow.com/q/25439409
tags question: http://stackoverflow.com/q/25501644
tags question: http://stackoverflow.com/q/25517536
tags question: http://stackoverflow.com/q/25546141
type: Tag
tags question: http://stackoverflow.com/q/25513600
tags question: http://stackoverflow.com/q/25412341
tags question: http://stackoverflow.com/q/25495622
tags question: http://stackoverflow.com/q/25543351
tags question: http://stackoverflow.com/q/25498874
tags question: http://stackoverflow.com/q/25393514
tags question: http://stackoverflow.com/q/25429816
tags question: http://stackoverflow.com/q/25544978
tags question: http://stackoverflow.com/q/25462098
tags question: http://stackoverflow.com/q/25481934
tag name: arraylist
tags question: http://stackoverflow.com/q/25475963
tags question: http://stackoverflow.com/q/25540739
tags question: http://stackoverflow.com/q/25485390
tags question: http://stackoverflow.com/q/25473976
tags question: http://stackoverflow.com/q/25545473
tags question: http://stackoverflow.com/q/25427669
tags question: http://stackoverflow.com/q/25503619
tags question: http://stackoverflow.com/q/25547930
tags question: http://stackoverflow.com/q/25428967
tags question: http://stackoverflow.com/q/25455837

http://stackoverflow.com/a/25513837
score: 2
has comment: http://stackoverflow.com/comment/39829379
has comment: http://stackoverflow.com/comment/39829218
downvote count: 0
answers question: http://stackoverflow.com/q/25513763
has comment: http://stackoverflow.com/comment/39829194
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25513763
has comment: http://stackoverflow.com/comment/39829243
type: AcceptedAnswer
type: Answer
has body: If you can't use value.compareTo(false) strictly because it's primitive, then how about Boolean.valueOf(value).compareTo(Boolean.FALSE);

http://stackoverflow.com/q/25509825
answer count: 1
tagged with: web-services
tagged with: glassfish
score: 0
has body: i want my webclient to be forced to send a ssl certificate during SSLTransaction establishment. I do not succeed in configuring my webservices application (metro jax-ws + glassfish) to have it done. (i check using openssl that 'No client certificate CA names sent' by server ) My web.xml contains: CLIENT-CERT <web-resource-collection> SSL constraint /* GET POST </web-resource-collection> INTEGRAL My keystore.jks, and cacerts.jks contains aliases xws-security-client and xws-security-server with correct certificate. Where are my errors or miss ? How i can debug ? i just want both side ssl authentication.(client/server)
tagged with: java
tagged with: ssl
tagged with: jax-ws
has answer: http://stackoverflow.com/a/25664986
type: Question
type: UnansweredQuestion
has title: Java-Metro, from glassfish server side, i do not succeed in forcing client ssl certificate to be sent?

http://stackoverflow.com/comment/39813387
has text: i mean where and how to check consecutive positions?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25505196
type: AnswerComment

http://stackoverflow.com/comment/39807117
has text: Patched it but the methods as mentioned in [the first answer of this question](https://stackoverflow.com/questions/12156801/trouble-getting-axis-centered-on-origo-in-achartengine) won't work.
type: Comment
comment on: http://stackoverflow.com/q/25463308
score: 0
type: QuestionComment

http://stackoverflow.com/q/25450455
tagged with: arrays
downvote count: 1
has comment: http://stackoverflow.com/comment/39710431
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25450587
tagged with: rest
type: UnansweredQuestion
tagged with: jackson
has title: Populate POJO with array (root JSON node) using Jackson
score: 0
has answer: http://stackoverflow.com/a/61727190
has answer: http://stackoverflow.com/a/25450817
has body: I'm using Jackson and RESTEasy to hook into an external API. The API mainly returns simple objects which I have managed to successfully populate into POJOs. I'm hitting a problem where I get an array of objects back e.g. [ { "variable1": "someValue1", "variable2": "someValue2", "variable3": "someValue3" } { "variable1": "someValue4", "variable2": "someValue5", "variable3": "someValue6" } { "variable1": "someValue7", "variable2": "someValue8", "variable3": "someValue9" } ] I have 2 classes: one called VariableObject which looks like this: public class VariableObject { private String variable1; private String variable2; private String variable3; } and VariableResponse which looks like: public class VariableResponse { private List&lt;VariableObject&gt; variableObjects; } My client uses JAXRS Response class to read the entity into the class i.e return response.readEntity(VariableResponse.class); I get a stack trace which reads: Caused by: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of VariableResponse out of START_ARRAY token I understand you can return these as a List of POJOs i.e List quite easily, but this is not what I want to do. The question really is two parts: a. Can I possibly populate the VariableResponse POJO using Jackson (some how) preferably without a customer deserialiser? Maybe some annotation exists (this would be ideal)? b. Is there some way to detect if an Array is being retuned as the root JSON node in the response and then act accordingly? Help greatly appreciated.
answer count: 3
upvote count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json

spring-android
type: Tag
tag name: spring-android
tags question: http://stackoverflow.com/q/25531109

http://stackoverflow.com/q/25505987
type: Question
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/39814388
has title: How to transfer session objects among domain
accepted answer: http://stackoverflow.com/a/25506063
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25506063
has body: I need to redirect from one domain into an another. Hence I am using sendRedirect(url). But i need to also get few attributes which were set in session. Is there any way to get the session attributes after using sendRedirect(url)?
tagged with: java
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/39814304
has comment: http://stackoverflow.com/comment/39814290
favorite count: 0
linked to: http://stackoverflow.com/q/13461838

http://stackoverflow.com/comment/39866017
type: AnswerComment
comment on: http://stackoverflow.com/a/25534165
has text: what is the type of `a` then?
type: Comment
score: 0

http://stackoverflow.com/q/25465087
tagged with: jdialog
type: Question
score: 1
tagged with: java
type: AnsweredQuestion
has body: I have a JFrame that creates a modeless JDialog. Under certain situations (maybe always) that I pass to the JDialog constructor, I would like the JDialog to remain visible but have control return to the calling JFrame. The user may subsequently interact with, or close, the JDialog. I've researched, but have not found a way to do this. Any suggestions/help appreciated.
has title: Relinquish control in JDialog
downvote count: 0
has answer: http://stackoverflow.com/a/25465188
accepted answer: http://stackoverflow.com/a/25465188
tagged with: jframe
upvote count: 1
answer count: 1
tagged with: swing
favorite count: 0

http://stackoverflow.com/comment/39754843
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25472930
score: 0
has text: I ADDED THE WHOLE CODE for the class. I have since FIXED it by moving the button's constructor to within the "displayAct" class, and moving the code for "setupButton" to within the same class. I still don't completely understand, but it works now. Somehow the single button, with a large scope, was getting multiple ActionListeners added onto it, but I didn't think I was calling that method multiple times.

http://stackoverflow.com/q/25529869
accepted answer: http://stackoverflow.com/a/25536638
tagged with: java
answer count: 1
tagged with: swing
type: Question
has body: Yeah I know, this sounds stupid. But before let me illustrate my problem. I have a GUI with A LOT of JTable. I have various DefaultTableModel, one for each JTable. So, 1:1. And for each DefaultTableModel I have create one a TableModelListener. For insert and delete elements in my GUI I have create only TWO methods, addVehicle and removeVehicle: public void addVehicle(final DefaultTableModel model, final String s1, final String s2) { Runnable addV = new Runnable() { @Override public void run() { model.addRow(new Object[] { s1, s2 }); } }; SwingUtilities.invokeLater(addV); } public void removeVehicle(final DefaultTableModel model, final int index) { if (row!=null){ String s1= row.elementAt(0).toString(); Runnable removeV = new Runnable() { @Override public void run() { model.removeRow(index); } }; SwingUtilities.invokeLater(removeV); } } These methods are perfect, recognize automatically the right tablemodel. But I have a necessity: since I have many JTable (and corresponding DefaultTableModels) and given that when I add/delete a row from a table a third-party software MUST BE INFORMED, I have created several TableModelListener. For example listener1: TableModelListener listener1 = new TableModelListener() { public void tableChanged(TableModelEvent e) { DefaultTableModel m = (DefaultTableModel) e.getSource(); int row = e.getLastRow(); switch (e.getType()) { case (TableModelEvent.INSERT): { System.out.println("Insert! Key: "+m.getValueAt(row, 0)); // My agent, the third-party software: shipperAgent.newTruck((String) m.getValueAt(row, 0)); } break; case (TableModelEvent.DELETE): { System.out.println("Delete! Key:"+m.getValueAt(row, 0)); // My agent, the third-party software: shipperAgent.removeTruck((String)m.getValueAt(row, 0)); } break; case (TableModelEvent.UPDATE): { // ... } break; } } }; Another example is listener 2 (I show you just a fragment...): case (TableModelEvent.INSERT): { System.out.println("Activate! Key: "+m.getValueAt(row, 0)); // My agent, the third-…
has title: Use the row's data AFTER its remove from DefaultTableModel
has answer: http://stackoverflow.com/a/25536638
linked to: http://stackoverflow.com/q/26382515
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/26142930

http://stackoverflow.com/comment/39711395
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25449844
has text: This because your app is not compatible with your device. It might happen when u set the minSDKVersion value to high and If your device API level is lower then minSDKVersion then it gives parsing package error or may be u have set the maxSDKVersion to lower than your device API level. like for example If your device is Android 2.1 & if u set the APK minSDKVersion to 10 then it wont work in the Android 2.1 and will give the parsing package error.
type: Comment

http://stackoverflow.com/comment/39769104
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25481435
type: Comment
has text: While looping you can always detect a space and then check whether next char is `k` or not. If it is `k` then ignore whole word.

http://stackoverflow.com/comment/40007820
type: Comment
type: AnswerComment
has text: Thank you for the explanation on the behaviour of Java 7 and why it doesn't work with Play. Unfortunately using Play 2 with Google App Engine isn't as straight forward as with Play 1. And unfortunately Google doesn't respond on the request to continue using Java 6: http://stackoverflow.com/q/25610256/467650
score: 0
comment on: http://stackoverflow.com/a/25475047

http://stackoverflow.com/a/25497819
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25497125
has comment: http://stackoverflow.com/comment/39799463
has comment: http://stackoverflow.com/comment/39799704
has body: The tricky thing about OutOfMemoryErrors is that they don't necessarily have anything to do with the line of code where the crash occurred. If your app has a memory leak, it could be anywhere. The allocation that used the last bit of memory might be completely unrelated to the leak. You need to learn how to use a memory analyzer like Eclipse MAT.

http://stackoverflow.com/q/25525477
has title: How to send java object in angular JS
tagged with: angularjs
type: Question
has comment: http://stackoverflow.com/comment/39853932
tagged with: javascript
has body: I have JS file that is trying to do a POST method, but needs a specific java object as input. here is the signature of the Post method in the server: @Path("/branches") public class BranchResource { @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response post(BranchDescriptor branch) { . . here is the the JS function (using Angular) $scope.retry = function() { $http({ url : "rest/branches", method : "POST", dataType : "json",//not sure is needed data : "way to get Branch descriptor " headers : { "Content-Type" : "application/json; charset=utf-8", "Accept" : "application/json" } }).success(function(data) { $scope.items = data; }).error(function(data) { alert('err'); }); }; I was receiving the following errors: ??? 27, 2014 3:27:48 PM com.sun.jersey.spi.container.ContainerRequest getEntity SEVERE: A message body reader for Java class xxx.api.BranchDescriptor, and Java type class xxx.BranchDescriptor, and MIME media type application/octet-stream was not found. The registered message body readers compatible with the MIME media type are: application/octet-stream -&gt; com.sun.jersey.core.impl.provider.entity.ByteArrayProvider com.sun.jersey.core.impl.provider.entity.FileProvider com.sun.jersey.core.impl.provider.entity.InputStreamProvider com.sun.jersey.core.impl.provider.entity.DataSourceProvider com.sun.jersey.core.impl.provider.entity.RenderedImageProvider */* -&gt; So, I tried to add a data like that: data : { "_protectedBranch" : "pf_something", "_newBranch" : "some_branch", "_commitId" : "some_commit", "_commiter" : "someone" }, and got the following error: ??? 27, 2014 3:42:46 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "_protectedBranch" (Class xxx.BranchDescriptor), not marke…
has answer: http://stackoverflow.com/a/25544579
accepted answer: http://stackoverflow.com/a/25544579
tagged with: post
has answer: http://stackoverflow.com/a/25525569
favorite count: 0
has comment: http://stackoverflow.com/comment/39850262
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39851208
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/25525616
score: 1
possible better answer: http://stackoverflow.com/a/25525569
downvote count: 1
tagged with: http
has comment: http://stackoverflow.com/comment/39850297

http://stackoverflow.com/q/25397800
answer count: 1
has body: I have a class named Garage : class Garage extends Vehicle implements Cloneable { Vehicle[] v= new Vehicle [10]; public Garage () { for (int i=0;i&lt;10;i++) this.v[i]=new Vehicle (); } public Garage clone () throws CloneNotSupportedException { try { return (Garage) super.clone (); } catch (CloneNotSupportedException e) { return null; } } public static void main (String[] args) { Garage g1,g2; g1=new Garage (); for (int i=0;i&lt;10;i++) g1.v[i].setVehicleAttr (i,i,i,Integer.toString(i)); g2=new Garage (); g2 = g1.clone (); } }; When I compile it.. It give The Following Error... Even Though i have handled the exception it says exception must be caught...Why is this happening....? Garage.java:32: error: unreported exception CloneNotSupportedException; must be caught or declared to be thrown g2 = g1.clone ();
downvote count: 0
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39614220
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39613132
tagged with: clone
tagged with: exception
has comment: http://stackoverflow.com/comment/39633190
tagged with: java
has title: Implementing a clone function
type: Question
has comment: http://stackoverflow.com/comment/39613148
accepted answer: http://stackoverflow.com/a/25397812
score: 1
has answer: http://stackoverflow.com/a/25397812

http://stackoverflow.com/q/25436071
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has title: What are the attributes to pass JTextPane?
upvote count: 1
tagged with: jtextpane
tagged with: swing
has answer: http://stackoverflow.com/a/25436273
favorite count: 0
accepted answer: http://stackoverflow.com/a/25436273
has answer: http://stackoverflow.com/a/25436292
possible better answer: http://stackoverflow.com/a/25436292
has body: I try to use JTextPane to style some text. I have the following code: try { Document d = new DefaultStyledDocument(); SimpleAttributeSet set = new SimpleAttributeSet(); d.insertString(0, "Hello-World", set); jTextPane1.setDocument(d); } catch (BadLocationException ex) { Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex); } How do I get the names of the attributes that can be passed to JTextPane?

http://stackoverflow.com/comment/40362119
has text: In order to find the cause and eventually to make sure there is no circular reference begin to comment out JPA-mapped property one-by-one, till you find what is causing the problem.
comment on: http://stackoverflow.com/a/25788978
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39882843
comment on: http://stackoverflow.com/q/25542849
type: Comment
type: QuestionComment
score: 0
has text: @StephaneMathis : Actually `override` in C# is an access modifier and yes, it is required in certain situations (overriding virtual or abstract methods) but it's also possible to 'hide' methods in C# which is subtly different and allows defining methods with the same signature as in the super-class but defining them with the `new` keyword.

http://stackoverflow.com/a/65840450
score: 0
has body: For me, Build -&gt; Recompile created out folder described in Project Structure. then it could find my classes.
answers question: http://stackoverflow.com/q/25513788
type: Answer

http://stackoverflow.com/q/25546496
has comment: http://stackoverflow.com/comment/39888872
tagged with: maven
has answer: http://stackoverflow.com/a/25565161
upvote count: 1
tagged with: m2e
has comment: http://stackoverflow.com/comment/39888645
favorite count: 0
has comment: http://stackoverflow.com/comment/39889116
type: Question
has comment: http://stackoverflow.com/comment/39889546
has comment: http://stackoverflow.com/comment/39888681
has body: I use here Eclipse with m2e plugin. If I do a project clean, it doesn't do anything. On my experiments, I see as if m2e simply weren't wired into the eclipse project cleaning option. I've tried to set up in lifecycle-mapping-metadata.xml, but it didn't work. If I understand this well, maybe a clean can't be set up here, because cleaning is not considered as part of a project lifecycle from the viewpoint of the eclipse. So, is there any way to do a simple mvn clean from eclipse on a project cleanup? (The ideal solution didn't require to start a new jvm, and all run inside of the eclipse process.)
has title: Using maven-clean-plugin with m2e
tagged with: eclipse
tagged with: maven-clean-plugin
has comment: http://stackoverflow.com/comment/39888808
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/25565161
tagged with: java
has comment: http://stackoverflow.com/comment/39889086
downvote count: 0
answer count: 1

http://stackoverflow.com/q/25549638
has comment: http://stackoverflow.com/comment/39895359
answer count: 3
has comment: http://stackoverflow.com/comment/39894307
has comment: http://stackoverflow.com/comment/39895103
tagged with: file
has comment: http://stackoverflow.com/comment/39894782
has answer: http://stackoverflow.com/a/25549921
tagged with: bufferedreader
has body: i am using JFileChooser to get the text from a txt and later handle it. But at the time i print it, the program only recover a part of the text, like a 20% of the end of the document. What's happenning? Here's the code: import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import javax.swing.JFileChooser; public class Reader{ public static void main(String args[]){ File inFile; FileReader fr; BufferedReader bufReader; JFileChooser chooser; int reply; String doc = ""; String line; try{ chooser = new JFileChooser(); reply = chooser.showOpenDialog(null); doc = chooser.getCurrentDirectory().getPath() + System.getProperty("file.separator") + chooser.getSelectedFile().getName(); inFile = new File(doc); fr = new FileReader(inFile); bufReader = new BufferedReader (fr); do{ line = bufReader.readLine(); if(line ==null ) return; else{ System.out.println(line); } } while(line!=null); bufReader.close(); }//end try catch(Exception e) { System.out.println("error: "+e.getMessage()); } }//main }//end class reader
has comment: http://stackoverflow.com/comment/39894434
type: Question
has comment: http://stackoverflow.com/comment/39894385
type: AnsweredQuestion
score: 0
has title: Using JFileChooser only get part of txt. JAVA
has answer: http://stackoverflow.com/a/25549779
accepted answer: http://stackoverflow.com/a/25549779
has answer: http://stackoverflow.com/a/25549735
possible better answer: http://stackoverflow.com/a/25549735
tagged with: java
tagged with: text
tagged with: jfilechooser
has comment: http://stackoverflow.com/comment/39894914

http://stackoverflow.com/a/25463506
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39735311
type: Answer
accepted answer of: http://stackoverflow.com/q/25463440
score: 2
answers question: http://stackoverflow.com/q/25463440
has body: The code is not particularly inefficient. It could be slightly more efficient. The main problem is that it is fragile: if any developer forgets to synchronize its access to the global SharedCounter.count variable, you have a thread-safety issue. Indeed, since i++ is not an atomic operation and since changing the value of a variable without synchronization doesn't make the variables new value visible to other threads, Every access to i must be done in a synchronized way. The synchronization is thus not correctly encapsulated in a single class. Generally, accessing global public fields is bad design. It's even worse in a multi-threaded environment. Using an AtomicInteger solves the encapsulation problem, and makes it slightly more efficient at the same time.

http://stackoverflow.com/q/25442580
tagged with: sorting
has comment: http://stackoverflow.com/comment/39695844
possible better answer: http://stackoverflow.com/a/25444871
has comment: http://stackoverflow.com/comment/39695783
has answer: http://stackoverflow.com/a/25445947
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25444871
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25443423
has answer: http://stackoverflow.com/a/25442675
has answer: http://stackoverflow.com/a/25443423
has comment: http://stackoverflow.com/comment/39695914
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39704447
has answer: http://stackoverflow.com/a/25442686
score: -6
has body: I need to efficiently sort through 4 arrays and return 2 results. The first result will contain all numbers that exist in the arrays. The second result will contain, all occurrences of each number in the result int[] a = [1,2,3,4,5]; int[] b = [1,2,3,4,5,6]; int[] c = [1,3,7]; int[] d = [2,3,4,8,9,10]; int[] result1 = [1,2,3,4,5,6,7,8,9,10]; int[] result2 = [1,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,7,8,9,10];
has comment: http://stackoverflow.com/comment/39695789
has comment: http://stackoverflow.com/comment/39695836
downvote count: 8
answer count: 5
tagged with: arrays
has title: Java sort 4 arrays into 1 array

http://stackoverflow.com/q/25390430
tagged with: entity-bean
has title: Is it a good practice to embed behavior into Entity Beans?
has body: While my Java apps were small and did simple things, I was quite happy using plain SQL, all the more that application servers like Glassfish make connection management really easy. After I learned about JPA and EJB, I decided to refactor my projects to make them use these cool things, but faced an issue that is more about design than programming: Is it a good practice to embed behavior into Entity Beans, or they should only hold data? I've read many manuals and tutorials, but they mostly answer how I can use them, not how I should, to meet good-design requirements. For example, given 2 classes: User and Location, they are both entity beans. A user can store collection of locations, and it's OK and easy to implement using JPA. But if I want to populate these classes with some functionality, such as methods for calculating distance to another user or location, finding their paths intersections, calculating distance that a user ran over a day, and so on. Would it be a "good design" if I implement such functionality in beans themselves or I should use special decorators and helper classes with plenty of static methods to achieve my goal?
tagged with: java
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25390663
answer count: 2
score: 5
tagged with: ejb
tagged with: jpa
accepted answer: http://stackoverflow.com/a/25391392
downvote count: 1
upvote count: 6
has answer: http://stackoverflow.com/a/25391392
possible better answer: http://stackoverflow.com/a/25390663
type: AnsweredQuestion

http://stackoverflow.com/comment/131203233
has text: this is leading to stackoverflow error for me
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25521944
type: Comment

http://stackoverflow.com/a/25417827
has comment: http://stackoverflow.com/comment/39945011
answers question: http://stackoverflow.com/q/25417809
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25417809
type: Answer
has body: I have used Application Request Routing to configure IIS to connect to tomcat on port 8080 on the server machine. Then IIS will act as a reverse proxy and will forward appropriately configured paths to the wildfly instance. And yes, you can set-up routes based on the host header.
has comment: http://stackoverflow.com/comment/39689806
has comment: http://stackoverflow.com/comment/39689774

http://stackoverflow.com/q/25503907
tagged with: java
has answer: http://stackoverflow.com/a/25504001
linked to: http://stackoverflow.com/q/2068804
score: 17
has answer: http://stackoverflow.com/a/25507363
has comment: http://stackoverflow.com/comment/39811488
tagged with: string
has answer: http://stackoverflow.com/a/25515650
has answer: http://stackoverflow.com/a/25503946
has answer: http://stackoverflow.com/a/25505104
has body: I know that java.lang.String class is declared as final for security and performance related reasons. What I'm not understanding is the part that whether same purpose could be achieved using all final variables and final methods instead of declaring final class ? In short, what is the difference between below two code snippets .. e.g public class final String { .. } v/s // non final class public class String { // all final variables private final char[] value; // all final methods public final String subString() { .. } public final int length() { return value.length;} // etc } EDITS In simple words, can I achieve the same level of immutability by going with either approach ? Are they both good to make objects immutable ?
type: Question
tagged with: immutability
has answer: http://stackoverflow.com/a/25503994
answer count: 9
has comment: http://stackoverflow.com/comment/39810759
has answer: http://stackoverflow.com/a/25536714
has answer: http://stackoverflow.com/a/25503981
has comment: http://stackoverflow.com/comment/39815517
tagged with: final
downvote count: 0
has comment: http://stackoverflow.com/comment/39815550
has comment: http://stackoverflow.com/comment/39810197
accepted answer: http://stackoverflow.com/a/25503994
favorite count: 0
upvote count: 17
has comment: http://stackoverflow.com/comment/39810363
possible better answer: http://stackoverflow.com/a/25503981
linked to: http://stackoverflow.com/q/5181578
has title: final String class vs final methods of Non-final String class
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39810218
has answer: http://stackoverflow.com/a/25504013

http://stackoverflow.com/comment/39874683
type: AnswerComment
has text: http://developer.android.com/training/articles/perf-tips.html States there are two basic rules for writing efficient code: Don't do work that you don't need to do. Don't allocate memory if you can avoid it. However at the end of the day your the programmer. Do whichever you feel your comfortable at. @MinaGabriel
comment on: http://stackoverflow.com/a/25538629
type: Comment
score: 0

http://stackoverflow.com/comment/39655202
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25419382
has text: `tcnative-1.dll` already exists in `[tomcat-home]\bin` directory...... How and which system property do i add to the launch configuration. Please be a little more clear...
type: AnswerComment

http://stackoverflow.com/q/25392025
has comment: http://stackoverflow.com/comment/39642972
has comment: http://stackoverflow.com/comment/39606645
tagged with: rest
tagged with: jersey
type: UnansweredQuestion
tagged with: jersey-client
has body: I have jersey client and jersey server. For customized exception, I have created a provider class which implements avax.ws.rs.ext.ExceptionMapper and I am returning like ErrorResponse errorResponse = new ErrorResponse(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponse).type( MediaType.APPLICATION_XML).build(); Now in client i am doing like below if (response.getStatus() == Status.OK.getStatusCode()) { CustomeResponse cresponse = response .getEntity(CustomeResponse.class); }else{ ErrorResponse errorResponse = response .getEntity(ErrorResponse.class); throw new CustomException(errorResponse.getErrorMessage(), errorResponse.getErrorCode()); } But whenever my server has null pointer exception I am getting the below exception in the client Aug 19, 2014 12:03:37 PM com.sun.jersey.api.client.ClientResponse getEntity SEVERE: A message body reader for Java class com.custom.exception.ErrorResponse, and Java type class com.custom.exception.ErrorResponse, and MIME media type text/html; charset=utf-8 was not found Aug 19, 2014 12:03:37 PM com.sun.jersey.api.client.ClientResponse getEntity SEVERE: The registered message body readers compatible with the MIME media type are: */* -&gt; com.sun.jersey.core.impl.provider.entity.FormProvider com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider com.sun.jersey.core.impl.provider.entity.StringProvider com.sun.jersey.core.impl.provider.entity.ByteArrayProvider com.sun.jersey.core.impl.provider.entity.FileProvider com.sun.jersey.core.impl.provider.entity.InputStreamProvider Aug 19, 2014 12:03:37 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container java.lang.NullPointerException Can I map null pointer and other runtime exception to throw useful error code at client. Please help and suggest.
score: 0
has title: How to map Null Pointer Exception in Jersey server
answer count: 0
tagged with: java
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/39731892
score: 0
has text: Vector doesn't implement Enumeration. Vector's `elements()` method returns an instance of a class which implements Enumeration. Call `System.out.println(vector.elements().getClass())`, and you'll see the actual name of the class which implements Enumeration.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25461594

http://stackoverflow.com/comment/42380535
comment on: http://stackoverflow.com/a/26915945
score: 0
has text: add suggestions in comment
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25529188
accepted answer: http://stackoverflow.com/a/25626601
has comment: http://stackoverflow.com/comment/39884608
tagged with: junit-rule
has title: Can't run PowerMock with JUnitParams
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39928865
answer count: 2
tagged with: java
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/25626601
has body: I'm trying use PowerMock with JUnitParams, however I'm getting this strange error: com.thoughtworks.xstream.converters.ConversionException: com.lutum.web.ui.controladores.ControladorExibicaoPDF$$EnhancerByMockitoWithCGLIB$$2852e4bb : com.lutum.web.ui.controladores.ControladorExibicaoPDF$$EnhancerByMockitoWithCGLIB$$2852e4bb ---- Debugging information ---- message : com.lutum.web.ui.controladores.ControladorExibicaoPDF$$EnhancerByMockitoWithCGLIB$$2852e4bb cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException cause-message : com.lutum.web.ui.controladores.ControladorExibicaoPDF$$EnhancerByMockitoWithCGLIB$$2852e4bb class : com.lutum.web.ui.controladores.ControladorExibicaoPDFTest required-type : com.lutum.web.ui.controladores.ControladorExibicaoPDFTest converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter path : /org.powermock.modules.junit4.rule.PowerMockStatement$1/outer-class/fNext/test/outer-class/fTest/sut line number : 8 class[1] : org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner class[2] : org.junit.internal.runners.MethodRoadie$2 class[3] : org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner$LastRuleTestExecutorStatement class[4] : org.powermock.modules.junit4.rule.PowerMockStatement class[5] : org.powermock.modules.junit4.rule.PowerMockStatement$1 version : null ------------------------------- at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:355) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(Abs…
has comment: http://stackoverflow.com/comment/39872329
possible better answer: http://stackoverflow.com/a/25605885
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39869537
has answer: http://stackoverflow.com/a/25605885
tagged with: junit4
tagged with: powermock
upvote count: 2

http://stackoverflow.com/a/25512219
has comment: http://stackoverflow.com/comment/39847043
upvote count: 5
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/39832731
has comment: http://stackoverflow.com/comment/39831877
has body: This isn't specified in the Java specification. This means each JVM can do it however it wants to as long as it works and follows Java's memory guarantees. A good guess on how this works with a moving GC, would be each thread gets its own allocation zone. Where it does a simple pointer increase when allocating objects. Very simple and very quick allocation with no locking. When that is full either it gets a new allocation zone allocated to it, or the GC moves all live objects to a continuous part of the heap and returns the now empty zones back to each thread. I am not sure if this is how it is actually implemented in any JVM, and it would be complicated with GC synchronization.
has comment: http://stackoverflow.com/comment/39827534
has comment: http://stackoverflow.com/comment/39828256
has comment: http://stackoverflow.com/comment/39831468
has comment: http://stackoverflow.com/comment/39828055
answers question: http://stackoverflow.com/q/25512146
downvote count: 0
has comment: http://stackoverflow.com/comment/39829940

http://stackoverflow.com/a/25532173
has comment: http://stackoverflow.com/comment/39865733
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25492717
has body: You have to add build type debug (correctly to say you need to have different from release build type). It is square test plugin requirement as well as Robolectric test plugin (https://github.com/robolectric/robolectric-gradle-plugin/blob/master/src/main/groovy/org/robolectric/gradle/RobolectricPlugin.groovy#L42). Modify your build.gradle to next: buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } debug { } } And don't forget to switch Android studio to debug variant:
type: Answer
accepted answer of: http://stackoverflow.com/q/25492717

http://stackoverflow.com/a/25469793
score: 1
answers question: http://stackoverflow.com/q/25469731
downvote count: 0
has body: Yes it is due to integer division, like he said. When you divide 5 by 2, the answer is 2.5. However if you use a integer to store the answer, it will appear as just 2. Likewise, when you divide 7 by 100, your answer is 0.07, therefore the stored integer value is just 0. Try this: double aGrade = 7; int asteriskCount = (int)((aGrade/100)*50);
upvote count: 1
type: Answer

http://stackoverflow.com/comment/39847016
has text: You need a new web service method with a signature where the in parameter is a List<Status>
comment on: http://stackoverflow.com/q/25513324
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25427050
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25426830
has body: I guess you need to change the code from this idrinks.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { matchOptionActivity.this.startActivity(new Intent(matchOptionActivity.this, MessagingActivity.class)); } }); to this idrinks.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(this,MessagingActivity.class); i.startActivity(new Intent(matchOptionActivity.this, MessagingActivity.class)); } });

http://stackoverflow.com/q/25467488
tagged with: scala-2.11
has answer: http://stackoverflow.com/a/25473011
has comment: http://stackoverflow.com/comment/39744273
upvote count: 6
answer count: 2
tagged with: java
downvote count: 0
score: 6
favorite count: 0
type: Question
has title: Simple use of Scala collections from Java not compiling with 2.11
tagged with: scala
type: UnansweredQuestion
has body: So I've got this super exciting Java class: import scala.collection.immutable.Stream; public class EmptyStreamFactory { public static Stream&lt;String&gt; createEmptyStringStream() { return Stream.&lt;String&gt;empty(); } } Compiles just fine with the 2.10.4 scala-library.jar on the classpath (or 2.9.2, for what that's worth). Now I try it with 2.11: EmptyStreamFactory.java:5: error: incompatible types return Stream.&lt;String&gt;empty(); ^ required: Stream&lt;String&gt; found: GenTraversable 1 error How does this make any sense at all? At a glance the only difference that could be remotely relevant is the fact that Stream.Empty no longer extends Serializable in 2.11, but I don't see how that could cause this problem. The same thing happens with List, etc. There's an easy workaround—you can just cast to the appropriate type—but I'd like to understand what's going on here. (I'm on Oracle's JDK, version 1.7.0_67.)
has answer: http://stackoverflow.com/a/25469356

http://stackoverflow.com/q/25468704
has answer: http://stackoverflow.com/a/55135684
favorite count: 0
type: Question
score: 3
tagged with: package
linked to: http://stackoverflow.com/q/22566191
tagged with: maven
has comment: http://stackoverflow.com/comment/66043272
tagged with: janino
upvote count: 3
has title: "Invalid signature file digest" error adding Janino package through Maven
downvote count: 0
type: UnansweredQuestion
has body: I'm trying to add a dependency to Janino 2.7.6 through the Maven repository. When I try to run the application, I get this error: --- exec-maven-plugin:1.2.1:exec (unpack-dependencies) @ JanineAttemp2 --- --- exec-maven-plugin:1.2.1:exec (default-cli) @ JanineAttemp2 --- java.lang.SecurityException: Invalid signature file digest for Manifest main attributes at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:284) at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:238) at java.util.jar.JarVerifier.processEntry(JarVerifier.java:273) at java.util.jar.JarVerifier.update(JarVerifier.java:228) at java.util.jar.JarFile.initializeVerifier(JarFile.java:383) at java.util.jar.JarFile.getInputStream(JarFile.java:450) at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:776) at sun.misc.Resource.cachedInputStream(Resource.java:77) at sun.misc.Resource.getByteBuffer(Resource.java:160) at java.net.URLClassLoader.defineClass(URLClassLoader.java:442) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:367) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495) ... ------------------------------------------------------------------------ BUILD FAILURE ------------------------------------------------------------------------ Total time: 3.972s Finished at: Sun Aug 24 14:41:26 EST 2014 Final Memory: 15M/37M ------------------------------------------------------------------------ Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project JanineAtt…
tagged with: java
answer count: 1
tagged with: dependencies

http://stackoverflow.com/q/25466481
tagged with: android
has comment: http://stackoverflow.com/comment/39741022
has comment: http://stackoverflow.com/comment/39741006
has answer: http://stackoverflow.com/a/25477155
has comment: http://stackoverflow.com/comment/39741106
tagged with: java
has comment: http://stackoverflow.com/comment/39741409
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39741312
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39741062
has title: java.lang.NullPointerException when using getStringArray
favorite count: 0
has comment: http://stackoverflow.com/comment/39741095
type: Question
has comment: http://stackoverflow.com/comment/39741549
has body: I am working on an app that will generate a treasure list. This is my string array to store the list into: String treasure[] = {"", "", "", "", "", "", "", "", "", "", "", "", "", "", ""} ; This is how I am filling the values treasure[0] = coinvalue + " copper pieces"; This is where I send the compiled list to the next part: Bundle treasurelist = new Bundle(); treasurelist.putStringArray("loot", treasure); Intent a = new Intent(TreasureGen.this, Treasure_Results.class); a.putExtras(treasurelist); startActivity(a); This is where I am picking up the list in the next stage: public class Treasure_Results extends ListActivity { String getTreasure[] ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle gettreasurelist = getIntent().getExtras(); getTreasure = gettreasurelist.getStringArray("loot"); setListAdapter(new ArrayAdapter&lt;String&gt;(Treasure_Results.this, android.R.layout.simple_list_item_1, getTreasure)); } } And this is the error code I am getting: Caused by: java.lang.NullPointerException at com.giraffelitis.ptindustries.dungeonmasterassistant.Treasure_Results.onCreate(Treasure_Results.java:24) at android.app.Activity.performCreate(Activity.java:5431) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363) at android.app.ActivityThread.access$900(ActivityThread.java:161) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:157) at android.app.ActivityThread.main(ActivityThread.java:5356) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) at com.android.internal.os.ZygoteInit.main(Zy…
has comment: http://stackoverflow.com/comment/39742119
type: UnansweredQuestion

http://stackoverflow.com/comment/39734205
comment on: http://stackoverflow.com/q/25462376
score: 0
has text: @peeskillet Yes, that clear() method is called _after_ the 'choose' button is clicked. But in my case, the list gets cleared as soon as the file chooser is shown.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25501292
accepted answer: http://stackoverflow.com/a/25659589
has comment: http://stackoverflow.com/comment/39806530
has comment: http://stackoverflow.com/comment/39807388
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39806781
has comment: http://stackoverflow.com/comment/39808127
has title: my STS cannot running
has answer: http://stackoverflow.com/a/25659589
has comment: http://stackoverflow.com/comment/39806105
has comment: http://stackoverflow.com/comment/39805564
has comment: http://stackoverflow.com/comment/39806193
has comment: http://stackoverflow.com/comment/39806549
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39808084
has comment: http://stackoverflow.com/comment/39806707
upvote count: 1
has comment: http://stackoverflow.com/comment/39806504
has comment: http://stackoverflow.com/comment/39806222
tagged with: spring
has comment: http://stackoverflow.com/comment/39806291
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39806931
has comment: http://stackoverflow.com/comment/39805849
has body: when I click , become the program is "not responding" when I click again, it shows the following error "java platform" I am using `STS 3.1.0' Shoul I uninstall and install again? I think my Window is damaged.. But yersterday it was not like this, I dont know why today it is. this is the log anyone know why this happens?
has comment: http://stackoverflow.com/comment/39806125
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39806672
score: 1
tagged with: java

http://stackoverflow.com/q/25486647
favorite count: 0
has title: Android: How to prevent developer options from resetting upon the next boot?
type: Question
has comment: http://stackoverflow.com/comment/39778721
type: UnansweredQuestion
answer count: 1
downvote count: 0
upvote count: 1
tagged with: settings
has comment: http://stackoverflow.com/comment/39778137
has answer: http://stackoverflow.com/a/43474948
score: 1
tagged with: android
tagged with: java
has body: This is my first post so bear with me. I'm a maintainer for the Paranoid Android ROM and very new to Java. Basically my devices require the "Disable HW overlays" option in "Settings>Developer options" to be permanently enabled in order to prevent screen flickering. The thing is it is normal AOSP behaviour for some "dangerous" developer options to reset at the next boot (although I personally do not believe the said setting is dangerous). I would be extremely grateful if someone could tell me how to change the code to make this particular setting's state permanent upon the next boot. Here is the java file: DevelopmentSettings.java The string I am interested in is "DisableOverlays" I am a total newbie when it comes to this sort of stuff so any help is much appreciated. Thanks. EDIT: This is the file that is called upon when disable hw overlays is enabled (stated as DebugDisableHWC): SurfaceFlinger.cpp
has comment: http://stackoverflow.com/comment/40114583

http://stackoverflow.com/comment/116197471
type: Comment
has text: Sadly this does not fix it for me with Maven 3.6.3 and maven-resources-plugin 3.2.0... Edit: With Maven 3.5.4 and Maven 3.6.1 it worked.
type: AnswerComment
comment on: http://stackoverflow.com/a/25503853
score: 0

http://stackoverflow.com/comment/40087143
comment on: http://stackoverflow.com/a/25496454
type: Comment
has text: having the endpoint be a single global doesn't play well with async calls. From my testing with retrofit + rx-java, it seems the endpoint is checked on subscription, rather than when the observable is constructed.
type: AnswerComment
score: 5

http://stackoverflow.com/q/25530696
downvote count: 0
upvote count: 1
favorite count: 0
has body: why, System.out.println(Integer.parseInt("17", 8)); print out: 15 and, System.out.printf("%o", 17); print out: 21 Aren't they supposed to return octal value of 17?
type: Question
has comment: http://stackoverflow.com/comment/39862302
has title: parseInt vs printf %o format modifier
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25530941
has answer: http://stackoverflow.com/a/25530849
answer count: 3
score: 1
has answer: http://stackoverflow.com/a/25530721
tagged with: java

http://stackoverflow.com/q/25442836
has comment: http://stackoverflow.com/comment/39696470
has comment: http://stackoverflow.com/comment/39696377
accepted answer: http://stackoverflow.com/a/25442837
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25442837
has body: There is astrange and unexpected behavior of Double.parseDouble() method: Double.parseDouble("4cff9d79-a696-4dfc-89f9-a265ae117257"); That didn't thrown NumberFormatException as expected. The result was Infinity. With other UUID's the exception is thrown. Problem is only with Android Java, at Desktop version it works correctly. Why? PS: Used Android API 17, exception repeats on Android 4.4.2 phone.
upvote count: 2
score: 1
tagged with: java
answer count: 1
has title: Double.parseDouble() returns Infinity when I thought it should be NumberFormatException
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39696552
type: Question
tagged with: android

http://stackoverflow.com/q/25453947
tagged with: elasticsearch
accepted answer: http://stackoverflow.com/a/25455450
has answer: http://stackoverflow.com/a/25455450
type: Question
tagged with: elasticsearch-java-api
has title: ElasticSearch Lucene full text search using Java API
answer count: 1
tagged with: lucene
has body: I've recently started using ElasticSearch. I've managed to integrate them successfully, but I find the search API rather complex and confusing. The Java API is not too helpful either. How is it possible to search the following JSON for the fieldname title with Lucene syntax AND and OR using java api? { "queryId": 2, "queryName": "beta", "query": { "lang": "en", "location": "pa", "title": "americanlegion OR concernedvets AND conversion" } } I've tried boolean query but they don't feed my purpose.
type: AnsweredQuestion
score: 0
tagged with: booleanquery
tagged with: java

http://stackoverflow.com/comment/39754893
has text: Exactly. My answer will make it working, but @veggen explained why it didn't work, hence +1 from me :)
type: AnswerComment
comment on: http://stackoverflow.com/a/25473962
score: 0
type: Comment

http://stackoverflow.com/q/25390566
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39599680
tagged with: android-volley
type: UnansweredQuestion
tagged with: android
has body: I currently have the following code: JsonObjectRequest jsObjRequest = new JsonObjectRequest( Request.Method.GET, Network.getFullUrl("/Account/Login"), null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { showProgress(false); Gson gson = new Gson(); LoginResponseViewModel model = gson.fromJson( response, LoginResponseViewModel.class); if (model.Status) { Intent intent = new Intent(LoginActivity.this, MainMenuActivity.class); startActivity(intent); finish(); } else { mPasswordView .setError(getString(R.string.error_incorrect_password)); mPasswordView.requestFocus(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { showProgress(false); //TODO: show error } }); Network.getInstance(this).addToRequestQueue(jsObjRequest); How can I get Volley to do the gson.fromJson in the worker thread and then just pass me the correct object I want? This was it will help reduce load on the UI / Main thread and then simplify code as well. Can I use the default JsonObjectRequest or am I going to have to create a custom request type?
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
downvote count: 0
has title: How to get Android Volley to parse my Json response to a POJO in the worker thread
tagged with: gson
has answer: http://stackoverflow.com/a/43231633
upvote count: 1

http://stackoverflow.com/a/25504502
accepted answer of: http://stackoverflow.com/q/25503075
has comment: http://stackoverflow.com/comment/39824783
type: AcceptedAnswer
has body: Contents Array may have other reference then that asked by the model when the filter applied , so try this public Object getValueAt(int row, int column) { if(contents.length&gt;row &amp;&amp; contents[row].length&gt;column) return contents[row][column]; return null;//must solve this issue when object not found }
has comment: http://stackoverflow.com/comment/39813577
score: 0
answers question: http://stackoverflow.com/q/25503075
type: Answer

http://stackoverflow.com/comment/39894375
comment on: http://stackoverflow.com/q/25549684
score: 5
type: Comment
has text: `-Dproperty1=value1 -Dproperty2=value2` etc.
type: QuestionComment

http://stackoverflow.com/comment/39612997
type: QuestionComment
has text: "libMySuperLib.so" was linked against "libjpeg.so.62". If you used `ndk-build`, this is quite unusual. But if you used the standalone toolchain with Unix-style makefiles, then such outcome would not be unexpected. In the latter case, you may need some editing to your make files or configure script.
comment on: http://stackoverflow.com/q/25395817
score: 1
type: Comment

http://stackoverflow.com/comment/39766445
has text: (URI.createURI("c:/users/input/inputFile.txt") createURI take a file and locate it and pass it to getResource.
type: QuestionComment
comment on: http://stackoverflow.com/q/25480101
score: 0
type: Comment

http://stackoverflow.com/comment/39835037
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25516322
has text: I had only tested large values, so that ended up being the problem.
type: Comment

http://stackoverflow.com/comment/39756970
type: AnswerComment
comment on: http://stackoverflow.com/a/25474310
score: 0
has text: Updated the answer in accordance with your modifications.
type: Comment

http://stackoverflow.com/comment/39757090
comment on: http://stackoverflow.com/q/25474907
type: QuestionComment
score: 0
has text: Parse with Gson but I can't access the dynamic attribute "2014-08-24": in forecasts.
type: Comment

http://stackoverflow.com/comment/39698405
type: AnswerComment
has text: Thank for reply. Actually the original code is using ByteHashMap(seem to be a part of open source library), it only take one argument.
comment on: http://stackoverflow.com/a/25443941
type: Comment
score: 0

http://stackoverflow.com/comment/61400476
has text: can you sharing us your application please
type: Comment
comment on: http://stackoverflow.com/q/25474899
type: QuestionComment
score: 0

multithreading
tags question: http://stackoverflow.com/q/25454883
tags question: http://stackoverflow.com/q/25440035
tags question: http://stackoverflow.com/q/25425424
tags question: http://stackoverflow.com/q/25538658
tags question: http://stackoverflow.com/q/25431143
tags question: http://stackoverflow.com/q/25455258
tags question: http://stackoverflow.com/q/25472013
tags question: http://stackoverflow.com/q/25455419
tags question: http://stackoverflow.com/q/25471371
tags question: http://stackoverflow.com/q/25515213
tags question: http://stackoverflow.com/q/25514164
tags question: http://stackoverflow.com/q/25435117
tags question: http://stackoverflow.com/q/25548718
tags question: http://stackoverflow.com/q/25512146
type: Tag
tags question: http://stackoverflow.com/q/25442323
tags question: http://stackoverflow.com/q/25524821
tags question: http://stackoverflow.com/q/25516167
tags question: http://stackoverflow.com/q/25450326
tags question: http://stackoverflow.com/q/25395201
tags question: http://stackoverflow.com/q/25407097
tags question: http://stackoverflow.com/q/25527212
tags question: http://stackoverflow.com/q/25396134
tags question: http://stackoverflow.com/q/25393938
tags question: http://stackoverflow.com/q/25496580
tags question: http://stackoverflow.com/q/25473005
tags question: http://stackoverflow.com/q/25530400
tags question: http://stackoverflow.com/q/25528192
tags question: http://stackoverflow.com/q/25461463
tags question: http://stackoverflow.com/q/25440178
tags question: http://stackoverflow.com/q/25505406
tags question: http://stackoverflow.com/q/25432704
tags question: http://stackoverflow.com/q/25417666
tags question: http://stackoverflow.com/q/25473315
tags question: http://stackoverflow.com/q/25400934
tags question: http://stackoverflow.com/q/25476756
tags question: http://stackoverflow.com/q/25403291
tags question: http://stackoverflow.com/q/25521046
tags question: http://stackoverflow.com/q/25458810
tags question: http://stackoverflow.com/q/25535289
tags question: http://stackoverflow.com/q/25488561
tags question: http://stackoverflow.com/q/25542268
tags question: http://stackoverflow.com/q/25533908
tags question: http://stackoverflow.com/q/25517088
tags question: http://stackoverflow.com/q/25506234
tags question: http://stackoverflow.com/q/25452069
tags question: http://stackoverflow.com/q/25474721
tags question: http://stackoverflow.com/q/25464748
tags question: http://stackoverflow.com/q/25543088
tags question: http://stackoverflow.com/q/25470126
tags question: http://stackoverflow.com/q/25493150
tags question: http://stackoverflow.com/q/25548987
tags question: http://stackoverflow.com/q/25432418
tags question: http://stackoverflow.com/q/25389864
tags question: http://stackoverflow.com/q/25425893
tags question: http://stackoverflow.com/q/25431743
tags question: http://stackoverflow.com/q/25471451
tags question: http://stackoverflow.com/q/25534133
tags question: http://stackoverflow.com/q/25427716
tags question: http://stackoverflow.com/q/25541629
tags question: http://stackoverflow.com/q/25534751
tags question: http://stackoverflow.com/q/25438681
tags question: http://stackoverflow.com/q/25490766
tags question: http://stackoverflow.com/q/25549069
tags question: http://stackoverflow.com/q/25503985
tags question: http://stackoverflow.com/q/25461226
tags question: http://stackoverflow.com/q/25497590
tags question: http://stackoverflow.com/q/25546099
tags question: http://stackoverflow.com/q/25411055
tags question: http://stackoverflow.com/q/25550036
tags question: http://stackoverflow.com/q/25527244
tags question: http://stackoverflow.com/q/25419550
tags question: http://stackoverflow.com/q/25465912
tags question: http://stackoverflow.com/q/25549423
tags question: http://stackoverflow.com/q/25420986
tags question: http://stackoverflow.com/q/25416045
tags question: http://stackoverflow.com/q/25455476
tags question: http://stackoverflow.com/q/25470853
tags question: http://stackoverflow.com/q/25524556
tags question: http://stackoverflow.com/q/25504894

http://stackoverflow.com/comment/39678308
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25430569
has text: Thanks dude, i have opted to try Hovercrafts way

http://stackoverflow.com/q/25505235
type: AnsweredQuestion
has body: I want to validate a field 'foo' against either of two constraints, i.e. something like this @ConstraintA OR @ConstraintB private String foo; Is this possible?
tagged with: bean-validation
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25549127
accepted answer: http://stackoverflow.com/a/25549127
downvote count: 0
favorite count: 0
type: Question
has title: Java Bean validation: Combine two contstraints with OR on one field
tagged with: hibernate-validator
score: 4
upvote count: 4

http://stackoverflow.com/q/25517706
score: 3
has comment: http://stackoverflow.com/comment/68072523
has comment: http://stackoverflow.com/comment/39836662
has comment: http://stackoverflow.com/comment/39836820
tagged with: java
has comment: http://stackoverflow.com/comment/39836784
answer count: 1
has body: I'm trying to use Java 8's parallelStream() to execute several long-running requests (eg web requests) in parallel. Simplified example: List&lt;Supplier&lt;Result&gt;&gt; myFunctions = Arrays.asList(() -&gt; doWebRequest(), ...) List&lt;Result&gt; results = myFunctions.parallelStream().map(function -&gt; function.get()).collect(... So if there are two functions that block for 2 and 3 seconds respectively, I'd expect to get the result after 3 seconds. However, it really takes 5 seconds - ie it seems the functions are being executed in sequence and not in parallel. Am I doing something wrong? edit: This is an example. The time taken is ~4000 milliseconds when I want it to be ~2000. long start = System.currentTimeMillis(); Map&lt;String, Supplier&lt;String&gt;&gt; input = new HashMap&lt;String, Supplier&lt;String&gt;&gt;(); input.put("1", () -&gt; { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return "a"; }); input.put("2", () -&gt; { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return "b"; }); Map&lt;String, String&gt; results = input.keySet().parallelStream().collect(Collectors.toConcurrentMap( key -&gt; key, key -&gt; { return input.get(key).get(); })); System.out.println("Time: " + (System.currentTimeMillis() - start)); } Doesn't make any difference if I iterate over the entrySet() instead of the keySet() edit: changing the parallel part to the following also does not help: Map&lt;String, String&gt; results = input.entrySet().parallelStream().map(entry -&gt; { return new ImmutablePair&lt;String, String&gt;(entry.getKey(), entry.getValue().get()); }).collect(Collectors.toConcurrentMap(Pair::getLeft, Pair::getRight));
tagged with: concurrency
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39837203
accepted answer: http://stackoverflow.com/a/25518084
has answer: http://stackoverflow.com/a/25518084
has comment: http://stackoverflow.com/comment/39836994
downvote count: 2
upvote count: 5
has comment: http://stackoverflow.com/comment/39836744
tagged with: java-8
has comment: http://stackoverflow.com/comment/39836730
has comment: http://stackoverflow.com/comment/39836718
linked to: http://stackoverflow.com/q/20375176
tagged with: parallel-processing
has title: Java 8 parallel streams don't appear to actually be working in parallel
type: AnsweredQuestion

http://stackoverflow.com/comment/75016057
score: 1
has text: dont use postDelayed, It might create app.FragmentManagerImpl.checkStateLoss exception. Checkout this blog - [Blog](http://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html)
type: Comment
comment on: http://stackoverflow.com/a/25535931
type: AnswerComment

http://stackoverflow.com/comment/125165645
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25440453
type: QuestionComment
has text: See this answer on how to encode higher order types in Java: https://stackoverflow.com/questions/7451658/can-i-use-nested-generics-aka-higher-kinded-types-in-java/70721895#answer-70721895

http://stackoverflow.com/comment/39855199
comment on: http://stackoverflow.com/q/25527412
type: Comment
type: QuestionComment
has text: second try [Java Build Path](http://i.imgur.com/d0mPmdS.png)
score: 0

http://stackoverflow.com/a/25476355
has body: I loaded assets a bit differently, my executable jar file runs fine. Here's my Assets class: public abstract class Assets { private static AssetManager asm = new AssetManager(); private static String assetsPackPath = "assets.pack"; public static TextureAtlas atlas; public static void load(){ asm.load(assetsPackPath, TextureAtlas.class); asm.finishLoading(); atlas = asm.get(assetsPackPath); } public static void dispose(){ asm.dispose(); } } If you are not using texture packer then you should! If interested check HERE
answers question: http://stackoverflow.com/q/25474075
has comment: http://stackoverflow.com/comment/39770724
score: 0
type: Answer

http://stackoverflow.com/a/25447490
accepted answer of: http://stackoverflow.com/q/25446926
type: Answer
has body: If your file is large, you should not load it in memory only to iterate through an array. You should change your procedure to : Open the file Get the latest DATE_TIME from the database Iterate through the file getting (DATE_TIME,MEASUREMENT) If DATE_TIME > latest Then update database If DATE_TIME &lt; latest Then don't care Close the file And if your file is very large, you should considere to commit changes in database at regular intervals. Now for you question : the simplest way to be able to restart at the point where you stopped with the file reading procedure is to copy the remaining of the file (since the last read) to a new temporary file, delete the file and rename the temporary file with the original name.
has comment: http://stackoverflow.com/comment/39707110
downvote count: 0
answers question: http://stackoverflow.com/q/25446926
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/25412778
has answer: http://stackoverflow.com/a/27274715
tagged with: apache
has comment: http://stackoverflow.com/comment/39644407
has comment: http://stackoverflow.com/comment/39653049
has body: I need to convert dbcp2 java setup code into spring beans The below code works as expected: protected void setupDriver(String connectURI, String username, String password) throws ClassNotFoundException, SQLException{ // // First, we'll create a ConnectionFactory that the // pool will use to create Connections. // We'll use the DriverManagerConnectionFactory, // using the connect string passed in the command line // arguments. // ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI, username, password); // // Next we'll create the PoolableConnectionFactory, which wraps // the "real" Connections created by the ConnectionFactory with // the classes that implement the pooling functionality. // poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, null); logger.info("poolableConnectionFactory created"); // // Now we'll need a ObjectPool that serves as the // actual pool of connections. // // We'll use a GenericObjectPool instance, although // any ObjectPool implementation will suffice. // connectionPool = new GenericObjectPool<PoolableConnection>(poolableConnectionFactory,getPoolConfig()); logger.info("connectionPool created"); // Set the factory's pool property to the owning pool poolableConnectionFactory.setPool(connectionPool); logger.info("connectionPool is set to poolableConnectionFactory"); // // Finally, we create the PoolingDriver itself... // Class.forName("org.apache.commons.dbcp2.PoolingDriver"); driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:"); logger.info("dbcp2 driver is created"); // // ...and register our pool with it. // driver.registerPool(poolName,connectionPool); logger.info("driver is registered"); // // Now, we create the PoolingDriver itself, // passing in the object pool we created. // dataSource = new PoolingDataSource<PoolableConnection>(connectionPool); logger.info("dataSource is created"); // //Finally we create the JdbcTemplate for sql //operations in DbDAO cla…
type: Question
has answer: http://stackoverflow.com/a/25414442
has answer: http://stackoverflow.com/a/32261402
has comment: http://stackoverflow.com/comment/39642088
has title: setup spring bean configuration for dbcp2 gives "PoolableConnectionFactory not linked to pool. Calling setPool()"
tagged with: spring
answer count: 4
tagged with: spring-mvc
score: 0
has answer: http://stackoverflow.com/a/30451345
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/39839698
type: Comment
has text: @JunedAhsan:- `has detailed explanation on it`
type: AnswerComment
comment on: http://stackoverflow.com/a/25519613
score: 0

http://stackoverflow.com/comment/39742396
score: 0
has text: @Marco13 Well, then you're assuming what the OP is doing, they've made no mention of Executors (and yes, I'm aware that SwingWorker is backed by one, but that's not what the OP is talking about)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25466302

http://stackoverflow.com/comment/39803604
type: QuestionComment
has text: What you describe sounds to me like a [Factory](http://en.wikipedia.org/wiki/Factory_method_pattern) method and that is a legit means of creating an instance.
score: 2
comment on: http://stackoverflow.com/q/25500213
type: Comment

http://stackoverflow.com/q/25547792
tagged with: jboss
favorite count: 0
type: Question
tagged with: jboss-arquillian
has title: JBoss Forge - How to setup arquillian
upvote count: 2
has body: I used JBoss 7 and JBoss Forge 1.x a while ago and was quite happy with the setup. Now I want to use the latest 2.8 release with JBoss 8.1 and can't even setup Arquillian. Running: forge install-plugin arquillian gives forge: unrecognized option: 'install-plugin' Following the various how to's din't help since most of them seem to be made for older Arquillian and JBoss releases. forge --install arquillian gives downloading: http://repo1.maven.org/maven2/org/jboss/forge/addon/arquillian/maven- metadata.xml java.lang.IllegalArgumentException: No Artifact version found for org.jboss.forge.addon:arquillian Are there any recent descriptions on how to setup arquillian using forge ?
type: UnansweredQuestion
downvote count: 0
score: 2
has answer: http://stackoverflow.com/a/25677459
tagged with: java
answer count: 1

http://stackoverflow.com/q/25398452
answer count: 3
duplicate of: http://stackoverflow.com/q/14891717
score: 1
has answer: http://stackoverflow.com/a/25398575
downvote count: 1
has comment: http://stackoverflow.com/comment/39614532
favorite count: 0
has answer: http://stackoverflow.com/a/25398532
has comment: http://stackoverflow.com/comment/39614243
has answer: http://stackoverflow.com/a/37277409
has title: Extends Throwable vs Exception in java
type: Question
linked to: http://stackoverflow.com/q/2274102
tagged with: java
has body: When creating my own exception, are there any benefits that I need to take into account when deciding which super class to extend? What are the prons and cons of each one of them? class MyException extends Exception vs class MyException extends Throwable
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14891717
upvote count: 2
has comment: http://stackoverflow.com/comment/39614303
linked to: http://stackoverflow.com/q/498217

http://stackoverflow.com/a/25412054
score: 2
has body: When you initially ran it, you would have run it on a file with a .jnlp extension; your system would then have downloaded the files from the web, and run them from the local cache. If you can find the .jnlp file you ran, you'll be able to run that again: it'll use the cache if it's still there, and it'll download again if not.
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25411991
downvote count: 0
has comment: http://stackoverflow.com/comment/39640498
accepted answer of: http://stackoverflow.com/q/25411991
type: Answer
has comment: http://stackoverflow.com/comment/39640604

http://stackoverflow.com/comment/39650484
score: 0
type: AnswerComment
has text: Well after a test, with java 1.8 the result es different (returns a null, no NPE). Ideas?
type: Comment
comment on: http://stackoverflow.com/a/25417505

http://stackoverflow.com/q/25423792
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25424015
linked to: http://stackoverflow.com/q/8419860
has comment: http://stackoverflow.com/comment/39661357
upvote count: 2
has comment: http://stackoverflow.com/comment/39661171
answer count: 2
has answer: http://stackoverflow.com/a/25426489
score: 1
tagged with: java
downvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/39661729
has comment: http://stackoverflow.com/comment/39661220
favorite count: 0
linked to: http://stackoverflow.com/q/52353
type: Question
has title: Java - Integer[] and int[] memory difference
has body: I'm trying to get a general idea of the memory cost difference between an Integer array and int array. While there seems to be a lot of information out there about the differences between a primitive int and Integer object, I'm still a little confused as to how to calculate the memory costs of an int[] and Integer[] array (overhead costs, padding, etc). Any help would be appreciated. Thanks!

http://stackoverflow.com/comment/39605631
comment on: http://stackoverflow.com/a/25393435
has text: they would have it but they would need to place it correctly. maven was invented for ease setup so that is not an option for me.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25472186
tagged with: java
tagged with: jdbc
has title: How to convert ImageIcon to File object wihout saving it into disk?
type: Question
has answer: http://stackoverflow.com/a/25472676
has comment: http://stackoverflow.com/comment/39752501
answer count: 1
downvote count: 0
tagged with: file
upvote count: 1
tagged with: swing
favorite count: 0
has body: I want to send ImageIcon to database using jdbc. I need to File object to do that. How to convert ImageIcon to File wihout saving it into disk? File fBlob = new File(imageIcon.getImage()); FileInputStream is = new FileInputStream ( fBlob ); preparedStatement.setBinaryStream (3, is, (int) fBlob.length() );
has comment: http://stackoverflow.com/comment/39751679
has comment: http://stackoverflow.com/comment/39751587
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25472676
tagged with: imageicon
has comment: http://stackoverflow.com/comment/39751801
score: 1

http://stackoverflow.com/comment/39811578
type: Comment
has text: what is the connection between svn and access files through the JFileChooser? What you really want to do?
type: AnswerComment
comment on: http://stackoverflow.com/a/25504426
score: 0

http://stackoverflow.com/comment/39613756
score: 2
comment on: http://stackoverflow.com/q/25398199
type: QuestionComment
has text: Probably because the browsers are 32bit and it may not be possible for 32bit apps to run 64 bit code...
type: Comment

http://stackoverflow.com/comment/39802398
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25499239
type: Comment
has text: i don't understand what you mean

http://stackoverflow.com/comment/39891697
comment on: http://stackoverflow.com/q/25527463
score: 0
type: Comment
has text: @Rat2000 it currently is indeed 2 connection pools, but in the future new webapps will be introduced and the number of connection pools will increase every time. I may be fooled by the long startup time of jetty but the data jpa layer might be quite resource heavy, better to have one of these than for every webapp one. (looking at it with keeping the hardware costs in mind)
type: QuestionComment

http://stackoverflow.com/a/25652085
type: Answer
has body: Jim led me in the final direction with point number 2. I ended up processing it manually with an ugly hack on a Woodstox property. You can manually specify which properties can use the self-closing syntax. While debugging I accidentally gave it an empty Set of properties and all of the properties had a separate closing tag. XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); Set&lt;String&gt; tags = new HashSet&lt;String&gt;(); // This specifies the procedure field should be allowed to use the self-closing syntax instead of having a separate end tag //tags.add("procedure"); outputFactory.setProperty(WstxOutputProperties.P_OUTPUT_EMPTY_ELEMENT_HANDLER, new EmptyElementHandler.SetEmptyElementHandler(tags)); StringWriter sw = new StringWriter(); XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw); writer.writeStartDocument("1.0"); writer.writeStartElement("procedure"); writer.writeAttribute("name", procRequest.getName()); writer.writeAttribute("requestId", procRequest.getRequestId()); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); sw.flush();
answers question: http://stackoverflow.com/q/25536008
score: 0

http://stackoverflow.com/comment/39690210
comment on: http://stackoverflow.com/q/25439216
type: Comment
type: QuestionComment
has text: Clean your project.and then delete the gen files and let it recreate.This should pop an error in you resources folder.
score: 0

http://stackoverflow.com/comment/39611926
type: Comment
type: AnswerComment
score: 0
has text: Yeah i think so too... but first i'll get some sleep (7 in the morning here), also marked your Answer as correct, now i just need to apply that to my application, thanks for not giving up on me ;)
comment on: http://stackoverflow.com/a/25395328

http://stackoverflow.com/comment/39660633
has text: Ah! You're right, +1 (and deleted my answer). Java should have had an `ImmutableSet` as a super-interface of `Set`, [like Python does](https://docs.python.org/dev/library/collections.abc.html#collections-abstract-base-classes).
type: AnswerComment
comment on: http://stackoverflow.com/a/25423318
type: Comment
score: 1

ms-word
tag name: ms-word
type: Tag
tags question: http://stackoverflow.com/q/25464872

http://stackoverflow.com/comment/39743017
type: QuestionComment
has text: And if you run `System.out.println(System.getProperty("user.dir"));` what is returned? And what is the relative path of your file to the user directory path?
comment on: http://stackoverflow.com/q/25467579
score: 1
type: Comment

http://stackoverflow.com/q/25428340
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25429053
has answer: http://stackoverflow.com/a/25429261
answer count: 3
upvote count: 2
tagged with: java
downvote count: 0
accepted answer: http://stackoverflow.com/a/25428555
has answer: http://stackoverflow.com/a/25428555
favorite count: 0
possible better answer: http://stackoverflow.com/a/25429053
type: Question
has comment: http://stackoverflow.com/comment/39670042
tagged with: android
has title: I want to make a service in android but my service not running?
has comment: http://stackoverflow.com/comment/39669697
tagged with: service
score: 2
has body: my app install but when reboot device not running. my service: package com.example.service_m; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.widget.Toast; public class ServiceCode extends Service{ @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { //TODO do something useful for(int i=0;i<=10;i++){ Toast.makeText(getApplicationContext(), "hello world", Toast.LENGTH_LONG).show(); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return Service.START_NOT_STICKY; } } my BroadcastReceiver: package com.example.service_m; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class ServiceStarter extends BroadcastReceiver{ @Override public void onReceive(Context _context, Intent _intent) { Intent service = new Intent(_context, ServiceCode.class ); _context.startService(service); } } AndroidManifest <action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> my app install but not running when device reboot. what is problem? please help me! I want to learn make a background app.

http://stackoverflow.com/q/25476793
has answer: http://stackoverflow.com/a/25623308
type: UnansweredQuestion
tagged with: google-app-engine
has body: My'm having a weird issue that I cant figure out. I have a Web Service set up on Google App Engine. I can test it from the Google APIs Explorer and I get data back. But when I copy and paste URL that's associated with the API link below (app info removed for security purposes), I get a "NOT FOUND" error on the page. It should return some JSON data. Does anyone have a clue as to why this is happening? This is my Servlet code @ApiMethod(name="updateHighFive") public Event addHighFive(@Named("eventid") int eventid, @Named("userid") int userid) throws NotFoundException{ //parameters needed //eventid //title //description //categoryid Event event = new Event(); event = MyDB.AddHighFive(eventid, userid); return event; } and this is the code for my DB connection. public static Event AddHighFive(int eventid, int userid) { Event event = null; Connection connection; CallableStatement statement=null; int rs = 0; String callStatement = "{call AddHighFive(?,?)}"; try{ connection=getConnection(); statement = connection.prepareCall(callStatement); statement.setInt(1, eventid); statement.setInt(2, userid); rs = statement.executeUpdate(); if(rs != 0){ event = new Event(); event.setId(eventid); } statement.close(); connection.close(); }catch (SQLException ex){ System.out.println("Error: " + ex.toString()); System.out.println("Query: " + statement.toString()); } return event; } Request POST https://myapi-webservice-01.appspot.com/_ah/api/api/v1/addHighFive/4/1 X-JavaScript-User-Agent: Google APIs Explorer Response 200 OK Show headers - { "id": 4, "highFives": 0, "going": 0, "currentlyHere": 0, "categoryid": 0, "userId": 0, "kind": "myapi#resourcesItem", "etag": "\"4nNuVpsUM8obBGiS0qN7CVracwc/L7tNRSrZhr-ryKSf0HchvG1lWC4\"" }
score: 0
tagged with: java
answer count: 1
has title: Google App Engine "Not Found" error on POST with url
tagged with: servlets
type: Question

http://stackoverflow.com/q/25532338
score: 7
upvote count: 7
tagged with: java
has answer: http://stackoverflow.com/a/25584146
has answer: http://stackoverflow.com/a/25596865
accepted answer: http://stackoverflow.com/a/25596865
answer count: 4
tagged with: log4j
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25579447
has title: How to configure log4j2's additivity to respect parent's level?
has body: I think this code explains well enough what I'm trying to do package us.benanderson; public class MyClass { private static final Logger LOG = LogManager.getLogger(MyClass.class); ... // within a method LOG.debug("only output to appFile"); LOG.error("output to both appFile and errorFile"); This is what I'd guess should be my config &lt;Loggers&gt; &lt;Logger name="us.benanderson" level="debug" additivity="true"&gt; &lt;AppenderRef ref="appFile" /&gt; &lt;/Logger&gt; &lt;Root level="error"&gt; &lt;AppenderRef ref="errorFile" /&gt; &lt;/Root&gt; &lt;/Loggers&gt; However, I'm finding that when additivity="true", debug messages are also output to errorFile. When additivity="false" nothing is output to errorFile. Is there any way to do what I'm trying to do?
tagged with: log4j2
tagged with: logging
has answer: http://stackoverflow.com/a/25584777
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25579447
downvote count: 0
tagged with: configuration

http://stackoverflow.com/a/25424393
answers question: http://stackoverflow.com/q/25420441
has body: I found, for complex enum mappings one could also introduce an xml adapter as follows: public class EnumAdapter extends XmlAdapter&lt;String, TestEnum&gt; { @Override public TestEnum unmarshal(String value) throws Exception { return TestEnum.fromValue(value); } @Override public String marshal(TestEnum value) throws Exception { return value.toString(); } } Use with @XmlJavaTypeAdapter(EnumAdapter.class) on the @WebMethod param.
type: Answer
score: 0

http://stackoverflow.com/a/25558551
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25546038
upvote count: 1
has body: Since you know you are liable to hit a parameter limit at some point, since it cannot be infinite, why not handle this in your code? Break your parameter array into chunks, run your query for each chunk and assemble your results in a loop. Then you don't care what the actual number of parameters is. It will never be larger than the size you decide. public static List&lt;&lt;List&lt;Long&gt;&gt; chunkifyIdList(List&lt;Long&gt;, int chunkSize) { ... } List&lt;MyObject&gt; results = new ArrayList&lt;MyObject&gt;(); for (List&lt;Long&gt; chunk: chunkifyIdList(inputData)) { results.add(myDAO.findAll(chunk)); }

http://stackoverflow.com/a/25469876
answers question: http://stackoverflow.com/q/25469860
has comment: http://stackoverflow.com/comment/103833690
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/103833639
has body: You could just use return (this.myInt==mc.getMyInt()); . the equals() method is only defined for Objects.
type: Answer

http://stackoverflow.com/q/25472281
has comment: http://stackoverflow.com/comment/39752520
score: 6
has comment: http://stackoverflow.com/comment/39752499
has comment: http://stackoverflow.com/comment/39753670
has comment: http://stackoverflow.com/comment/114984263
type: AnsweredQuestion
tagged with: deep-copy
has comment: http://stackoverflow.com/comment/39751848
has comment: http://stackoverflow.com/comment/39752008
tagged with: java
has title: How to make deep copy of java object without using serialization ?
answer count: 1
upvote count: 7
has answer: http://stackoverflow.com/a/25473060
downvote count: 1
accepted answer: http://stackoverflow.com/a/25473060
favorite count: 0
has comment: http://stackoverflow.com/comment/39752116
type: Question
has comment: http://stackoverflow.com/comment/39753617
has comment: http://stackoverflow.com/comment/39751729
has body: Is it possible to make a deep copy/clone of a Java object without using serialization ? If so then how ?

http://stackoverflow.com/comment/39716050
type: Comment
type: QuestionComment
has text: @JLRishe Yeah i'm breaking on it. If i edit my XML and change the numbers it remains unchanged.
comment on: http://stackoverflow.com/q/25453011
score: 0

http://stackoverflow.com/q/25423354
tagged with: java-6
tagged with: java
has body: I am running Eclipse Juno (so that I can still run EclEmma) and have jdk 1.6.0_45 installed. I used to have jre 1.6 installed, but then whenever I would re-import from my maven poms I'd lose all debug information in the libraries, so I've switched. Every so often, and I haven't yet figured out what triggers it, all of my projects (and there are over 100, so it's a pain to fix them all) decide that they need a 1.6 jre and that none is available. I can see jdk1.6.0_45 in the Installed JREs list, but it's not available in the Execution Environment pane under JavaSE-1.6. The only solution I've found so far is to edit all the .project files so that they refer to JaveaSE-1.6/JRE_CONTAINER again and restart Eclipse. This takes nearly an hour (because it needs to rebuild everything twice) which is a large loss of time in a day. So the question I have is, is there any way to force Eclipse to see that the JDK that it is running in is a valid JavaSE-1.6 environment?
tagged with: eclipse
has title: How do I instruct Eclipse that JDK 1.6 is a Java 1.6 compatible JRE?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25423554
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/25423588
upvote count: 2
score: 2
answer count: 2
downvote count: 0

http://stackoverflow.com/q/25391153
has body: I'm working with the LibGDX framework and I'm trying this: World world = new World() But I cannot import com.badlogic.gdx.physics.World, in gdx there is no physics module. I have imported gdx-backend-lwjgl.jar , gdx-backend-lwjgl-natives.jar, gdx.jar and gdx-natives.jar
has comment: http://stackoverflow.com/comment/39600912
has answer: http://stackoverflow.com/a/25394011
has title: How to import LibGDX physics module?
score: 0
tagged with: java
answer count: 1
type: Question
type: UnansweredQuestion
tagged with: libgdx

http://stackoverflow.com/q/25400773
tagged with: java-me
has answer: http://stackoverflow.com/a/25420476
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25419027
has title: J2ME - Supporting different platforms in one project
upvote count: 1
has comment: http://stackoverflow.com/comment/39633133
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39618689
answer count: 2
has body: I am developing an app in J2ME which will be deployed on different platforms (That all support J2ME) For the UI I will be using LWUIT and making sure it renders roughly the same on each platform. (LWUIT is cross platform) As I am aware that each platform has its own nuances such as the availability/absence of libraries, I was wondering whether the best course of action is to A) create a new project for each platform (e.g one for Blackberry, one for Nokia) and copy&amp;paste the similar, reusable code between them; essentially maintaining 4-5 similar codebases at once. OR B) Have one big project riddled with "if" or "switches" saying (IF platform == x then do xx). Can anyone tell me if the above has some seriously dumb oversights im not picking up? I am leaning towards implementing A however I think both have some maintainability issues.. Many thanks Fenix
has comment: http://stackoverflow.com/comment/39650052
has answer: http://stackoverflow.com/a/25419027
score: 1
tagged with: project
tagged with: java
downvote count: 0
possible better answer: http://stackoverflow.com/a/25420476

http://stackoverflow.com/comment/39724627
score: 1
comment on: http://stackoverflow.com/a/25439951
type: Comment
type: AnswerComment
has text: I'll take it :) I think it'll be a good reference on how Lambdas can be either used or abused. "This is why you need to learn the Streams API"

http://stackoverflow.com/comment/39682260
has text: what's with `position.x` and `position.y` in the last line of Player2Pong class?
comment on: http://stackoverflow.com/q/25434353
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25458027
linked to: http://stackoverflow.com/q/2983248
has comment: http://stackoverflow.com/comment/39725912
tagged with: sql
tagged with: java
answer count: 1
tagged with: mysql
has answer: http://stackoverflow.com/a/25464356
has body: The class below creates a connection to my MYSQL user, it then submits some data into a table.. I've checked and double checked the username and password, it's definitely 100% correct, but why does it keep throwing this memory leak? I am having trouble figuring this out myself, I've been reading all the related topics, but none really seems to be the same issue as mine. package com.rs.MYSQL; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import com.rs.Settings; import com.rs.utils.Lottery; public class LotteryMYSQL { private static Connection connection; private static long lastConnection = System.currentTimeMillis(); public static void createConnection() { try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection( "jdbc:mysql://runerebellion.com:3306/database", "user", "pass");//fake user&amp;pass } catch (Exception e) { e.printStackTrace(); } } public static void destroyConnection() { try { connection.close(); } catch (Exception e) { e.printStackTrace(); } } public static void init() { createConnection(); } public static boolean updateInfo() { try { if (Settings.DisableMYSQL == true) return false; createConnection(); Statement stmt = connection.createStatement(); if (Lottery.getCurrentLotteryWinner() != null) stmt.executeUpdate("UPDATE info SET moneyEarned = '" + Lottery.options.size() + "', lastWinner = '" + Lottery.getCurrentLotteryWinner() + "'"); else stmt.executeUpdate("UPDATE info SET moneyEarned = '" + Lottery.options.size() + "', lastWinner = '" + Lottery.getLastLotteryWinner() + "'"); destroyConnection(); } catch (Throwable e) { if (System.currentTimeMillis() - lastConnection &gt; 10000) { destroyConnection(); createConnection(); lastConnection = System.currentTimeMillis(); } } return false; } } The memory leak is below com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has…
type: Question
has comment: http://stackoverflow.com/comment/39725509
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39725479
has comment: http://stackoverflow.com/comment/39725858
has title: MYSQL - Communications link failure; timeout
linked to: http://stackoverflow.com/q/6865538
score: 0

http://stackoverflow.com/q/25499776
score: 0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39842113
type: Question
has comment: http://stackoverflow.com/comment/39824430
has comment: http://stackoverflow.com/comment/39811835
has comment: http://stackoverflow.com/comment/39839126
has comment: http://stackoverflow.com/comment/39803972
type: UnansweredQuestion
tagged with: session
has title: Automatic logout in struts2
tagged with: struts2
has comment: http://stackoverflow.com/comment/39803692
has body: Please help me out, I am stuck at logic. I have a table which contains the entry and exit time for a user, e.g.: userid -1001 entry time-11:00 exit time-11:30 What I'm doing is, getting the entry and exit based on the login time, but what I want is once I have got the entry and exit slot ,I should be able to set the session logout time as the exit time stored in the table. Suppose for: user id -1001, I should be able to logout user at 11:30. Please help me how to achieve this

http://stackoverflow.com/comment/39873132
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25537722
has text: *Why* do you want to "try with HashMap"?
score: 0

http://stackoverflow.com/comment/69615402
has text: Yes, this options exists, but even disabling the module from the UI if you try to submit two modules with the same name, you will get the failure on the Sonar execution. So, the option you propose is valid if you want to exclude a module which is not repeated.
comment on: http://stackoverflow.com/a/28103107
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25453241
accepted answer of: http://stackoverflow.com/q/25451978
answers question: http://stackoverflow.com/q/25451978
type: Answer
upvote count: 6
has body: You can get a monospaced font with the methods shown in the answers to this question: SWT - OS agnostic way to get monospaced font Then simply call StyledText#setFont(Font): public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); StyledText text = new StyledText(shell, SWT.BORDER | SWT.MULTI); text.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); text.setText("|i|m|\n|m|i|"); shell.pack(); shell.setSize(200, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } Looks like this:
type: AcceptedAnswer
downvote count: 0
score: 6

http://stackoverflow.com/a/25476587
downvote count: 1
answers question: http://stackoverflow.com/q/25476564
has body: In the constructor of a GUI, the components have not yet been rendered, and so their bounds will be [0, 0]. The components only get rendered after calling pack() or setVisible(true) on the top level window such as a containing JFrame. But your question begs the question of why do you need this information here? What will you do plan to do with this data? There are other locations where the information can be obtained and can be useful, such as a JComponent's paintComponent method or in a ComponentListener.
type: Answer
has comment: http://stackoverflow.com/comment/39759761
has comment: http://stackoverflow.com/comment/39759649
upvote count: 2
score: 1

http://stackoverflow.com/q/25472221
has answer: http://stackoverflow.com/a/25472374
has comment: http://stackoverflow.com/comment/39751598
tagged with: for-loop
upvote count: 0
answer count: 2
has title: For Loop different type on how to code
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/39751601
has answer: http://stackoverflow.com/a/25472235
type: Question
has comment: http://stackoverflow.com/comment/39751631
downvote count: 8
has comment: http://stackoverflow.com/comment/39751612
tagged with: java
has body: Hi can somebody tell me the difference between this to for loops.. int y = 3; int sif [] = new int [150]; for(int a= 0;a&lt;sif.length;a = a + y){ sif[a]=a; y++; } and this one: int y = 3; int sif [] = new int [150]; for(int a= 0;a&lt;sif.length;a = a + y){ sif[a]=a; } y++; is there a difference can somebody explain this...
score: -8

http://stackoverflow.com/q/25495494
has comment: http://stackoverflow.com/comment/39795214
accepted answer: http://stackoverflow.com/a/25533524
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39795480
has answer: http://stackoverflow.com/a/25533524
has comment: http://stackoverflow.com/comment/39795262
downvote count: 0
upvote count: 1
tagged with: jsch
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/17583846
linked to: http://stackoverflow.com/q/2405885
has title: unable to understand connection establishment code
tagged with: remote-connection
has comment: http://stackoverflow.com/comment/39795231
possible better answer: http://stackoverflow.com/a/25500726
has answer: http://stackoverflow.com/a/25500726
has comment: http://stackoverflow.com/comment/39796227
has comment: http://stackoverflow.com/comment/39795245
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39795682
has body: I am beginner in Java and as such I am having difficulty in understanding a piece of code.At this SO post the first two lines create a connection instance: /* Create a connection instance */ Connection conn = new Connection(hostname); /* Now connect */ conn.connect(); I am unable to get which library needs to be imported to support this? The post mentions use of JSch in the beginning but when I tried it then I couldn't where in JSch Connection class is declared? Any help will be useful for me.
answer count: 2

http://stackoverflow.com/q/25408082
score: 0
answer count: 2
has body: I'm really new to Java and am working on a class project - I need to draw some pixels in a panel. I was given the jar code for the panel, and now I need to make different trails - specifically, I need to create a trail of pixels that will go around the perimeter of the panel, and I need to create some circles. Regarding the boxes - I've gotten part of it to work. My pixels starts in the upper left corner and run to the upper right corner, go down the right side of the panel, and then it goes a little crazy - I'm not sure if it stops at the bottom right corner or goes below the bounds of the panel itself, but it doesn't complete its trip around the perimeter. My code is: import cs251.lab1.Display; public class Visualizer { private static final int PIXEL_SIZE = 50; public static void main(String[] args) { Display panel = new Display(10, PIXEL_SIZE); drawWrappingDots(panel);} public static void drawWrappingDots(Display panel) { int x = 1; int y = 1; while (x &gt; 0 &amp;&amp; y &gt; 0){ if (x &lt; panel.getWidth()){ panel.drawNextPixel(x, y); x++; } if (x == panel.getWidth()){ panel.drawNextPixel(x, y); y++; } if (x &gt; 0 &amp;&amp; y == panel.getHeight()){ panel.drawNextPixel(x, y); x--; } if (x == 0 &amp;&amp; y == panel.getHeight()){ panel.drawNextPixel(x, y); y--; } What am I doing wrong? Second, how do I draw a circle? I know it needs to use the math library, but I'm not sure how to go about this. Any help on this is much appreciated. Thank you.
has answer: http://stackoverflow.com/a/25408632
tagged with: java
has title: How to draw in a panel in Java - not Jpanel
has comment: http://stackoverflow.com/comment/39633775
has answer: http://stackoverflow.com/a/25408626
possible better answer: http://stackoverflow.com/a/25408626
tagged with: panel
type: Question
accepted answer: http://stackoverflow.com/a/25408632
type: AnsweredQuestion

http://stackoverflow.com/comment/39835813
type: QuestionComment
comment on: http://stackoverflow.com/q/25517088
type: Comment
score: 1
has text: See http://stackoverflow.com/questions/6546193/how-to-catch-an-exception-from-a-thread

http://stackoverflow.com/a/25562061
answers question: http://stackoverflow.com/q/25547132
score: 0
has body: I used deferPrepares to false as the following and the problem goes away. Now it can compare with String and Graphics data type. db2://host:portNumber/DBname:deferPrepares=false; The deferred prepare means that the driver works without the benefit of described parameters or result set metadata until execution time: undescribed input data is sent as is to the server, without any data type cross-conversion of the input data. http://www-01.ibm.com/support/knowledgecenter/SSEPGG_8.2.0/com.ibm.db2.udb.doc/ad/c0010273.htm
type: Answer

http://stackoverflow.com/a/25529452
score: 0
answers question: http://stackoverflow.com/q/25529314
type: Answer
has body: this is just pseudo code since I don't actually know whats in the tables and or what the table names are.. but this is the general approach you should take SELECT u.username, a.address, p.age, b.cost FROM users u JOIN address a ON a.pk_data = u.pk_data JOIN person p on p.pk_data = u.pk_data JOIN bills b ON b.pk_data = u.pk_data WHERE u.pk_data = "whatever" Here I just called the tables users, address, person, bills.. you can change it to whatever you want. but the logic is there for joining the 4 tables

http://stackoverflow.com/a/25788468
has comment: http://stackoverflow.com/comment/40358723
has comment: http://stackoverflow.com/comment/40340802
answers question: http://stackoverflow.com/q/25489113
type: Answer
has body: From the TCP layer, an application is only provided information about the port it actually receives the connection on, and that would be port A in your case. You could use a tool like netcat as some kind of "funnel" so connections to port A and port B always end up at port A, but the TCP layer will not carry any information about that. If you need to separate multiple connection types that are all received at the same port in the server application, you have the following options: Embed information about the connection type at the application layer. Distinguish connections by the source port, i.e. the port at the client side. (You might or might not be able to use netcat, then. You could still use packet rewriting/port address translation, though.)
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39886162
has text: sir data is already there like (saving,corporate,salary).. but How I give value to account.setAccountType( one of above? )
comment on: http://stackoverflow.com/a/25545377
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25474022
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25472055
has body: Your guess is correct. The label value may not be collected using request.getParameter("lid"). Instead you could add a hidden input to pass along the value. Replace <%=n%> with <%=n%> <input type="hidden" name="lid" value="<%=n%>" >
answers question: http://stackoverflow.com/q/25472055
type: Answer
has comment: http://stackoverflow.com/comment/39755324
has comment: http://stackoverflow.com/comment/39755294

http://stackoverflow.com/a/25537977
has comment: http://stackoverflow.com/comment/39873397
score: 0
upvote count: 1
downvote count: 1
has body: There's no difference for the code you show, since all those methods are static. (The compiler will issue a warning for the second group, however.) I think there's a small performance benefit to static methods. The underlying byte code for static access, invokeSpecial I think, should be faster than invokeVirtual, which has to do some type decoding. But it's not enough to worry about. Use whichever type of method (static vs. instance) is right for your design. Don't try to optimize the method calls like that.
type: Answer
has comment: http://stackoverflow.com/comment/39873374
has comment: http://stackoverflow.com/comment/39873601
answers question: http://stackoverflow.com/q/25537944

http://stackoverflow.com/comment/39716153
comment on: http://stackoverflow.com/q/25453256
type: Comment
type: QuestionComment
has text: I think you've answered your own question here...why not just make an HTTP GET and check the status code/error?
score: 0

http://stackoverflow.com/a/50792088
type: Answer
has body: You can upload the file from android to server using volley. Check here. Android Volley File Upload
score: 0
answers question: http://stackoverflow.com/q/25518963

http://stackoverflow.com/q/25397722
answer count: 1
tagged with: http
has title: HTTP get with query parameters and storing xml response on disc java
type: Question
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25398530
tagged with: http://stackoverflow.com/tag/xml
score: 0
has body: I have a http end point which serves xml responses to my queries. I tried to fire the http requests like this - import java.io.*; import java.net.*; public class c { public String getHTML(String urlToRead) { URL url; HttpURLConnection conn; BufferedReader rd; String line; String result = ""; try { url = new URL(urlToRead); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); // how to store the response as an xml file on disc rd.close(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return result; } public static void main(String args[]) { c c = new c(); System.out.println(c.getHTML(args[0])); } } Now, the endpoint sends xml response which i want to store as a xml file on disc. how can i do that. can someone help?

http://stackoverflow.com/comment/39631668
has text: I'm also concerned about using a Struts action to initialize anything; is it really a Struts action? Why?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25407289

http://stackoverflow.com/q/25424371
favorite count: 0
tagged with: java
type: Question
tagged with: transformation
answer count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
downvote count: 0
has body: I am performing hot code swapping using instrumentation and java assist and say that for a method foo with the definition : int foo(){ System.out.println("In foo"); return 0; } I am setting the body to : method.setBody("return -1;"); Now after I am doing so, I perform some actions in my plugin with the changed code and then once my actions are performed (my actions don't change code anymore than the basic transformation I perform in the pre main step), I want to revert back to the code before transformation. Is there a way I can achieve this?
has title: Revert changes done by hot code swapping

http://stackoverflow.com/a/25527208
type: Answer
has body: As long as { and } are not nested you can use this regex to search: " +(?=[^{]*})" And use this for replacement: "" Java Code: String repl = input.replaceAll(" +(?=[^{]*})", ""); RegEx Demo
answers question: http://stackoverflow.com/q/25527138
score: 0

http://stackoverflow.com/a/25492428
score: 2
answers question: http://stackoverflow.com/q/25490451
upvote count: 2
downvote count: 0
type: Answer
has body: That timeout is generally not configurable as it depends on the possibilities offered by the operating system. Unix in general does not allow a process to fix the connection timeout and generally it is fixed to around two minutes. Perhaps some versions of linux/BSD systems allow this to be configured, but that's not portable and normally is not allowed to fix it to the user (only the administrator). This has to do with the number of retransmissions and the timeouts used for each try, and is under the exclusive control of the TCP implementation. When you finish a connection you pass through two states (FIN_WAIT and TIME_WAIT) that are not timeout states. The first of two is to get the other end's response (you can close your side of the connection telling the other side you are not going to send more data, but you have to wait for the other end to do the same thing) The TIME_WAIT is a special state that the kernel maintains for a closed connection to process (and discard) all the possible retransmissions of the last frames that can be in course after the connection is closed. They have nothing to do with timeouts. A tcp connection has no timeout implicit. Two machines can pass weeks without interchanging any info if they have nothing to transmit. You can control the use of some kind of heartbeat between silenting connections to check their liveness with one socket option (SO_KEEPALIVE) This option makes the tcps at both sides to interchange empty packets to know if the other side is still alive. Again, you can only control the use of this packets, not the frequency or the number of lost frames that closes the connection (this can be configured in linux, but touching the kernel configuration only in administrator mode) Note 1 (answer to @Krishna Chaitanya P) If you unplugged the cable and got an exception some time later, it can be one of two reasons for that to happen: You continued writing to that connection and the sending buffer filled up without being acknowledge…

http://stackoverflow.com/comment/39698419
has text: pls can you specify your need in details?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25443908

http://stackoverflow.com/q/25461640
has comment: http://stackoverflow.com/comment/39732111
has comment: http://stackoverflow.com/comment/39732340
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39731982
answer count: 3
has comment: http://stackoverflow.com/comment/39809500
upvote count: 2
has comment: http://stackoverflow.com/comment/39805968
accepted answer: http://stackoverflow.com/a/25484123
downvote count: 0
tagged with: calendar
has answer: http://stackoverflow.com/a/25484123
has comment: http://stackoverflow.com/comment/39731944
has comment: http://stackoverflow.com/comment/39809155
possible better answer: http://stackoverflow.com/a/25463892
favorite count: 0
has comment: http://stackoverflow.com/comment/39731972
type: Question
has title: How to compare "now" and a future time
has comment: http://stackoverflow.com/comment/39732414
has answer: http://stackoverflow.com/a/25463892
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25467721
has body: I need to compare the time a local file was downloaded with a time in the future/past to see if the file needs to be re-downloaded to update it. I can get the time the local file was last downloaded with : long timeSinceCreateFile = myFile.lastModified(); What I need is to check timeSinceCreateFile with a time that is the NEXT Friday at 21:30hs and if the current time: System.currentTimeMillis() is in the future to this then re-download the file. I've read heaps on Calendar, Time, Date, Joda-Time etc. but have not been able to figure out how to get a moment in time as a specific Day, Hour, Minuet, etc. that is RELATIVE to timeSinceCreateFile Edit I need to know the time in milliseconds between when a file was downloaded (or last modified) long timeSinceCreateFile = myFile.lastModified(); and the FOLLOWING Friday at 21:30hs (as in the Friday at 21:30hrs AFTER timeSinceCreateFile) I can then compare the "FOLLOWING FRIDAY AT 21:30hrs" milliseconds to the current time 'System.currentTimeMillis()` and if one is greater than the other re-download the file. Hope this clarified my question, if not let me know because I really need help with this. Thanks.
has comment: http://stackoverflow.com/comment/39731957

http://stackoverflow.com/comment/39628232
has text: That's a better idea. I'll fix that in the code. Thanks for the +1!
type: Comment
comment on: http://stackoverflow.com/a/25405786
score: 0
type: AnswerComment

http://stackoverflow.com/a/25480509
has comment: http://stackoverflow.com/comment/39782966
has comment: http://stackoverflow.com/comment/39780399
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39779190
has comment: http://stackoverflow.com/comment/39777986
has comment: http://stackoverflow.com/comment/39779461
has comment: http://stackoverflow.com/comment/39782944
has body: There is at this moment no standardized way to retrieve hostname/portnumber of a CORBA client, the reason is that CORBA is not tied to just sockets, there could be multiple kinds of transports which have completely different ways for addressing. Some ORBs do have some extension to make this possible, for example TAO has a TransportCurrent feature that does give access to this kind of information at the moment the client connects with IIOP. JacORB does have support for org.jacorb.transport.iiop.Current which also looks similar, have a look at that. But why not use CORBA for the file transfer? Than you don't have to get this information but just can store the stringified object reference and use it at a later moment.
has comment: http://stackoverflow.com/comment/39781515
accepted answer of: http://stackoverflow.com/q/25475644
type: Answer
answers question: http://stackoverflow.com/q/25475644
has comment: http://stackoverflow.com/comment/104312144
score: 4
upvote count: 4

http://stackoverflow.com/comment/39806355
comment on: http://stackoverflow.com/q/25501754
score: 0
has text: @BartoszKP oh yes, I can somehow manage to digest the benefits. But want to know what happens internally
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39826438
score: 0
type: AnswerComment
has text: line no. 96 is the the following line ` holder.value.name = "New Name";`
comment on: http://stackoverflow.com/a/25511362
type: Comment

http://stackoverflow.com/a/25577417
has comment: http://stackoverflow.com/comment/40128764
has comment: http://stackoverflow.com/comment/40021254
upvote count: 3
downvote count: 0
score: 3
type: Answer
has body: Frankly speaking, it doesn't sound like a Hadoop bug. Proper solution, as you've already mentioned, is to have classpath fixed, but try this: -Djavax.xml.bind.JAXBContext=com.sun.xml.internal.bind.v2.ContextFactory Additional details
answers question: http://stackoverflow.com/q/25433658

http://stackoverflow.com/comment/39677808
score: 0
type: Comment
has text: i have a php file inside a folder and java-resource is a subfolder in which i have my jar files and source files.I have compiled the files in my local and have copied the source files and class files in a server.(Made sure the path is pointing to the server)
type: QuestionComment
comment on: http://stackoverflow.com/q/25432443

http://stackoverflow.com/q/25544935
has answer: http://stackoverflow.com/a/25545035
score: 5
accepted answer: http://stackoverflow.com/a/25545143
has body: Is it possible to place two versions (64-bit and 32-bit) of a native DLL on the java.library.path? I'm concerned at whether if I placed the 64-bit and the 32-bit versions on the native library path, there would be an unsatisfied link exception in running for a different architecture. If so, what is the preferred solution? to have a flag in my gradle/maven build script that links the correct library? I'm currently doing the following: - -Djava.library.path=/out/lib/win64jdk;/out/lib/winx86jdk Both containing the relevant DLLs for the architecture. I'm not currently sure whether or not the JVM can determine the symbols.
has answer: http://stackoverflow.com/a/25545143
upvote count: 5
tagged with: java-native-interface
possible better answer: http://stackoverflow.com/a/25545035
type: AnsweredQuestion
answer count: 2
tagged with: java
downvote count: 0
has title: Can I place both the 32bit and 64bit versions of a native library on java.library.path?
favorite count: 0
type: Question

http://stackoverflow.com/comment/39694526
score: 0
has text: possible duplicate of [Is there a quick way to delete a file from a Jar / war without having to extract the jar and recreate it?](http://stackoverflow.com/questions/4520822/is-there-a-quick-way-to-delete-a-file-from-a-jar-war-without-having-to-extract)
comment on: http://stackoverflow.com/q/25440540
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25481262
answer count: 0
tagged with: ringtone
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39771635
type: Question
tagged with: audio
tagged with: notifications
has title: ringtone manager is not stop ringtone android
has body: i have two class incomingCallRing.java and IncomingCallSlider.java one class show the UI and 2nd class define the functions. The problem i m facing is when i click on reject call button the music of incoming call wont stop.Here is the code of both classes. incomingCallSlider.java private void RejectCall() { m_objBtnRejectCall = (Button) m_objActiveActivity.findViewById(R.id.RejectCallButton); m_objBtnRejectCall.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { //Log.e("Reject Call", m_sIncomingCallId); VaxPhone.m_objVaxVoIP.RejectCall(m_sIncomingCallId); HideSlider(); if(IncommingCall != null) IncommingCall.cancel(0); } }); } IncomingCallRing.java public static IncommingCallRing m_objIncommingCallRing; Ringtone m_objRingtone; Activity m_objActiveActivity; public IncommingCallRing() { m_objIncommingCallRing = this; } public void SetActiveActivity(Activity ReferenceActivity) { m_objActiveActivity = ReferenceActivity; } private void StartRingtone() { Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE); m_objRingtone = RingtoneManager.getRingtone(m_objActiveActivity.getApplicationContext(), notification); m_objRingtone.play(); } private void StopRingtone() { if(m_objRingtone == null) return; if(m_objRingtone.isPlaying()) m_objRingtone.stop(); }
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39771599
has comment: http://stackoverflow.com/comment/39768785
score: 0

http://stackoverflow.com/q/25546155
has comment: http://stackoverflow.com/comment/39887883
accepted answer: http://stackoverflow.com/a/25546452
has comment: http://stackoverflow.com/comment/39887809
has answer: http://stackoverflow.com/a/25546452
has comment: http://stackoverflow.com/comment/39888249
has answer: http://stackoverflow.com/a/25546479
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/39887887
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/39887926
possible better answer: http://stackoverflow.com/a/25546479
has body: Normally, we create objects as : String s1 = "a"; String s2 = "b"; String s3 = "c"; String s4 = "d"; ... I tried to create these with two string arrays: String[] names = { "s1", "s2", "s3", "s4" }; String[] vals = { "a", "b", "c", "d" }; int len = names.length; for(int i = 0; i &lt; len; i++){ String names[i] = vals[i]; } But it does not work. What can I do?
favorite count: 0
type: AnsweredQuestion
has title: Create object by defining object name from string array in java
has comment: http://stackoverflow.com/comment/39887770
has comment: http://stackoverflow.com/comment/39887825
tagged with: java

http://stackoverflow.com/comment/39892951
type: QuestionComment
comment on: http://stackoverflow.com/q/25549019
has text: What is the current output?
score: 1
type: Comment

http://stackoverflow.com/q/25456167
has body: I'm trying to get my android ProGuard configuration working properly. So far I'm pretty happy with the results but there is one thing that's really bugging me; even if it's not that big of a deal. I copied the proguard-android-optimize.txt file and modified that to remove my logging using the following -assumenosideeffects class com.my.package.Logger { *; } I know *; is "bad" but it's my own logging class so it doesn't matter if things like wait are removed. The above works great to remove all my logging but I'm trying to remove the remaining TAG variables from all my classes. The TAG variables are defined like this: private static final String TAG = thisClass.class.getSimpleName(); I've tried to remove them with configurations like these -assumenosideeffects class com.my.package.** { static final *** TAG; } -assumenosideeffects class com.my.package.** { static final java.lang.String TAG; } -assumenosideeffects class com.my.package.thisClass { static final java.lang.String TAG; } I've also tried to do it by attempting to remove all calls to getSimpleName but that didn't work either. Does anyone have any suggestions on how to remove these TAG fields that are no longer used? Some additional information: The calls to the logger are not concatinating any string, that is to say the log messages and TAGs are used as such com.my.package.Logger.log(TAG, "debug message"); //NOT log(TAG + "debug message"); After ProGuard is run, the resulting TAG field is technically no longer used but ProGuard optimizes it to this public void method() { String _tmp = a; //was Logger.log(TAG, "test"); //_tmp is never used anywhere else in this method } private static final String a = com/my/package/thisClass/getSimpleName();
tagged with: java
has comment: http://stackoverflow.com/comment/39722727
answer count: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39724726
score: 1
has title: How do I remove "TAG" field from class using ProGuard?
favorite count: 0
tagged with: proguard
type: Question
has answer: http://stackoverflow.com/a/25477700
tagged with: android
accepted answer: http://stackoverflow.com/a/25477700
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39722815

http://stackoverflow.com/q/25495223
downvote count: 1
tagged with: swing
tagged with: boxlayout
favorite count: 0
has comment: http://stackoverflow.com/comment/39824278
has title: CardLayout in Swing Doesnt work with Box Layout?
has body: I have some Swing code that uses a card layout for multiple panels. When I try to position buttons on my Home Panel, it doesnt work, like when I try and make the home header aligned. Is there anyway to make this work with the Box layout? import javax.swing.*; import java.applet.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; public class Main extends JFrame { JFrame frame; JPanel content; JPanel Home; JPanel Select; JPanel Create; CardLayout cardLayout; JButton select; JButton create; JButton homebutton; JButton homebutton2; JTextField headerHome; JTextField headerCreate; JTextField headerSelect; private JTextPane dfgdsfgdfgdfgTextPane; private JPanel panel1; public Main() { frame = new JFrame("Ice Cream Maker"); content = new JPanel(); Home = new JPanel(); Select = new JPanel(); Create = new JPanel(); cardLayout = new CardLayout(); homebutton = new JButton("Home"); homebutton.setMaximumSize(new Dimension(50, 80)); homebutton.setVisible(true); homebutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(content, "Home"); } }); homebutton2 = new JButton("Home"); homebutton2.setMaximumSize(new Dimension(50, 80)); homebutton2.setVisible(true); homebutton2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(content, "Home"); } }); Create.add(homebutton); Select.add(homebutton2); select = new JButton("Select"); select.setMaximumSize(new Dimension(50, 80)); select.setVisible(true); select.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(content, "Select"); } }); Home.add(select, Box.createHorizontalStrut(100)); create = new JButton("Create"); create.setMaximumSize(new Dimension(50, 80)); create.setVisible(true); create.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(content, "Create"); } }); Home.add(…
tagged with: java
has comment: http://stackoverflow.com/comment/39794717
type: Question
tagged with: box
tagged with: cardlayout
score: 0
has comment: http://stackoverflow.com/comment/39794808
answer count: 0
has comment: http://stackoverflow.com/comment/39824377
upvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/39722937
has text: @developerwjk I am not moving beyond application, I have files in Eclipse, WebContent contains both assets and dashboard files I just want to go from dashboard to assets inside of WebC0ntent
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25456694

http://stackoverflow.com/a/25502471
has comment: http://stackoverflow.com/comment/39808574
has body: If only some specified columns will be retrieved, the result will be List&lt;Object[]&gt;. In your case, Object[] will be populated with name value => index 0 and nameId => index 1. Need to cast it to target value's type. Criteria criteria = session.createCriteria(RevMetadata.class); criteria.add(Restrictions.eq("entityGUID", GUID)); criteria.setProjection(Projections.projectionList() .add(Projections.property("name")) .add(Projections.property("nameId"))); List&lt;Object[]&gt; criteriaResult = criteria.list(); List&lt;RevMetadata&gt; results = new ArrayList&lt;RevMetadata&gt;(); //then get result into the class properties for (Object[] object : criteriaResult) { //cast to target value type String name = (String)object[0]; int nameId = ((Integer)object[1]).intValue(); RevMetadata result = new RevMetadata(); result.setName(name); result.setValueId(nameId); results.add(result); } //now results of List&lt;RevMetadata&gt; is ready
answers question: http://stackoverflow.com/q/25499835
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39808652
downvote count: 0
upvote count: 1
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25499835

http://stackoverflow.com/comment/39632652
comment on: http://stackoverflow.com/a/25407414
type: Comment
score: 0
type: AnswerComment
has text: @Ayushchoubey well, now you know you can't.

http://stackoverflow.com/comment/39816774
comment on: http://stackoverflow.com/q/25507200
type: QuestionComment
has text: What have you tried so far? Show us some code and we can help guide you from there. You may also want to rephrase your question. You say you want to print some lines starting with a keyword, but your example states that you want to print lines preceding and including your keyword. Which is it?
type: Comment
score: 3

http://stackoverflow.com/q/25434353
has body: I have looked around online and some things have helped but I am still yet to get this thing working. I am making a simple pong game but I want it so all my code is well set out. So I have a class for the player1 paddle, the computer paddle, the ball, the main screen and also the play screen. So, for example, my player1Paddle class will have all the movement for that paddle, the computer paddle class(player2) will have all the movement for that and so on. But when it comes to coding the simple AI of the computer paddle (basically follow the ball left to right) I am unable to get access to the balls position if(player2Pong.position.x &gt; ballPong.position.x) It brings an error. Now i have instantiated the ball class and it works but I have basically made another ball but the movement is not there. Here are parts of the code to try and help. I know there's a lot of code, and probably some un-needed. On my playScreen i call player2movement - player2Pong.Player2Movement(); Heres the majority of the player2pong class. public class Player2Pong { public Vector2 position; String textureLoc; Texture Player2Texture; float stateTime; Rectangle player2Bounds; String movement; int speed = 2; int playerXVector = 5; SpriteBatch batch; //PlayerPong playerpong; Player2Pong player2pong; Ball ballPong; public int paddle_player2_Width = 80; public int paddle_player2_Height = 10; //PlayerPong player; public Player2Pong(Vector2 position, Ball ball){ Player2Texture = new Texture(Gdx.files.internal(("paddle_player2.png"))); this.position = position; player2Bounds = new Rectangle(position.x,position.y,paddle_player2_Width, paddle_player2_Height); //this.player2pong = player2pong; this.ballPong = ball; } public void update(){ } public void Player2Movement(){ player2pong = new Player2Pong(new Vector2(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() - (Gdx.graphics.getHeight()/8)), ballPong); System.out.println(player2pong.position.x); if(player2pong.position.x &gt; ballPong.getPosition(…
has comment: http://stackoverflow.com/comment/39682632
has comment: http://stackoverflow.com/comment/39681519
has comment: http://stackoverflow.com/comment/39682829
has comment: http://stackoverflow.com/comment/39682170
has comment: http://stackoverflow.com/comment/39682441
has answer: http://stackoverflow.com/a/25435215
has title: How do I gain access to an objects variable from another class?
accepted answer: http://stackoverflow.com/a/25435215
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39683461
has comment: http://stackoverflow.com/comment/39681416
has comment: http://stackoverflow.com/comment/39682343
tagged with: object
has comment: http://stackoverflow.com/comment/39682260
has comment: http://stackoverflow.com/comment/39682864
has comment: http://stackoverflow.com/comment/39682027
has comment: http://stackoverflow.com/comment/39681701
has comment: http://stackoverflow.com/comment/39681974
has comment: http://stackoverflow.com/comment/39682723
has comment: http://stackoverflow.com/comment/39683968
tagged with: libgdx
has comment: http://stackoverflow.com/comment/39682510
has comment: http://stackoverflow.com/comment/39681187
has comment: http://stackoverflow.com/comment/39682663
has comment: http://stackoverflow.com/comment/39681487
has comment: http://stackoverflow.com/comment/39682310
has comment: http://stackoverflow.com/comment/39681794
has comment: http://stackoverflow.com/comment/39682121
has comment: http://stackoverflow.com/comment/39682072
tagged with: inheritance
has comment: http://stackoverflow.com/comment/39682193
has comment: http://stackoverflow.com/comment/39681579
has comment: http://stackoverflow.com/comment/39681847
has comment: http://stackoverflow.com/comment/39682762
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39681167
has comment: http://stackoverflow.com/comment/39681763
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/39681639
downvote count: 0
score: 1
upvote count: 1
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39826450
comment on: http://stackoverflow.com/a/25510654
type: Comment
type: AnswerComment
has text: @ColdConfusion the issue is, the listener does not fire an event if the user is already logged in.
score: 0

http://stackoverflow.com/comment/39636697
score: 0
comment on: http://stackoverflow.com/q/25410227
type: QuestionComment
has text: You can always post a link to your image (link without ADS).
type: Comment

http://stackoverflow.com/comment/39702603
comment on: http://stackoverflow.com/q/25446426
type: Comment
type: QuestionComment
score: 0
has text: You could just try it... No, it is not possible. Additionally, your second example does not show overloading.

http://stackoverflow.com/comment/39631117
comment on: http://stackoverflow.com/q/25407289
score: 0
type: Comment
type: QuestionComment
has text: I'm not sure why you think that's what's happening. Have you actually verified things aren't working?

http://stackoverflow.com/comment/39868624
type: QuestionComment
comment on: http://stackoverflow.com/q/25535289
type: Comment
score: 0
has text: yes, sometimes i get the same behavior when java programs misbehave. but that's not "normal" programming for the application.

http://stackoverflow.com/comment/39612257
type: QuestionComment
has text: You have expectations. Where do they come from? Why did you write it that way?
comment on: http://stackoverflow.com/q/25397276
score: 2
type: Comment

http://stackoverflow.com/q/25470676
score: -4
answer count: 1
has body: making project on network in below code i want mainframe class to be processed completely first after that SecondFrame class to be continued...... class SecondFrame { SecondFrame() { Class.forName("com.mysql.jdbc.Driver"); Connection con1=DriverManager.getConnection("jdbc:mysql://localhost:3306/net","root","simer"); PreparedStatement ps=con1.prepareStatement("select * from record where email=?"); ps.setString(1,c1); ResultSet rs =ps.executeQuery(); while(rs.next()) { b=rs.getDouble("balance"); } if(b&gt;0) { long startTime = System.nanoTime(); System.out.println("balance is"+b); System.out.println("connected"); d=f1.getText(); new mainframe(d); \\main frame class long endTime = System.nanoTime(); double totalTime = endTime - startTime; double et = totalTime/1000000000; System.out.println(et); double bal = b - (et*(.4)); System.out.println(bal); PreparedStatement ps1=con.prepareStatement("UPDATE record SET balance=? where email=? "); ps1.setDouble(1,bal); ps1.setString(2,c1); ps1.executeUpdate(); } tried with the help of threads but not able to do it,in above the balance is deducted only for minute seconds which is even not recognized but want till the mainframe class is not closed balance to be deducted.....
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39749198
has answer: http://stackoverflow.com/a/25470695
has comment: http://stackoverflow.com/comment/39748849
downvote count: 4
upvote count: 0
has title: calling class inside another class
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/40675206
answers question: http://stackoverflow.com/q/25500925
has comment: http://stackoverflow.com/comment/85231732
downvote count: 0
has body: If you´re Sonar admin go to http:///background_tasks and select excecution log. You have the following error: 2016.11.18 08:56:08 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task XXXXXX org.sonar.api.utils.MessageException: Validation of project failed: o Module "moduleA" is already part of project "org.company:proj2" So you have to edit the MODULE pom.xml in your project proj1, and say it to Sonar that this module will be named as: &lt;properties&gt; &lt;sonar.moduleKey&gt;org.company:proj2:moduleA-NEW&lt;/sonar.moduleKey&gt; &lt;/properties&gt;
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/comment/39770637
comment on: http://stackoverflow.com/q/25482241
has text: Sometime, when i **only** type Katakana character.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25522104
type: AcceptedAnswer
has body: My friend helped me find a really short regex - ^[^$0-9]+[0-9].*
answers question: http://stackoverflow.com/q/25521100
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25521100

http://stackoverflow.com/q/25535254
tagged with: httpserver
score: 4
has body: I am using my server to distribute some files (in a zip), however, I want the user to enter a CAPTCHA before being able to download the file. This presents a new problem, because the code: private void sendFileResponse(final String filename, byte[] response, HttpExchange httpExchange) { // if (response != null && response.length > 0 && httpExchange != null) { try { httpExchange.setAttribute(HTTPExchange.HeaderFields.Content_Type.toString(), "application/zip"); OutputStream outputStream = httpExchange.getResponseBody(); httpExchange.sendResponseHeaders(200, response.length); outputStream.write(response); outputStream.flush(); outputStream.close(); httpExchange.getRequestBody().close(); } catch (Exception e) { System.out.println(Misc.getStackTrace(e)); } } // } ... will cause the file to be named as the download request webpage's URL. For example, if a user enters the correct CAPTCHA and downloads the file at /download.html, the file they receive would be download.html, not my file's name. How do I make the server send the file as the file's name and cause the webpage to refresh at the same time?
accepted answer: http://stackoverflow.com/a/25535318
has answer: http://stackoverflow.com/a/25535318
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39868213
tagged with: java
favorite count: 0
type: Question
upvote count: 4
has title: HttpExchange send file
answer count: 1
downvote count: 0

http://stackoverflow.com/q/25447862
has comment: http://stackoverflow.com/comment/39707238
score: 0
has comment: http://stackoverflow.com/comment/39706637
has comment: http://stackoverflow.com/comment/39707586
has comment: http://stackoverflow.com/comment/39705853
tagged with: java
has comment: http://stackoverflow.com/comment/39706017
has comment: http://stackoverflow.com/comment/39706325
has comment: http://stackoverflow.com/comment/39705447
type: Question
has title: Calculator application: prevent user from entering operator until number entered
has comment: http://stackoverflow.com/comment/39705848
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39706757
tagged with: swing
has body: I have this Java Swing application, a simple calculator, an I don't know how not add the operation first. It let me add an operation before i insert an number and this is a big problem for me. Can anyone tell me how to fix this problem? public class DetailsPanel extends JPanel{ private JTextField display; private String buttonsLabel; int labelCounter = 0; private final GridBagLayout layout; private final GridBagConstraints gc; private JButton[] numberButton, oppButtons; private String oppLabel[] = {"C","+/-","*","/","-","+","=",".","sqrt","sqr","min","max"}, lastOperator, lastNumber; private Boolean operation = false, number = false, isSet = false, operatorExist = false, lastNumberExist = false; //[0]=gridx,[1]=gridy,[2]=gridwidth,[3]=gridhewight private final int[][] grid = new int[][] { {0,6,2,1}, //0 {0,5,1,1}, //1 {1,5,1,1}, //2 {2,5,1,1}, //3 {0,4,1,1}, //4 {1,4,1,1}, //5 {2,4,1,1}, //6 {0,3,1,1}, //7 {1,3,1,1}, //8 {2,3,1,1} //9 }; private final int[][] grid2 = new int[][] { /* C */{0,2,1,1}, /* +/- */{1,2,1,1}, /* * */{2,2,1,1}, /* / */{3,2,1,1}, /* - */{3,3,1,1}, /* + */{3,4,1,1}, /* = */{3,5,1,2}, /* . */{2,6,1,1}, /* sqrt */ {0,7,1,1}, /*sqr*/{1,7,1,1}, /*min*/{2,7,1,1}, /*max*/{3,7,1,1} }; public DetailsPanel(){ //JOptionPane.showMessageDialog(null, 12.2 % 1 != 0); Dimension size = getPreferredSize(); size.width = 224; size.height = 324; setPreferredSize(size); //Dysplay display = new JTextField("0"); display.setEditable(false); display.setBackground(Color.WHITE); //Set layout layout = new GridBagLayout(); layout.columnWidths = new int[] {40,40,40,40}; layout.rowHeights = new int[] {40,40,40,40,40,40,40,40}; setLayout(layout); gc = new GridBagConstraints(); //ADD Dysplay gc.gridx = 0; gc.gridy = 0; gc.gridwidth = 4; gc.gridheight = 2; gc.fill = GridBagConstraints.BOTH; add(display, gc); numberButton = new JButton[10]; //Start adding buttons for(int i = 0; i&lt;numberButton.length;i++){ numberButton[i] = new JButton("" +i); gc.gridx = grid[i][0]; gc.gridy …

http://stackoverflow.com/q/25505791
has answer: http://stackoverflow.com/a/25506936
has comment: http://stackoverflow.com/comment/39814421
has comment: http://stackoverflow.com/comment/39814219
has body: Assume that I have an entity Person which stores Cars belonging to that person. @Entity @Table public class Person imlpements Serializable { @OneToMany(mappedBy = "person") private List&lt;Car&gt; cars = new ArrayList&lt;Car&gt;(); } @Entity @Table public class Car imlpements Serializable { @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "person_id") private Person person } I want to make persist over Cars. It throws ConcurrentModificationException. I do not get the reason for (Car car : person.getCars()) { em.merge(car) } EDITED. This is my entity manager: @PersistenceContext(unitName = "DBService") private EntityManager em; This is stack trace at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372) [:1.6.0_30] at java.util.AbstractList$Itr.next(AbstractList.java:343) [:1.6.0_30] at org.hibernate.collection.AbstractPersistentCollection$IteratorProxy.next(AbstractPersistentCollection.java:580) [:3.6.0.Final] at com.importer Import.findCars(Import.java:114) [:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_30] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_30] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_30] at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_30] at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122) [jboss-aop.jar:2.2.1.GA] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) [jboss-aop.jar:2.2.1.GA] at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72) [:1.1.3] at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76) [:1.1.3] at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62) [:1.1.3] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_30] at…
has comment: http://stackoverflow.com/comment/39813944
has comment: http://stackoverflow.com/comment/39814767
has comment: http://stackoverflow.com/comment/39814520
score: 1
tagged with: java
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/39813946
downvote count: 0
has title: Jpa persist/merge throws ConcurrentModificationException inside loop
upvote count: 1
has comment: http://stackoverflow.com/comment/39814498
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25506936
type: AnsweredQuestion

http://stackoverflow.com/q/25416605
tagged with: java
tagged with: python
accepted answer: http://stackoverflow.com/a/25416763
has body: I'm sending int by using DataOutputStream to Python via a socket but the data I receive at the Python part occasionally gets corrupted and I get the following error: unpack requires a string argument of length 4 Not to mention that I run the Java part repeatedly. I have no idea why this happens. Please help. Here is the Java part: public static void main(String[] args) { Socket sock = null; DataOutputStream out = null; try { sock = new Socket("192.168.0.104", 1234); out = new DataOutputStream(sock.getOutputStream()); out.writeInt(2); out.flush(); } catch (IOException e) { e.printStackTrace(); } finally { try { out.close(); sock.close(); } catch (IOException e) { e.printStackTrace(); } } } And here is the Python part: import socket import struct host = '192.168.0.104' port = 1234 backlog = 5 size = 4 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host, port)) s.listen(backlog) while 1: client, address = s.accept() data = client.recv(size) unpacked = int(struct.unpack('&gt;i', data)[0]) if data: print unpacked client.close() Here is the output: 2 2 2 Traceback (most recent call last): File "test_socket1.py", line 20, in &lt;module&gt; unpacked = int(struct.unpack('&gt;i', data)[0]) struct.error: unpack requires a string argument of length 4
type: Question
has comment: http://stackoverflow.com/comment/39648778
answer count: 1
has comment: http://stackoverflow.com/comment/39648770
has answer: http://stackoverflow.com/a/25416763
linked to: http://stackoverflow.com/q/11871712
type: AnsweredQuestion
score: 0
has title: Socket connection between Java and Python - struct.unpack error
tagged with: sockets

http://stackoverflow.com/q/25487931
answer count: 1
tagged with: bitmap
has comment: http://stackoverflow.com/comment/39780490
has body: I have an ArrayList i would like to add a new bitmap to the list evertime a button is clicked.but when i check the size of the bitmap it is always one.my code is below please help. ArrayList&lt;Bitmap&gt; rev; findViewById(R.id.galleryb).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Bitmap bmps = mTextureView.getBitmap(); rev = new ArrayList&lt;Bitmap&gt;(); for (int i = 0; i &lt; 50; i++) { rev.add(bmps[i]); Toast.makeText(getApplicationContext(),""+rev.size(), Toast.LENGTH_LONG).show(); } } } });
has title: Add new bitmap to ArrayList<Bitmap>
type: Question
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39780536
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25488097
has comment: http://stackoverflow.com/comment/39780553
has comment: http://stackoverflow.com/comment/39780735
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25488097

elasticsearch-java-api
tag name: elasticsearch-java-api
tags question: http://stackoverflow.com/q/25453947
tags question: http://stackoverflow.com/q/25425243
type: Tag

http://stackoverflow.com/a/25505129
answers question: http://stackoverflow.com/q/25501982
has comment: http://stackoverflow.com/comment/39839257
has comment: http://stackoverflow.com/comment/39839609
score: 0
has comment: http://stackoverflow.com/comment/39813802
has body: Add some.properties to Spring context: e.g. In your config class. @Bean public PropertyPlaceholderConfigurer propertyPlaceholder() { PropertyPlaceholderConfigurer bean = new PropertyPlaceholderConfigurer(); bean.setLocations(new ClassPathResource("some.properties")); return bean; } You need to retrieve ApplicationContext instance for #3: e.g. @Component class HogeContextAware implements org.springframework.context.ApplicationContextAware { @Override public void setApplicationContext(final ApplicationContext applicationContext) { this.global.applicationContext = applicationContext; } } Populate a Bean that is not Spring managed: e.g. ConfigurableApplicationContext configurableAppContext = (ConfigurableApplicationContext) global.applicationContext.getSpringContext(); YourBean bean = new YourBean(); configurableAppContext.getBeanFactory().autowireBean(bean); bean.getFooValue(); It works(, I guess).
type: Answer

http://stackoverflow.com/q/25506913
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39842344
has body: When I call getChildren() on a Zookeeper node with curator, is there a way to ignore child nodes that represent a lock? I want to read all children with their data of one specific node. Therefore, I first call getChildren() and iterate over the returned List and call getData() on each such child. To avoid that the children are changing in between I foremost require an InterProcessMutex. Unfortunately, the list of children also contains this mutex. InterProcessMutex mutex = new InterProcessMutex(client, parentNodePath); mutex.acquire(); try { List&lt;String&gt; children = client.getChildren().forPath(parentNodePath); for (String child : children) { // do something // ignore the lock-node } } finally { mutex.release(); } Is there a smarter way to do that? Or to just ignore the lock-node?
tagged with: apache-zookeeper
type: UnansweredQuestion
downvote count: 0
tagged with: apache-curator
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/38951685
answer count: 1
has title: Ignore lock-nodes when calling getChildren on a Zookeeper node
upvote count: 1

http://stackoverflow.com/comment/39777837
score: 0
type: Comment
type: AnswerComment
has text: Got it! It should be like `int ab[]=(int[]) list.get(0);`
comment on: http://stackoverflow.com/a/25483925

jsp
tags question: http://stackoverflow.com/q/25479412
tags question: http://stackoverflow.com/q/25524628
tags question: http://stackoverflow.com/q/25415430
tags question: http://stackoverflow.com/q/25449103
tags question: http://stackoverflow.com/q/25510040
tags question: http://stackoverflow.com/q/25494511
tags question: http://stackoverflow.com/q/25522827
tags question: http://stackoverflow.com/q/25461738
tags question: http://stackoverflow.com/q/25436244
tags question: http://stackoverflow.com/q/25501931
tags question: http://stackoverflow.com/q/25472055
tags question: http://stackoverflow.com/q/25449130
tags question: http://stackoverflow.com/q/25476707
tags question: http://stackoverflow.com/q/25527781
tags question: http://stackoverflow.com/q/25494878
tags question: http://stackoverflow.com/q/25442784
tags question: http://stackoverflow.com/q/25447055
tags question: http://stackoverflow.com/q/25496994
tags question: http://stackoverflow.com/q/25466946
tags question: http://stackoverflow.com/q/25529639
tags question: http://stackoverflow.com/q/25501441
tag name: jsp
tags question: http://stackoverflow.com/q/25505358
tags question: http://stackoverflow.com/q/25483483
tags question: http://stackoverflow.com/q/25426272
tags question: http://stackoverflow.com/q/25417583
tags question: http://stackoverflow.com/q/25415107
tags question: http://stackoverflow.com/q/25447957
tags question: http://stackoverflow.com/q/25545174
tags question: http://stackoverflow.com/q/25519316
tags question: http://stackoverflow.com/q/25433224
tags question: http://stackoverflow.com/q/25413027
tags question: http://stackoverflow.com/q/25391418
tags question: http://stackoverflow.com/q/25425056
tags question: http://stackoverflow.com/q/25528508
tags question: http://stackoverflow.com/q/25483296
tags question: http://stackoverflow.com/q/25407934
tags question: http://stackoverflow.com/q/25501162
tags question: http://stackoverflow.com/q/25499567
tags question: http://stackoverflow.com/q/25398221
tags question: http://stackoverflow.com/q/25528087
tags question: http://stackoverflow.com/q/25497909
tags question: http://stackoverflow.com/q/25455673
tags question: http://stackoverflow.com/q/25459515
tags question: http://stackoverflow.com/q/25394009
tags question: http://stackoverflow.com/q/25523153
tags question: http://stackoverflow.com/q/25431711
tags question: http://stackoverflow.com/q/25425678
tags question: http://stackoverflow.com/q/25449994
tags question: http://stackoverflow.com/q/25495649
tags question: http://stackoverflow.com/q/25435312
tags question: http://stackoverflow.com/q/25499206
tags question: http://stackoverflow.com/q/25499854
tags question: http://stackoverflow.com/q/25426914
tags question: http://stackoverflow.com/q/25491391
tags question: http://stackoverflow.com/q/25420244
tags question: http://stackoverflow.com/q/25456694
tags question: http://stackoverflow.com/q/25546592
tags question: http://stackoverflow.com/q/25529566
tags question: http://stackoverflow.com/q/25418087
tags question: http://stackoverflow.com/q/25508326
tags question: http://stackoverflow.com/q/25463427
tags question: http://stackoverflow.com/q/25490820
tags question: http://stackoverflow.com/q/25488572
tags question: http://stackoverflow.com/q/25414933
tags question: http://stackoverflow.com/q/25448443
tags question: http://stackoverflow.com/q/25423679
tags question: http://stackoverflow.com/q/25397158
tags question: http://stackoverflow.com/q/25541564
tags question: http://stackoverflow.com/q/25494391
tags question: http://stackoverflow.com/q/25441345
tags question: http://stackoverflow.com/q/25526966
type: Tag
tags question: http://stackoverflow.com/q/25474555
tags question: http://stackoverflow.com/q/25546092
tags question: http://stackoverflow.com/q/25400869
tags question: http://stackoverflow.com/q/25506006
tags question: http://stackoverflow.com/q/25525878
tags question: http://stackoverflow.com/q/25450671
tags question: http://stackoverflow.com/q/25480327

http://stackoverflow.com/comment/39739837
comment on: http://stackoverflow.com/a/25465232
type: Comment
has text: worked thank you. i have two questions to learn better. 1. why static needed. 2. why * in Constants.* needed? Thank you
score: 0
type: AnswerComment

http://stackoverflow.com/a/25500559
has body: It's a 1337 (high performance) way of coding: if (len % 2 == 1) i.e. is len odd. It works because the binary representation of every odd integer has its least significant (ie last) bit set. Performaning a bitwise AND with 1 masks all other bits, leaving a result of either 1 if it's odd or 0 if even. It's a carryover from C, where you can code simply: if (len &amp; 1)
type: Answer
accepted answer of: http://stackoverflow.com/q/25500494
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25500494
score: 3

http://stackoverflow.com/comment/39803379
has text: +1 for reading the question carefully -- no need for a regex!
type: Comment
comment on: http://stackoverflow.com/a/25495573
score: 1
type: AnswerComment

http://stackoverflow.com/comment/39659694
type: Comment
type: AnswerComment
has text: @BnJ Calendar is `0` based for month. And note that you are retrieving the records with month only and not consider the year ???
comment on: http://stackoverflow.com/a/25422359
score: 0

http://stackoverflow.com/comment/39692186
comment on: http://stackoverflow.com/q/25440427
score: 0
has text: I just went with this: if ((i+1) % 2 == 0){ int h = i-1; str += letter[h] + ": " + count[h] + "\t" + letter[i] + ": " + count[i] + "\n"; }
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39783659
has text: No worries. I updated the answer with a new example. I think I misunderstood what you were trying to do. Instead of just updating the time, I update another value, based on the new time
score: 0
comment on: http://stackoverflow.com/a/25488992
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25466455
has answer: http://stackoverflow.com/a/25466500
favorite count: 0
has body: i have completed this code but this code is executing very slow please tell me how to fast execution time or what is the modification in coding (This program save prime numbers between 500000 to 10000000 in task text file) import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; public class primenumber { public static void main(String[] args) throws IOException { PrintStream as = new PrintStream("task.txt"); int i,j,k; for(i=500000;i&lt;10000000;i++) //here you can give your own range { k=0; for(j=2;j&lt;i;j++) { if(i%j==0) k++; } if(k==0) as.println(i+" "); } as.close(); System.out.println("file is created"); } }
answer count: 4
has comment: http://stackoverflow.com/comment/39740932
type: Question
has answer: http://stackoverflow.com/a/25466539
downvote count: 2
has comment: http://stackoverflow.com/comment/39741128
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25467314
score: -1
has title: Modification to reduce execution time
tagged with: java
has comment: http://stackoverflow.com/comment/39741054
upvote count: 1
has answer: http://stackoverflow.com/a/25466483

http://stackoverflow.com/q/25509079
possible better answer: http://stackoverflow.com/a/25510924
tagged with: java
downvote count: 2
has body: Java designer's felt that unsigned integers were unnecessary. Specifically, they felt that the concept of unsigned was used mostly to specify the behavior of the high-order bit, which defines the sign of an integer value. Java manages the meaning of the high-order bit differently, by adding a special "Unsigned Right Shift Operator >>>". Thus, the need for an unsigned integer type was eliminated. Then, why Java 8 will have some support for unsigned integers.
upvote count: 1
has answer: http://stackoverflow.com/a/25510924
has title: Unsigned integer type in Java 8?
favorite count: 0
type: Question
answer count: 2
tagged with: java-8
accepted answer: http://stackoverflow.com/a/25509178
score: -1
has answer: http://stackoverflow.com/a/25509178
type: AnsweredQuestion

http://stackoverflow.com/comment/39868942
has text: So you can mark it answered then, yes? You can add an answer yourself and check that.
comment on: http://stackoverflow.com/a/25534662
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25541427
has answer: http://stackoverflow.com/a/25541714
accepted answer: http://stackoverflow.com/a/25541714
has comment: http://stackoverflow.com/comment/39879448
has answer: http://stackoverflow.com/a/25541462
favorite count: 0
has body: I am new to learn maven by following this example given by sonatype's book.This is a simplest pom.xml file (works fine). But my question is, how does maven (mvn install) find Java compiler (javac) installed on my machine? This POM file doesn't specify JDK in any way. Thanks for explanation. EDIT: As a comparison, I am following next example in the book and this time, I received a compilation error because it can't find javax.My java file is in, as suggested in the book: src/main/java/org/sonatype/mavenbook/web/SimpleServlet.java Now as I run mvn compile, and i got error message below. Why now maven can't find the compiler: ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project simple-webapp: Compilation failure: Compilation failure: [ERROR] /home/abigail/study/simple-webapp/src/main/java/org/sonatype/mavenbook/web/SimpleServlet.java:[4,1] package javax.servlet does not exist POM.xml 4.0.0 org.sonatype.mavenbook.simpleweb simple-webapp war 1.0-SNAPSHOT simple-webapp Maven Webapp http://maven.apache.org junit junit 3.8.1 test simple-webapp maven-compiler-plugin 1.7 1.7
has title: How does maven find Java compiler?
type: Question
tagged with: maven
has answer: http://stackoverflow.com/a/25541476
possible better answer: http://stackoverflow.com/a/25541476
answer count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/49666767
score: 7
upvote count: 7
tagged with: java

http://stackoverflow.com/a/25502240
score: 3
upvote count: 3
downvote count: 0
type: Answer
has body: While I can imagine scenarios where code that you have carefully reviewed may be safely stopped with Thread.stop(), you are talking about the opposite, code that you distrust so much that you are attempting to restrict its actions by a SecurityManager. So what can go wrong? First of all, stopping does not work more reliable than interruption. While it is easier to ignore an interruption, a simple catch(Throwable t){} is enough to make Thread.stop() not work anymore and such a catch may appear in code even without the intention of preventing Thread.stop() from working, though it is bad coding style. But coders wanting to ignore Thread.stop() might even add a catch(Throwable t){} and/or catch(ThreadDeath t){} intentionally. Speaking of bad coding style, locking should always be implemented using try … finally … to ensure that the lock is guaranteed to be freed even in the exceptional case. If the stopped code failed to do this right, the lock may remain locked when the thread will be stopped. The bottom line is that within the same JVM you can’t protect yourself against untrusted code. The JVM is the sandbox which protects the outside. Just one simple example: a malicious code could start eating up memory by performing lots of small memory allocations. There is nothing you can do within the JVM to protect some code running in the same JVM against it. You can only enforce limits for the entire JVM. So the only solution is to run the plugins in a different JVM.
accepted answer of: http://stackoverflow.com/q/25489720
has comment: http://stackoverflow.com/comment/39809765
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25489720

http://stackoverflow.com/comment/39625402
score: 0
type: Comment
type: QuestionComment
has text: does it also work when you pass any builtin Parcelable?
comment on: http://stackoverflow.com/q/25403468

http://stackoverflow.com/q/25518186
has body: RestTemplate is not working and throwing Connection refused exception. Not sure what's the issue on my personal computer where i use wireless internet and there's no proxy involved. Junit test @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:testContext.xml") public class RestServiceTest { @Autowired private RestTemplate restTemplate; @Test public void testRestService() { ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8080/hello/world", String.class); String responseTask = response.getBody(); } } test-context.xml <context:component-scan base-package="com.example" /> Controller @Controller public class SampleController { @RequestMapping(value = "/hello/{message}", method = RequestMethod.GET) public @ResponseBody String sayHello(@PathVariable String message) { return "Hello "+message; } } pom.xml <junit.version>4.11</junit.version> <spring.version>4.0.0.RELEASE</spring.version> <jackson.version>2.3.2</jackson.version> org.springframework spring-webmvc ${spring.version} com.fasterxml.jackson.core jackson-databind ${jackson.version} org.springframework spring-test ${spring.version} junit junit ${junit.version} test exception org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8080/hello/world":Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
answer count: 0
has comment: http://stackoverflow.com/comment/39875088
score: 0
tagged with: junit
has comment: http://stackoverflow.com/comment/39837598
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/39852215
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39837562
tagged with: java
has comment: http://stackoverflow.com/comment/39837471
has title: Spring MVC responsebody RestTemplate Connection refused localhost

http://stackoverflow.com/comment/39815281
has text: What means "How to make this codes run.?"?
comment on: http://stackoverflow.com/q/25506386
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27789762
has body: If you use the StandardFileSystemManager() it will read its configuration from the classpath (from provider.xml and vfs-provider.xml files in the core and sandbox jar). It is therefore already initialized with providers for http and https. You can either do if (manager.hasProvider("http")) around adding the provider or you just skip adding the providers and rely on automatic configuration. Typically you would use VFS.getManager() to get a fully configured FileSystemManager with all known providers registered. If you want to configure the manager compeltely by hand, you would use a new DefaultFileSystemManger() instead. (this requires to add stuff like cache, replicator and so on).
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25547640
type: Answer

http://stackoverflow.com/comment/39738448
type: Comment
comment on: http://stackoverflow.com/q/25465034
score: 0
type: QuestionComment
has text: But I have been asked to inherit 'College' class to 'Department' and 'Department' to 'Faculty'...

http://stackoverflow.com/comment/39636868
type: Comment
type: QuestionComment
has text: @ElliottFrisch - but there are a lot more nanoseconds. `S` x 9 would imply nanoseconds.
comment on: http://stackoverflow.com/q/25410088
score: 0

http://stackoverflow.com/q/25477134
answer count: 1
tagged with: string
has body: I am trying to change the information in create a new character array of Str without the whitespaces. However, I cant succeed in doing sp I dont know why the output says: Haveaniceday Have a nice day instead of: Haveaniceday Haveaniceday import java.util.*; class DelExtraSpace { public static void main(String args[]) { char c[],s[]; String str; Scanner scn = new Scanner(System.in); str = "Have a nice day"; c = str.toCharArray(); s = new char [c.length]; for(int i = 0; i &lt; c.length; i++) { if(!Character.isSpaceChar(c[i])) { System.out.print(c[i]); s[i] = c[i]; // I want the value of c[i] to be assigned to s[i] only when c[i] is not a whitespace } } System.out.println(); for(int j = 0; j &lt; s.length; j++) System.out.print(s[j]); } }
type: Question
has comment: http://stackoverflow.com/comment/39760834
has comment: http://stackoverflow.com/comment/39760779
tagged with: arrays
accepted answer: http://stackoverflow.com/a/25477259
has answer: http://stackoverflow.com/a/25477259
has title: Output of this character array java program
has comment: http://stackoverflow.com/comment/39761020
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39760666
has comment: http://stackoverflow.com/comment/39760746
has comment: http://stackoverflow.com/comment/39760901
tagged with: java

http://stackoverflow.com/comment/39750403
comment on: http://stackoverflow.com/q/25471239
score: 0
type: QuestionComment
has text: Thanks soulcheck, iv'e fixed my snippet. so is there a way to not redirect ?
type: Comment

http://stackoverflow.com/a/25474094
answers question: http://stackoverflow.com/q/25473938
type: Answer
has comment: http://stackoverflow.com/comment/39757766
score: 1
downvote count: 0
upvote count: 1
has body: Here's how I'd suggest doing it: package matrix; import java.io.PrintStream; /** * MatrixUtils description here * @author Michael * @link https://stackoverflow.com/questions/25473938/i-am-making-a-code-in-java-for-the-multiplication-of-two-matrices-can-anyone-p * @since 8/24/2014 12:47 PM */ public class MatrixUtils { public static void main(String[] args) { int [][] a = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; int [][] b = { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 0, 2 } }; int [][] result = MatrixUtils.mult(a, b); MatrixUtils.print(System.out, result); } public static void print(PrintStream ps, int [][] m) { for (int i = 0; i &lt; m.length; ++i) { for (int j = 0; j &lt; m[i].length; ++j) { ps.print(String.format("%5d ", m[i][j])); } ps.println(); } } public static int [][] mult(int[][] a, int [][] b) { if (a == null) throw new IllegalArgumentException("Matrix a cannot be null"); if (b == null) throw new IllegalArgumentException("Matrix b cannot be null"); if (a[0].length != b.length) throw new IllegalArgumentException("Size mismatch"); int numRows = a.length; int numCols = b[0].length; int[][] result = new int[numRows][numCols]; for (int i = 0; i &lt; numRows; ++i) { for (int j = 0; j &lt; numCols; ++j) { int sum = 0; for (int k = 0; k &lt; b.length; ++k) { sum += a[i][k]*b[k][j]; } result[i][j] = sum; } } return result; } }

http://stackoverflow.com/q/25481129
upvote count: 1
has body: I have a database where i have stored some values in double format and i am populating those values via json to the datatable.but data is coming in proper format from the database.But when it is coming through json it is not getting the proper value, i.e the decimal part is missing. <script type="text/javascript" src="<html:rewrite page='/js/metal.js'/>"> <html:errors/> Item Code Item Description URL MODEL LAST UPDATED MRP can any one help me i am setting the dataa in the action with this DataTableJsonObject dat=new DataTableJsonObject(); List <CategoryObject> catlist=catalogService.getCategoryTree(storeId,catSearch,dat); CategoryObject cat=new CategoryObject(); UserObject user=new UserObject(); dat.setData(catlist); JSON json=JSONSerializer.toJSON(dat); //JSON json=JSONArray.fromObject(user); PrintWriter out = response.getWriter(); out.print(json.toString()); System.out.println("json:"+json.toString()); response.setContentType("application/json");;
tagged with: java
tagged with: http://stackoverflow.com/tag/json
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39771263
type: UnansweredQuestion
tagged with: datatable
has title: DataTable is not getting decimal value of an item via json
answer count: 0
downvote count: 0
score: 1

http://stackoverflow.com/comment/130038957
has text: The question was about Map<String, Object>
comment on: http://stackoverflow.com/a/46462988
type: Comment
type: AnswerComment
score: 0

hibernate
tags question: http://stackoverflow.com/q/25547365
tags question: http://stackoverflow.com/q/25461413
tags question: http://stackoverflow.com/q/25462416
tags question: http://stackoverflow.com/q/25458444
tags question: http://stackoverflow.com/q/25503709
tags question: http://stackoverflow.com/q/25436659
tags question: http://stackoverflow.com/q/25434892
tags question: http://stackoverflow.com/q/25488260
tags question: http://stackoverflow.com/q/25402622
tags question: http://stackoverflow.com/q/25392604
tags question: http://stackoverflow.com/q/25545273
tags question: http://stackoverflow.com/q/25502398
tags question: http://stackoverflow.com/q/25428231
tags question: http://stackoverflow.com/q/25483863
tags question: http://stackoverflow.com/q/25402160
tags question: http://stackoverflow.com/q/25403617
tags question: http://stackoverflow.com/q/25471963
tags question: http://stackoverflow.com/q/25542825
tags question: http://stackoverflow.com/q/25469858
tags question: http://stackoverflow.com/q/25542968
tags question: http://stackoverflow.com/q/25428825
tags question: http://stackoverflow.com/q/25470379
tags question: http://stackoverflow.com/q/25524952
tags question: http://stackoverflow.com/q/25467490
tags question: http://stackoverflow.com/q/25514859
tags question: http://stackoverflow.com/q/25520633
tags question: http://stackoverflow.com/q/25547025
tags question: http://stackoverflow.com/q/25446942
tags question: http://stackoverflow.com/q/25454918
tags question: http://stackoverflow.com/q/25523722
tags question: http://stackoverflow.com/q/25540574
tags question: http://stackoverflow.com/q/25506749
tags question: http://stackoverflow.com/q/25439927
type: Tag
tags question: http://stackoverflow.com/q/25487659
tags question: http://stackoverflow.com/q/25524794
tags question: http://stackoverflow.com/q/25442784
tags question: http://stackoverflow.com/q/25542559
tags question: http://stackoverflow.com/q/25541150
tags question: http://stackoverflow.com/q/25437964
tags question: http://stackoverflow.com/q/25455497
tags question: http://stackoverflow.com/q/25494322
tags question: http://stackoverflow.com/q/25519401
tags question: http://stackoverflow.com/q/25499835
tags question: http://stackoverflow.com/q/25542231
tags question: http://stackoverflow.com/q/25495952
tags question: http://stackoverflow.com/q/25431210
tags question: http://stackoverflow.com/q/25412532
tags question: http://stackoverflow.com/q/25494214
tags question: http://stackoverflow.com/q/25535991
tags question: http://stackoverflow.com/q/25516980
tags question: http://stackoverflow.com/q/25450510
tags question: http://stackoverflow.com/q/25518139
tags question: http://stackoverflow.com/q/25440284
tags question: http://stackoverflow.com/q/25516797
tags question: http://stackoverflow.com/q/25465186
tags question: http://stackoverflow.com/q/25525553
tags question: http://stackoverflow.com/q/25402097
tags question: http://stackoverflow.com/q/25539577
tags question: http://stackoverflow.com/q/25488246
tags question: http://stackoverflow.com/q/25476515
tags question: http://stackoverflow.com/q/25432698
tags question: http://stackoverflow.com/q/25420500
tags question: http://stackoverflow.com/q/25536065
tags question: http://stackoverflow.com/q/25426231
tags question: http://stackoverflow.com/q/25444185
tags question: http://stackoverflow.com/q/25510070
tags question: http://stackoverflow.com/q/25510194
tags question: http://stackoverflow.com/q/25546413
tags question: http://stackoverflow.com/q/25530993
tags question: http://stackoverflow.com/q/25406884
tags question: http://stackoverflow.com/q/25451787
tags question: http://stackoverflow.com/q/25546678
tags question: http://stackoverflow.com/q/25514588
tags question: http://stackoverflow.com/q/25502457
tags question: http://stackoverflow.com/q/25536284
tags question: http://stackoverflow.com/q/25484924
tags question: http://stackoverflow.com/q/25522245
tags question: http://stackoverflow.com/q/25478405
tags question: http://stackoverflow.com/q/25524345

http://stackoverflow.com/comment/39614486
score: 0
type: Comment
type: QuestionComment
has text: what is the code of `ContainerImpl.java` file? Are you injecting that class??
comment on: http://stackoverflow.com/q/25395847

http://stackoverflow.com/comment/39807705
score: 2
type: QuestionComment
has text: private static ArrayList integers1 = new ArrayList(); it is a old style of programming in Java.
type: Comment
comment on: http://stackoverflow.com/q/25502557

http://stackoverflow.com/q/25507024
score: 1
upvote count: 1
has title: How to log exceptions only to a specific logger in log4j2?
tagged with: log4j2
tagged with: logging
favorite count: 0
type: Question
has body: I have a log4j2 configuration to Sysout everything to console + log general content to a application.log file + log any exceptions to an error.log file. Problem: errors are logged in both application + error log file. org.apache.logging.log4j.Logger.error("Exception log", ex); What might be missing in the following configuration? <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/> <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/> <ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/> <AppenderRef ref="CMD" /> <AppenderRef ref="APPLICATION" /> <AppenderRef ref="ERR" />
accepted answer: http://stackoverflow.com/a/25507486
tagged with: java
has answer: http://stackoverflow.com/a/25507486
tagged with: log4j
type: AnsweredQuestion
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/39695126
comment on: http://stackoverflow.com/a/25441261
type: AnswerComment
has text: I did't get. what do you means?
score: 0
type: Comment

http://stackoverflow.com/q/25548390
has answer: http://stackoverflow.com/a/25548584
favorite count: 0
type: Question
has body: In my program i am using String as like follow: String s1=null; and String s1=new Sting(); For first String later in some where i will change s1="Demo Test". could anybody guide me that which way is best to use String?
has answer: http://stackoverflow.com/a/25548517
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25548432
tagged with: java
score: -3
answer count: 4
has answer: http://stackoverflow.com/a/25548579
has title: Is there any difference using of these Strings in java?
upvote count: 0
downvote count: 3
tagged with: string

http://stackoverflow.com/q/25535352
linked to: http://stackoverflow.com/q/5126082
has comment: http://stackoverflow.com/comment/39869515
has body: In Java, what is the difference between instance of a class and Object of a class. For a class A, Take a look : line 1 : A a; // Declaring a reference variable of class A Line 2 : a = new A();// Instantiating an object of class A ( An object/instance is created on Right hand side of the equation) So....can the line 2 also be : // Instantiating an instance of class A which mean Instance and Object are absolutely the same thing ? Please give an objective answer than subjective. .So an instance and object is same ? No difference at all. An object is an instance of the class .... or an Instance is an object of a class....both are same ?
type: Question
answer count: 2
has title: Instance vs Object : The unclear debate
duplicate of: http://stackoverflow.com/q/5126082
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/40480
upvote count: 1
tagged with: object
score: 0
linked to: http://stackoverflow.com/q/3323330
tagged with: instance
favorite count: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/3323330
has answer: http://stackoverflow.com/a/25535424
has answer: http://stackoverflow.com/a/25535974
downvote count: 1

http://stackoverflow.com/q/25398703
type: AnsweredQuestion
has title: Gradle analogue for maven assembly plugin
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39617235
has comment: http://stackoverflow.com/comment/39627108
has answer: http://stackoverflow.com/a/45605776
tagged with: java
has comment: http://stackoverflow.com/comment/39626808
tagged with: maven-assembly-plugin
tagged with: gradle
favorite count: 0
type: Question
upvote count: 9
score: 9
possible better answer: http://stackoverflow.com/a/45599072
has body: I use assembly maven plugin in my project, to deliver jars, procrun executables and some scripts from src/main/scripts/ folder in single zip-file. How can I do it with gradle? I've saw gradle delivery and application plugins but I couldn't configure them in right way.
has answer: http://stackoverflow.com/a/45599072
accepted answer: http://stackoverflow.com/a/45605776
tagged with: maven

http://stackoverflow.com/comment/39806909
comment on: http://stackoverflow.com/q/25501976
type: Comment
score: 0
type: QuestionComment
has text: First result from google [ java swing F10] search : http://www.javalobby.org/java/forums/t18687.html

http://stackoverflow.com/q/25479199
has comment: http://stackoverflow.com/comment/39764578
type: Question
tagged with: indexing
tagged with: java
has title: Java Vector - all objects get index -1
accepted answer: http://stackoverflow.com/a/25479339
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25479339
tagged with: vector
has comment: http://stackoverflow.com/comment/39764673
has body: i have a very strange problem with java Vector. I am working on a task - EShop with java, for this i have 3 Vectors with goods, customers and workers. All objects i add to customers and workers Vector get index -1, and i was actually unable to find anything like this in any guide. The actual problem about it - i cant delete any of that objects from my Vector. I can still get the full list of that objects, i can change them, save them or load from .txt or .ser. They can use shop funktions like buying, so they are actually IN the Vector. But because of -1 index i cant delete them. Literally the same code from the same project etc, just with other object type (goods) is working perfectly, so i have no idea even where i should look for a reason of this mistake. public class MitarbeiterVerwaltung { private Vector&lt;Mitarbeiter&gt; mitarbeiterListe = new Vector&lt;Mitarbeiter&gt;(); private PersistenceManager pm = new ObjectStreamPM(); public boolean einfuegeMitarbeiter(Mitarbeiter einMitarbeiter) throws PersonExistiertBereitsException{ if (mitarbeiterListe.contains(einMitarbeiter)) throw new PersonExistiertBereitsException(einMitarbeiter, "- in einfuegeMitarbeiter()"); else return mitarbeiterListe.add(einMitarbeiter); } public void loescheMitarbeiter(Mitarbeiter einMitarbeiter){ mitarbeiterListe.remove(einMitarbeiter); } The console output (object id, object nickname(first, second etc), index): public Vector&lt;Mitarbeiter&gt; getAlleMitarbeiter(){ for(Mitarbeiter m : mitarbeiterListe){ System.out.println(m.getKnummer()+ " "+m.getNickname()+" index:"+mitarbeiterListe.indexOf(m)); } return mitarbeiterListe; } 0 first index:-1 1 second index:-1 2 third index:-1 3 fourth index:-1 the class definition as asked below. public class Person implements Serializable { private static final long serialVersionUID = 3134247641351150211L; private String nickname; private int knummer; private String passwort; private String name; private PersonStatus status; public Person(String nickna…
answer count: 1
has comment: http://stackoverflow.com/comment/39764695

apache-poi
tags question: http://stackoverflow.com/q/25419147
tags question: http://stackoverflow.com/q/25522103
tags question: http://stackoverflow.com/q/25402781
tag name: apache-poi
tags question: http://stackoverflow.com/q/25399697
tags question: http://stackoverflow.com/q/25548227
tags question: http://stackoverflow.com/q/25397377
tags question: http://stackoverflow.com/q/25523180
tags question: http://stackoverflow.com/q/25533343
type: Tag
tags question: http://stackoverflow.com/q/25540677
tags question: http://stackoverflow.com/q/25437431
tags question: http://stackoverflow.com/q/25448165
tags question: http://stackoverflow.com/q/25444221
tags question: http://stackoverflow.com/q/25505199
tags question: http://stackoverflow.com/q/25536311
tags question: http://stackoverflow.com/q/25406377
tags question: http://stackoverflow.com/q/25420281
tags question: http://stackoverflow.com/q/25547616
tags question: http://stackoverflow.com/q/25484832

http://stackoverflow.com/q/25532972
type: Question
has body: //Reading a image file from @drawable res folder and writing to a file on external sd card //below one works no doubt but I want to imrpove it: OutputStream os = new FileOutputStream(file); //File file......... InputStream is =getResources().openRawResource(R.drawable.an_image); byte[] b = new byte[is.available()]; is.read(b); os.write(b); is.close(); os.close(); In above code I am using basic io classes to read and write. My question is what can I do in order to able to use wrapper classes like say DataInputStream/ BufferedReaderd or PrintStream / BufferedWriter /PrintWriter. As openRawResources(int id ) returns InputStream ; to read a file from res I either need to typecast like this: DataInputStream is = (DataInputStream) getResources().openRawResource(R.drawble.an_image)); or I can link the stream directly like this: DataInputStream is = new DataInputStream(getResources().openRawResource(R.drawable.greenball)); and then I may do this to write it to a file on sd card: PrintStream ps =new PrintStream (new FileOutputStream(file)); while(s=is.readLine()!=null){ ps.print(s); } So is that correct approach ? which one is better? Is there a better way?better practice..convention? Thanks!!!
type: UnansweredQuestion
tagged with: android
score: 0
tagged with: java
answer count: 1
has title: Which one is better approach so as to able to use wrapper class read() / write() method with android.content.res.Resources.openRawResource() method?
has answer: http://stackoverflow.com/a/25533546

http://stackoverflow.com/comment/39767278
type: QuestionComment
has text: I know that you guys are professional on these topics , please a little bit respect to the junior engineers like me , so please post your answer and help me :))
comment on: http://stackoverflow.com/q/25480357
score: 0
type: Comment

http://stackoverflow.com/a/25438117
has body: The Java class file(s) are almost always binary compatible with new versions of the language (and the few exceptions, like using enum before the keyword was added, are fairly rare). If you restrict your usage of features to the "lowest common denominator" it is possible to compile back to an arbitrary version. That being said, Java 7 is now quite long in the tooth and I've found Java 8 to be remarkably stable. Finally, if you do choose to use new language features (like lambdas) you cannot use the earlier version of the language.
has comment: http://stackoverflow.com/comment/39688236
type: Answer
has comment: http://stackoverflow.com/comment/39688147
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25438073

http://stackoverflow.com/q/25448528
has title: Coding bouncing ball on cos curve shaped ground
tagged with: trigonometry
has answer: http://stackoverflow.com/a/25448863
has body: I am making a game, where world is generated with cos function and it looks like this: At any any x point I can find the height of the surface with functions Game.getHeight(x); Now I want to make a ball that player can fire, which would bounce properly from surface. The way I did works for about ~5% of the bounces (ie others shoot to ground, bounce off at unrealistic angle etc). How could I improve it? Code I am using: The ball (bullet) class: package game; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.state.StateBasedGame; public class Bullet { private final static float speed = 400; private final static float acc = 250; public final static float radius = 8; private int changed; private float x, y, speedx, speedy; public Bullet (float x, float y, float tx, float ty) { this.x = x; this.y = y; changed = 0; float angle; angle = (float) ((float) Math.atan2(y - ty, tx - x) + .5 * Math.PI); speedx = (float) (Math.sin(angle) * speed); speedy = (float) (Math.cos(angle) * speed); } public void update(GameContainer gc, StateBasedGame game, int delta) { x += speedx * (float) delta / 1000; y += speedy * (float) delta / 1000; speedy += acc * (float) delta / 1000; } public void render (Graphics g) { g.drawOval(x-radius, y-radius, 2*radius, 2*radius); g.drawLine(x, y, (float) (32*Math.sin(getDirection()) + x), (float) (32*Math.cos(getDirection()) + y)); } public void setTrajectory (float angle) { float spd = speedx + speedy; speedx = (float) (Math.sin(angle) * spd); speedy = (float) (Math.cos(angle) * spd); changed += 1; } public float getDirection () { return (float) ((float) Math.atan2(-speedy, speedx) + .5 * Math.PI); } public boolean destroy() { return (changed &gt;= 2); //destroy it after it has bounced off once } public float getX() { return x; } public float getY() { return y; } } The snippet of game update method, where collision is checked: if (bullet != null) { bullet.update(gc, game, delta); for (float x = bullet.ge…
has comment: http://stackoverflow.com/comment/39706844
has answer: http://stackoverflow.com/a/25448886
accepted answer: http://stackoverflow.com/a/25448782
type: Question
has comment: http://stackoverflow.com/comment/39707881
has answer: http://stackoverflow.com/a/25448782
possible better answer: http://stackoverflow.com/a/25448886
has comment: http://stackoverflow.com/comment/39706878
has answer: http://stackoverflow.com/a/25448902
has comment: http://stackoverflow.com/comment/39707759
answer count: 4
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/a/25481031
has comment: http://stackoverflow.com/comment/39771960
has comment: http://stackoverflow.com/comment/39768436
type: Answer
answers question: http://stackoverflow.com/q/25480766
has body: It is stuck because you have to call the next() method after calling hasNext()so the pointer goes to next line of your input file. Also you are not using sum so check if you need this variable. Here is the code that works: public static void main(String[] args) throws FileNotFoundException { Scanner userInput = new Scanner(System.in); Scanner fileInput = null; String a = null; int sum = 0; do { try { System.out .println("Please enter the name of a file or type QUIT to finish"); a = userInput.nextLine(); if (a.equals("QUIT")) { System.exit(0); } fileInput = new Scanner(new File(a)); } catch (FileNotFoundException e) { System.out.println("Error " + a + " does not exist."); } } while (fileInput == null); PrintWriter output = null; try { output = new PrintWriter(new File("result.txt")); } catch (IOException g) { System.out.println("Error"); System.exit(0); } while (fileInput.hasNext()) { if (fileInput.hasNextInt()) { int num = fileInput.nextInt(); sum += num; String str = Integer.toString(num); output.println(str); } else { fileInput.next(); } } fileInput.close(); output.close(); } } Update: As per java doc for Scanner.hasNext() method: Returns true if this scanner has another token in its input. This method may block while waiting for input to scan. The scanner does not advance past any input. So to go to the next position, you need to call the next() method, otherwise the Scanner will be at same position and the program gets stuck in infinite loop.
accepted answer of: http://stackoverflow.com/q/25480766
has comment: http://stackoverflow.com/comment/39775700
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39772062
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/q/25536449
tagged with: audio
score: 0
tagged with: java
has title: Can't copy an audio file
has body: Okay so I'm get an error with this method that uses Files.toCopy it says that the file is already being used. Files.copy( tempClip.toPath(), wavFile.toPath(), StandardCopyOption.REPLACE_EXISTING ); This is the method that opens the file. It copies fine when I don't use this method it gives the error when I do use this method. current.track below references the wavFile above. I thought I closed everything using the file with audioStream.close() and audioClip.close(). if ( e.getSource() instanceof QuoteButton) { QuoteButton current = (QuoteButton)e.getSource(); try { audioStream = AudioSystem.getAudioInputStream(current.track); AudioFormat format = audioStream.getFormat(); DataLine.Info info = new DataLine.Info(Clip.class, format); audioClip = (Clip) AudioSystem.getLine(info); audioClip.open(audioStream); audioClip.start(); audioClip.addLineListener(new LineListener() { @Override public void update(LineEvent event) { if(event.getType() == LineEvent.Type.STOP){ audioClip.close(); } } }); audioStream.close(); } catch (UnsupportedAudioFileException | IOException | LineUnavailableException e1) { e1.printStackTrace(); } }
type: Question
answer count: 2
type: UnansweredQuestion
tagged with: file
has answer: http://stackoverflow.com/a/25536511
has answer: http://stackoverflow.com/a/25563200
tagged with: copy

http://stackoverflow.com/a/25478834
answers question: http://stackoverflow.com/q/25477999
score: 0
has body: You can use JSpinner to achieve this. I hope the below piece of would help. JFrame frame = new JFrame("Date Picker"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSpinner timeSpinner = new JSpinner( new SpinnerDateModel()); JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "HH:mm:ss"); timeSpinner.setEditor(timeEditor); timeSpinner.setValue(new Date()); frame.add(timeSpinner); frame.setVisible(true); frame.pack();
has comment: http://stackoverflow.com/comment/39763972
type: Answer

http://stackoverflow.com/q/25405827
score: 2
has title: Putting complex object graph in gemfire region
has body: I am a bit new to GemFire. I have a query . Here it is: I have the following object graphs (1 &amp;2) as given below: ObjA has ObjB has ObjC ObjX has ObjY has ObjC The same instance of ObjC is associated with ObjB and ObjY Now I put ObjA and ObjX in gemfire region, R. My question is, will there be two instances of the same ObjC in the region R or just one? If there will be two instances, then is there any way to have a single instance in region R ?
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25412028
tagged with: spring-data-gemfire
tagged with: distributed-caching
tagged with: serialization
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25412028
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/95766365
type: Comment
score: 0
has text: yes, full if-elseif-else blocks are supported: http://www.x5software.com/chunk/examples/ChunkExample?example=ifelse&loc=en_US
type: AnswerComment
comment on: http://stackoverflow.com/a/29764784

http://stackoverflow.com/comment/39780395
type: QuestionComment
comment on: http://stackoverflow.com/q/25487328
type: Comment
has text: There is no need to switch from VBOs to display lists at all. VBOs are fine for static data (and have the additional benefit that they also allow dynamic data). Display lists are deprecated anyway. And having a single display list per face is insane by any standards. You will have a separate draw call per cube face, which will totally ruin the performance (even if the 3 million dlists would not totally overburden your system). Ypu will need much advanced rendering techniques if you want reasonable performance with that amount of data.
score: 2

http://stackoverflow.com/comment/39692368
type: AnswerComment
score: 0
type: Comment
has text: Don't worry, I don't use `JEditorPane` that often either...and unless you've done it before, it's less the obvious trick ;)
comment on: http://stackoverflow.com/a/25440668

oracle-database
tags question: http://stackoverflow.com/q/25393783
tags question: http://stackoverflow.com/q/25529162
tags question: http://stackoverflow.com/q/25464706
tags question: http://stackoverflow.com/q/25416475
tags question: http://stackoverflow.com/q/25500468
tags question: http://stackoverflow.com/q/25532690
tags question: http://stackoverflow.com/q/25421865
tags question: http://stackoverflow.com/q/25526981
tag name: oracle-database
tags question: http://stackoverflow.com/q/25453594
tags question: http://stackoverflow.com/q/25550692
tags question: http://stackoverflow.com/q/25422967
tags question: http://stackoverflow.com/q/25435849
tags question: http://stackoverflow.com/q/25450452
tags question: http://stackoverflow.com/q/25524628
tags question: http://stackoverflow.com/q/25445577
tags question: http://stackoverflow.com/q/25543015
tags question: http://stackoverflow.com/q/25418293
tags question: http://stackoverflow.com/q/25521690
tags question: http://stackoverflow.com/q/25485449
tags question: http://stackoverflow.com/q/25515119
tags question: http://stackoverflow.com/q/25450187
type: Tag
tags question: http://stackoverflow.com/q/25414358
tags question: http://stackoverflow.com/q/25452761
tags question: http://stackoverflow.com/q/25549078
tags question: http://stackoverflow.com/q/25447702

http://stackoverflow.com/comment/39738332
score: 0
has text: Please accept the answer if it solved your problem. As for a question-answer webpage, it is better to ask only one question per page, so the people that have the same problem find the solution they are looking for. If you have further questions create a new discussion and I'll be glad to try to solve them.
type: Comment
comment on: http://stackoverflow.com/a/25464867
type: AnswerComment

http://stackoverflow.com/a/25418876
type: Answer
has comment: http://stackoverflow.com/comment/39726320
score: 0
answers question: http://stackoverflow.com/q/25418672
has body: If you use a real device you need to use the real IP of the server. Keep also in mind to open the required ports for your local network and connect your mobile with your local network via WiFi. I'm not very familar with the secutity of servlets check also that you can connect to the server with a second computer too. (Depending on your configuration it is possible that you cannot access the server from outside of "localhost")

http://stackoverflow.com/comment/39634000
comment on: http://stackoverflow.com/q/25408120
has text: @DrewBuckley Thanks for the clarification. I misunderstood and thought you were referring to my code for some reason. Probably because it's 4 am here!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25532186
possible better answer: http://stackoverflow.com/a/25532264
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25532264
linked to: http://stackoverflow.com/q/4281143
tagged with: java
has answer: http://stackoverflow.com/a/30238102
has comment: http://stackoverflow.com/comment/39862549
type: Question
has body: I am using the CSVWriter from here String csv_path = "C:\\output.csv"; CSVWriter csv_writer = new CSVWriter(new FileWriter(csv_path)); csv_writer.writeAll(data); csv_writer.close(); But I encounter the common exception of Access is denied java.io.FileNotFoundException: C:\output.csv (Access is denied) I found an accepted answer here, but it seems cant solve my problem since I am using FileWriter. You cannot open and read a directory, use the isFile() and isDirectory() methods to distinguish between files and folders. You can get the contents of folders using the list() and listFiles() methods (for filenames and Files respectively) you can also specify a filter that selects a subset of files listed. I am using window 8. Is it something to do with the permission issue?
has answer: http://stackoverflow.com/a/25532761
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/25532259
accepted answer: http://stackoverflow.com/a/25532259
tagged with: eclipse
has title: (CSVWriter) java.io.FileNotFoundException: C:\output.csv (Access is denied)
answer count: 4

http://stackoverflow.com/comment/39709607
comment on: http://stackoverflow.com/a/25444928
type: AnswerComment
has text: I havent tested it on a database, will try later when I can.
score: 0
type: Comment

http://stackoverflow.com/q/25466921
score: 0
tagged with: android-fragments
tagged with: java
answer count: 1
type: Question
tagged with: android-layout
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
has title: From ListView to TextView (Parse)
has body: With support, I have managed to retrieve list and images from parse, however, I want to be able to retrieve string that can be displayed in a textview as oppose to listview because there is no reason using a list when I am just retrieving one item. Furthermore, I have issues with the listview being scrollable on touch, so I guess it would be better if it was just a textview. Below is the code that retrieves listview, I want to be able to display that information in a textview instead. In this case, I am trying to retrieve information from the ActivityName column of parse for the user that satisfies various conditions set. ParseQuery&lt;ParseUser&gt; query = ParseUser.getQuery(); // query.whereEqualTo("ActivityName",userActivitySelectionName); query.whereNotEqualTo("objectId", ParseUser.getCurrentUser() .getObjectId()); // users with Gender = currentUser.Looking_Gender query.whereEqualTo("Gender", userLookingGender); // users with Looking_Gender = currentUser.Gender query.whereEqualTo("Looking_Gender", userGender); query.setLimit(1); query.whereEqualTo("ActivityName", activityName); // query.whereGreaterThanOrEqualTo("Age", minimumAge); // query.whereLessThanOrEqualTo("Age", maximumAge); query.orderByDescending("Name"); Log.d(Constants.LOG, ""); query.findInBackground(new FindCallback&lt;ParseUser&gt;() { public void done(List&lt;ParseUser&gt; userlistactivityname, ParseException e) { if (e == null) { for (int i = 0; i &lt; userlistactivityname.size(); i++) { names.add(userlistactivityname.get(i).get("ActivityName").toString()); } usersListActivityname = (ListView) getActivity().findViewById( R.id.userlistactivityname); namesArrayAdapter = new ArrayAdapter&lt;String&gt;(getActivity() .getApplicationContext(), R.layout.user_list_item, names); usersListActivityname.setScrollContainer(false); usersListActivityname.setClickable(false); usersListActivityname.setAdapter(namesArrayAdapter); } else { } } }); Below is the XML &lt;ListView android:id="@+id/userlistactivityname…
has answer: http://stackoverflow.com/a/25468004

http://stackoverflow.com/q/25502557
type: Question
has comment: http://stackoverflow.com/comment/39807851
has title: StackOverflow exception while adding one array list to another
has comment: http://stackoverflow.com/comment/39807692
accepted answer: http://stackoverflow.com/a/25502658
has comment: http://stackoverflow.com/comment/39807705
upvote count: 4
tagged with: stack-overflow
score: 4
has answer: http://stackoverflow.com/a/25502663
possible better answer: http://stackoverflow.com/a/25502663
type: AnsweredQuestion
answer count: 3
downvote count: 0
has body: I and getting java.lang.StackOverflowError while executing below code, public class Insertion { private static ArrayList integers1 = new ArrayList(); private static ArrayList integers2 = new ArrayList(); public static void main(String[] args) { Collections.addAll(integers1, 1, 2, 3); Collections.addAll(integers2, 5, 6, 7); integers1.add(integers2); System.out.println(integers1); integers2.add(integers1); System.out.println(integers2); } } Please explain why?
has answer: http://stackoverflow.com/a/25502658
tagged with: java
has comment: http://stackoverflow.com/comment/39809142
has answer: http://stackoverflow.com/a/25502905
favorite count: 0

http://stackoverflow.com/q/25530004
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/39942065
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/39865484
tagged with: java
answer count: 1
has title: How to get all visible rows of JTable model within a JScrollPane
type: Question
has answer: http://stackoverflow.com/a/25574603
linked to: http://stackoverflow.com/q/11887642
has comment: http://stackoverflow.com/comment/39865309
has comment: http://stackoverflow.com/comment/39871996
type: UnansweredQuestion
tagged with: jviewport
tagged with: swing
has body: So far I know how to get a particular row at a point using the JScrollPane's JViewPort object. scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent e) { JViewport viewport = scrollPane.getViewport(); Point p = viewport.getViewPosition(); int rowIndex = getLogsTable().rowAtPoint(p); System.out.println("Minimum Y: " + viewport.getViewRect().getMinY()); System.out.println("Min row: " + getLogsTable().rowAtPoint(new Point(0, (int) viewport.getViewRect().getMinY()))); System.out.println("Maximum Y: " + viewport.getViewRect().getMaxY()); System.out.println("Max row: " + getLogsTable().rowAtPoint(new Point(0, (int) viewport.getViewRect().getMaxY()))); } }); I am having a tough time figuring out how to get all the rows between the JViewport.getMinimumY() and JViewport.getMaximumY(). Is there a way to gather all row items between those two viewport points or is there any way to just get all rows in the JScrollPane view?
has comment: http://stackoverflow.com/comment/39858755
has comment: http://stackoverflow.com/comment/39871333

http://stackoverflow.com/a/25408728
type: Answer
has comment: http://stackoverflow.com/comment/39634862
has comment: http://stackoverflow.com/comment/39633354
answers question: http://stackoverflow.com/q/25408575
downvote count: 0
has comment: http://stackoverflow.com/comment/39633730
upvote count: 1
has body: When I run your code as follows, public static void main(String[] args) { String str = "{\"view\":\"global\"}"; org.json.JSONObject json = new org.json.JSONObject(str); String view = json.getString("view"); System.out.println(view); } I get global
has comment: http://stackoverflow.com/comment/39634225
score: 1

http://stackoverflow.com/q/25547667
type: Question
tagged with: report
has answer: http://stackoverflow.com/a/25625507
has body: Ive searched through similar answers but not quite getting a complete answer so need to explain here. What i have is a JFrame form that an Employee in a manufacturing plant needs to fill in everytime something goes wrong with the production process. What i want is for a user to click a "Print Report" JButton on the JFrame form and it will populate the following PDF Report with the info from the JFrame. JFrame form PDF Report
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25549869
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/25547762
has answer: http://stackoverflow.com/a/25549869
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/25547762
has title: Populating a PDF with Java Form

http://stackoverflow.com/comment/39821909
comment on: http://stackoverflow.com/a/25504013
has text: @JeanHominal: I don't think the example is a good one; a better issue might be the constructor that takes a `char[]` and stores the reference directly.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39723938
type: Comment
type: AnswerComment
has text: Perhaps the exception relates to your .jrxml file and not the huge XML file that is the input to the report? Maybe the report definition refers to an element within the report definition that is missing (or not spelled the same).
comment on: http://stackoverflow.com/a/25454879
score: 1

http://stackoverflow.com/a/25512581
upvote count: 6
answers question: http://stackoverflow.com/q/25512426
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25512426
has body: Quoting the documentation that you linked to: One of the major events a device admin application has to handle is the user enabling the application. The user must explicitly enable the application for the policies to be enforced. If the user chooses not to enable the application it will still be present on the device, but its policies will not be enforced, and the user will not get any of the application's benefits. As Mr. Harvey indicates, the error message means that the user has not enabled your app as a device administrator as yet. Further quoting the documentation: The process of enabling the application begins when the user performs an action that triggers the ACTION_ADD_DEVICE_ADMIN intent. Here is a sample project that demonstrates setting up a device administrator. The key is in the LockMeNowActivity: /*** Copyright (c) 2012 CommonsWare, LLC 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. From _The Busy Coder's Guide to Android Development_ http://commonsware.com/Android */ package com.commonsware.android.lockme; import android.app.Activity; import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.content.Intent; import android.os.Bundle; import android.view.View; public class LockMeNowActivity extends Activity { private DevicePolicyManager mgr=null; private ComponentName cn=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); cn=new ComponentName(this, AdminReceiver.class); …
score: 6
type: Answer

http://stackoverflow.com/a/25540171
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25540087
upvote count: 1
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39877630
answers question: http://stackoverflow.com/q/25540087
has comment: http://stackoverflow.com/comment/39877649
type: Answer
has body: The JIT, as far as I can tell, will only detect this if it's a fairly simple inlineable method. That being said it's very easy for a programmer to detect these cases and is a hard problem for a JIT compiler to detect. Preferably you should use final int to cache results from large methods, as the JIT can very easily detect that value can't change and can even remove array access checks to speed up loops. Something like int[] arr = new int[ 10 ]; for( int i = 0; i &lt; arr.length; i++ ) { //... } or List&lt; String &gt; list = Arrays.asList( new String[] { ... } ); for( int i = 0; i &lt; list.size(); i++ ) { //... } can probably be very easily optimized by the JIT. Other loops that call large or complicated methods can't easily be proven to always return the same value, but methods like size() probably could be inlined or even removed completely. Finally with for-each loops on arrays. They are decayed to the first loop I posted in the case of arrays, and can also easily be optimized to produce the quickest loop. Although for-each loops on non-arrays, I prefer to avoid when it comes to quick loops, as they decay into Iterator loops and not the second loop I posted. That is not true for LinkedList because an Iterator is faster than using get() due to O( n ) traversal. This is all speculation on what the JIT could do to optimize a loop. It's important to know that the JIT will only optimize something it can prove will not change the resulting effects. Keeping things simple will make the JIT's job much easier. Like using the final keyword. Using final on values or on methods allows the JIT to easily prove that won't change and can inline like crazy. That's the JIT's most important optimization, inlining. Make that job easy and the JIT will help you out in a big way. Here is a link discussing loop optimizations where the JIT can't always optimize a loop if it can't prove it's optimization won't change anything.
has comment: http://stackoverflow.com/comment/39877539
has comment: http://stackoverflow.com/comment/39877563
has comment: http://stackoverflow.com/comment/39877512

http://stackoverflow.com/q/25509402
tagged with: c++
answer count: 0
has comment: http://stackoverflow.com/comment/39821247
type: UnansweredQuestion
tagged with: web-services
has title: How to call REST java webservice from non Java scripts
score: 0
tagged with: rest
has body: I have a simple webservice Java/REST/Jersey that responds to sql requests. Employee{first,last,SS,address,phone..} ../REST/getEmployee ---&gt; returns Employee as JSON/JSONArray MyQuestion: How do I save an Employee if called from Non-Java languages like C, C++? Employee e {mike,smith,main st, 111-222-9999,..} ../REST/saveEmployee
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/39821672
has comment: http://stackoverflow.com/comment/39821061
type: Question

http://stackoverflow.com/q/25414922
type: Question
tagged with: rest
type: UnansweredQuestion
tagged with: java
tagged with: javascript
has body: I created a Jersey REST service with a Grizzly server. I do make ajax calls in my jquery and it works on localhost:9998 public static final URI BASE_URI = UriBuilder.fromUri("http://localhost/").port(9998).build(); public static void main(String[] args) throws IOException { SelectorThread threadSelector = startServer(); System.out.println(String.format("Jersey app started with WADL available at " + "%sapplication.wadl\nHit enter to stop it...", BASE_URI)); System.in.read(); threadSelector.stopEndpoint(); } 2 Questions: 1) How would I set the index.html (jquery) as the welcomepage so that when I go to localhost:9998/example/, the index.html would be displayed? (I'm using grizzly so no web.xml) 2) How would I make this visible outside of localhost?? Thanks!!!!! Any Help would be appreciated!
score: 0
has comment: http://stackoverflow.com/comment/39645800
answer count: 0
has title: Setting Jquery as the welcome pages for a Jersey REST service using Grizzly Server
has comment: http://stackoverflow.com/comment/39645553
tagged with: jquery

http://stackoverflow.com/comment/39841079
has text: If java makes a mistake, doesn't mean c# have to. It makes no sense to access static member via instance. If anything it will confuse the future readers. static members belongs to class rather than instance. May be that's the reason c# language designers prevent it. Yet another reason why c# is better than java!.
comment on: http://stackoverflow.com/q/25520385
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/25532690
tagged with: oracle-database
has title: Get the count of an object
tagged with: java
type: Question
answer count: 2
has body: I have a view object, the result of the following query: SELECT TEACHER_ID_FK, MATERIAL_ID_FK, CREATION_DATE, VALID_BEFORE FROM TEACHER_MATERIAL; In my application module I have this line of code to get hold of the view object. TeachMaterVVOImpl voTeachMater = (TeachMaterVVOImpl)this.getTeachMaterVVO1(); Now I got a materialId(of type MATERIAL_ID_FK) in my hand. How to get the number of count of this materialId from this view object?
possible better answer: http://stackoverflow.com/a/25552079
tagged with: oracle-adf
has answer: http://stackoverflow.com/a/25552079
tagged with: jdeveloper
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/27017613
accepted answer: http://stackoverflow.com/a/27017613

http://stackoverflow.com/comment/39844356
type: QuestionComment
type: Comment
score: 2
has text: Happened to me too with spring boot 1.1.4 deployed on Tomcat 7 in AWS Beanstack. I could see the thread dump explodes, and the CPU was fully utilised without any incoming requests. I just upgraded to 1.1.5, hoping for the best.
comment on: http://stackoverflow.com/q/25515967

http://stackoverflow.com/comment/39652021
score: 0
has text: @alfredaday Relatively minor thing, but ArrayList _tends_ to be a better default choice than LinkedList. It can be more memory efficient and it has better memory locality, which means it tends to work better with CPU caches. It also has random access, of course. Those benefits often outweigh the costs of having to copy the array when you exceed capacity. (As with pretty much everything in CS, these are general guidelines, _not_ hard and fast rules.)
comment on: http://stackoverflow.com/q/25418505
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39853218
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25517616
has text: It's not simple. Those suggestions aren't in order of how well I think they might work for you. I think 1 is probably the worst actually, but it does most directly address making the transparent parts blocked off so I wrote it first.
type: Comment

http://stackoverflow.com/q/25500660
tagged with: intellij-idea
has body: I've got several sub-projects in my gradle project: Project Common Consumer1 Consumer2 ..... ConsumerN My first - and main goal – is to include classes from Common project into resulting jar of every ConsumerN projects. So I can develop and test shared part (DB logic, some utils) independently in Common project and next other projects will get this classes (already tested) and include them into their jars. Second goal is to make IntelliJ Idea to understand such dependency and work with it correctly. Would you please suggest the "most conceptual and right way" to do this in gradle.
has answer: http://stackoverflow.com/a/25502297
score: 0
tagged with: java
answer count: 1
has title: Gradle sub-project classes dependency
tagged with: gradle
type: Question
type: UnansweredQuestion

http://stackoverflow.com/q/25518210
has comment: http://stackoverflow.com/comment/39837626
has body: I have the following code that works correctly: Map&lt;String, List&lt;String&gt;&gt; map = Arrays.stream(input) .collect(groupingBy(s -&gt; s.split("\\s+")[0], TreeMap::new, toList())); But I need the TreeMap to sort in descending order. I've tried: Map&lt;String, List&lt;String&gt;&gt; map = Arrays.stream(input) .collect(groupingBy(s -&gt; s.split("\\s+")[0], new TreeMap&lt;&gt;((a, b) -&gt; b.compareTo(a)), toList())); But I get the error "Cannot find symbol compare to object". How do I get the TreeMap to accept a Comparator? Is it possible at all?
possible better answer: http://stackoverflow.com/a/25518410
has answer: http://stackoverflow.com/a/25518410
has title: How to specify a Comparator for a MapFactory
type: AnsweredQuestion
tagged with: java
answer count: 3
downvote count: 0
upvote count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25518422
has answer: http://stackoverflow.com/a/25518476
accepted answer: http://stackoverflow.com/a/25518476
type: Question

http://stackoverflow.com/comment/39607024
comment on: http://stackoverflow.com/q/25394264
score: 0
type: Comment
type: QuestionComment
has text: @MazerytFreager OP uses JSF for view, not Spring MVC.

http://stackoverflow.com/a/25395590
type: Answer
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39652277
answers question: http://stackoverflow.com/q/25395471
has body: You might use either of two ways to suppress the display of zero values. The first is handy if you have many tables and/or many columns of a certain data type where you want this behavior. The second is for use on specific individual columns. Override formatPropertyValue You can override the formatPropertyValue method in your own subclass of Table. This method is called during the display of each table cell. By testing for the case of an Integer object you can override the string being generated for presentation to the user. This approach should work in Vaadin versions 3.1 through 7.x. This approach affects all the columns in the Table of that target data type. // A subclass of Vaadin Table to override formatting of Integer zero values. public class NonZeroTable extends Table { @Override protected String formatPropertyValue ( Object rowId , Object colId , Property property ) { // Suppress display of zero-value Integers. // If the Property is of type Integer with a Value of zero, handle it here. // For other Property or Value, fallback to the default handling in the Table. if ( property.getType() == Integer.class ) { if ( property.getValue().equals( 0 ) ) { return ""; // Return empty string, to suppress display of zero. // return "\u2013"; // EN DASH // return "\u2014"; // EM DASH } } return super.formatPropertyValue( rowId , colId , property ); } } Thanks to the Book of Vaadin collection of Vaadin 7 example code for providing this information. Specify Converter For Each Column Alternatively, you may want to control the formatting for specific columns. If so, provide a Converter for the column, as described on the Vaadin Wiki page Formatting Data In Table. Converters are discussed here in the Book of Vaadin.
score: 3
has comment: http://stackoverflow.com/comment/39653980

http://stackoverflow.com/q/25423321
score: 1
tagged with: java
tagged with: spring-saml
downvote count: 0
linked to: http://stackoverflow.com/q/23150126
upvote count: 1
accepted answer: http://stackoverflow.com/a/25427385
tagged with: spring-security
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25427385
has title: Spring Security SAML extension on Spring framework 4.0 and Spring security 3.2.4
has body: I would like to use annotation configurations for my spring based application. And also SAML2.0 digestion and generation is required for SSO purpose. Annotation configuration only supported by Spring 4.0 and Spring security 3.2.4 Is the integration of Spring security SAML 1.0 possible? Updated: The sample project provided by Vladimír Schäfer is really helps. But after the sso login, the page had been redirected to the authentication failure URL on the service provider app. The SAML response as below: &lt;samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Destination="http://myIP:8080/websso/saml/SSO" ID="s237fe42260c297d9dfd7845b3691ef76e0bc27c76" InResponseTo="a14hc23eda9j396g2h5aff4076216g5" IssueInstant="2014-08-28T07:36:07Z" Version="2.0" &gt; &lt;saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"&gt;http://idp.ssocircle.com&lt;/saml:Issuer&gt; &lt;samlp:Status xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"&gt; &lt;samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" /&gt; &lt;/samlp:Status&gt; &lt;saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="s2e84d407027285a27d32a70c93ebdc70298956c8d" IssueInstant="2014-08-28T07:36:07Z" Version="2.0" &gt; &lt;saml:Issuer&gt;http://idp.ssocircle.com&lt;/saml:Issuer&gt; &lt;saml:Subject&gt; &lt;saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" NameQualifier="http://idp.ssocircle.com" &gt;nameID&lt;/saml:NameID&gt; &lt;saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"&gt; &lt;saml:SubjectConfirmationData InResponseTo="a14hc23eda9j396g2h5aff4076216g5" NotOnOrAfter="2014-08-28T07:46:07Z" Recipient="http://myIP:8080/websso/saml/SSO" /&gt; &lt;/saml:SubjectConfirmation&gt; &lt;/saml:Subject&gt; &lt;saml:Conditions NotBefore="2014-08-28T07:26:07Z" NotOnOrAfter="2014-08-28T07:46:07Z" &gt; &lt;saml:AudienceRestriction&gt; &lt;saml:Audience&gt;entityID&lt;/saml:Audience&g…
has comment: http://stackoverflow.com/comment/39661045
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/37381840
answer count: 2
has answer: http://stackoverflow.com/a/37381840

http://stackoverflow.com/comment/39865791
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25534041
has text: That's basically URL-encoding... try URL-decoding it first and you'll get the values you want.

http://stackoverflow.com/q/25436538
tagged with: scala
answer count: 1
tagged with: md5
has body: I would like to hash IDs into buckets such that There is no bias towards a particular bucket The same ID should always be assigned to the same bucket IDs should be distributed across all buckets independently Buckets should be (almost) equal in size My strategy is to get an MD5 hash of the ID, convert it into a number and then mod it into a bucket. val hash: Array[Byte] = MessageDigest.getInstance("MD5").digest("Hello") val number: java.math.BigInteger = new BigInteger(hash) val bucket = number.mod(new BigInteger("1000")) Does this approach maintain the nice properties that MD5 provides? Would this achieve the goals above?
has comment: http://stackoverflow.com/comment/39686944
has comment: http://stackoverflow.com/comment/39685526
has comment: http://stackoverflow.com/comment/39686956
has comment: http://stackoverflow.com/comment/39685414
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25436774
tagged with: hash
has comment: http://stackoverflow.com/comment/39685761
has comment: http://stackoverflow.com/comment/39686032
tagged with: java
has comment: http://stackoverflow.com/comment/39685673
has comment: http://stackoverflow.com/comment/39685626
has title: How do I safely convert an MD5 hash into buckets in Java/Scala?
type: Question
accepted answer: http://stackoverflow.com/a/25436774
upvote count: 5
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/39685714

http://stackoverflow.com/q/25523584
tagged with: java
has comment: http://stackoverflow.com/comment/39846894
has comment: http://stackoverflow.com/comment/39846734
has title: How to separate a string with a char?
has answer: http://stackoverflow.com/a/25523936
tagged with: string
has comment: http://stackoverflow.com/comment/39846724
possible better answer: http://stackoverflow.com/a/25523808
favorite count: 0
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/39846830
linked to: http://stackoverflow.com/q/3481828
upvote count: 1
has body: Say I have two string; "fruit;mango;apple;banana" and "animal;dog;cat;cow". What i want is a function to check the first word before 1st semi colon and then if its "fruit" get the other 3 elements(without semi colon) and store it in an array called fruit and if animal take the elements and store is animal array. I thought of using loop and chatAt() but that code will be kinda messy. So I want to know is there any function to separate a string with char?
downvote count: 1
duplicate of: http://stackoverflow.com/q/3481828
accepted answer: http://stackoverflow.com/a/25523784
has answer: http://stackoverflow.com/a/25523808
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25523784
answer count: 3

http://stackoverflow.com/q/25471371
favorite count: 0
has comment: http://stackoverflow.com/comment/39750023
type: Question
has comment: http://stackoverflow.com/comment/39750204
answer count: 2
has answer: http://stackoverflow.com/a/25471510
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25471550
has comment: http://stackoverflow.com/comment/39750496
tagged with: multithreading
upvote count: 1
downvote count: 1
has title: Exiting a thread in java
score: 0
has comment: http://stackoverflow.com/comment/39750125
has body: Thread som; static class solver implements Runnable { public void distancecalculator(char [][]problem , Point start , int distancefound) { // Some code and condition to exit from program if satisfy solver s = new solver(newproblem , neworigin,dist[a][b] ); som = new Thread(s); som.start(); } public void run(){ //som.sleep(1000); //System.out.println("check"); distancecalculator(prom,movepoint ,disadd ); //Making a recursive call } I am generating threads on every recursive call, I want that in control way i.e. if 500 threads are generated then terminate the first 100 threads. How can i achieve this? If i use som.sleep which thread will sleep the newly generated one or old one?
tagged with: java
has comment: http://stackoverflow.com/comment/39750034

http://stackoverflow.com/q/25516322
favorite count: 0
accepted answer: http://stackoverflow.com/a/25516341
type: Question
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25516341
has comment: http://stackoverflow.com/comment/39834338
tagged with: java
has title: Unknown cause of exception
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39834279
has body: Every time I run this, I get an error that reads: "Exception in thread 'main' java.lang.ArithmeticException: / by zero". I'm not sure why this isn't working. public static void Solve(long num){ for(int x = 1; x &lt; num; x++){ if((num % x) == 0){ //error occurs here System.out.println(x); } } }
has comment: http://stackoverflow.com/comment/39834749
answer count: 2
possible better answer: http://stackoverflow.com/a/25516342
upvote count: 3
has comment: http://stackoverflow.com/comment/39835037
has answer: http://stackoverflow.com/a/25516342
downvote count: 0

http://stackoverflow.com/comment/39599068
type: QuestionComment
comment on: http://stackoverflow.com/q/25390281
has text: please post some compilable code. you can't just break out of any label.
score: 1
type: Comment

http://stackoverflow.com/a/25401816
has comment: http://stackoverflow.com/comment/39633485
has body: Two's complement binary is the standard for representing numbers with negative numbers included. For three-bit numbers: Base 2 (One's Two's complement) complement 000 = 0 001 = 1 010 = 2 011 = 3 100 = 4 -3 -4 101 = 5 -2 -3 110 = 6 -1 -2 111 = 7 -0 -1 Java assumes two's complement: the most significant bit being 1 means negative.. Also in java byte, short, int, long are signed. As an aside, you used the Object wrappers for the primitive types. Primitive types are more immediate. byte b05 = (byte) 0x7A; byte b06 = (byte) 0x00; // MSB, positive as &lt; 0x80 nyte[] byteTabDay = new byte[2]; byteTabDay[0] = b05; byteTabDay[1] = b06; int valueDay = ((int) byteTabDay[1]) &lt;&lt; 8) | (0xFF &amp; byteTabDay[0]); System.out.println("day :" + valueDay); // print 122 What one has to do: keep the sign extension of the most significant byte, but for other bytes keep them to 8 bits by masking them with 0xFF.
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39633773
answers question: http://stackoverflow.com/q/25401307
type: Answer
accepted answer of: http://stackoverflow.com/q/25401307

http://stackoverflow.com/q/25508878
upvote count: 4
type: AnsweredQuestion
score: 2
has title: RegEx commands in java
answer count: 3
has comment: http://stackoverflow.com/comment/39820070
tagged with: java
accepted answer: http://stackoverflow.com/a/25509264
downvote count: 2
has comment: http://stackoverflow.com/comment/39820105
has comment: http://stackoverflow.com/comment/39820214
favorite count: 0
has comment: http://stackoverflow.com/comment/39820119
type: Question
has comment: http://stackoverflow.com/comment/39820062
has comment: http://stackoverflow.com/comment/39819892
has comment: http://stackoverflow.com/comment/39819911
has body: I understand the basics of regex but I am not able to create a regular expression satisfying all these conditions. Can anybody give me an idea how to do it. The string must be at least 20 character long The string must contain a digit The digit must be preceded by some non-numeric character The end of the string must be a date of format DD/MM/YYYY HH:MM - yes, there is a space in between and all the digits must be present. Digits occurring in the date part of the string are not considered as satisfiability condition of rule 2. If there is a $ sign before the first numeric digit occurs, the string is invalid I have tried using code: if (sCurrentLine.length() &gt; 20) { for (int i=0; i &lt;= sCurrentLine.length() - 1; i++) { char character = sCurrentLine.charAt(i); int ascii = (int) character; if (((ascii &gt;= 48) &amp;&amp; (ascii &lt;= 57)) &amp;&amp; (i!=0)) { char character2 = sCurrentLine.charAt(i-1); int ascii2 = (int) character2; if(!((ascii2 &gt;= 48) &amp;&amp; (ascii2 &lt;= 57))) { // } } } } but it seems too complicated. Is there a regex approach that could solve this?
has answer: http://stackoverflow.com/a/25509456
has comment: http://stackoverflow.com/comment/39819926
possible better answer: http://stackoverflow.com/a/25509355
has answer: http://stackoverflow.com/a/25509355
has comment: http://stackoverflow.com/comment/39819901
tagged with: regex
has answer: http://stackoverflow.com/a/25509264

http://stackoverflow.com/a/25411711
answers question: http://stackoverflow.com/q/25411623
accepted answer of: http://stackoverflow.com/q/25411623
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Here's an example of how to initialize the array in a static initializer block. Of course, it's not very interesting, since all the integers in the array are identical. class Abc { static int[][] arr; static { arr = new int[100][300]; for (int i=0;i&lt;arr.length;i++) { for (int j=0;j&lt;arr[i].length;j++) { arr[i][j] = 7; } } } }

http://stackoverflow.com/comment/39750901
comment on: http://stackoverflow.com/q/25471810
score: 0
type: Comment
has text: @BoristheSpider loop was not in the question, I added it to represent the time taking task. I will edit the quesiton
type: QuestionComment

http://stackoverflow.com/a/25435492
type: Answer
answers question: http://stackoverflow.com/q/25435266
score: 0
has body: What you probably want is something like this: import javax.swing.JOptionPane; public class Comienzo { public static void main(String[] args) { String inputValue = JOptionPane.showInputDialog("Please input a value"); if (inputValue == null) { System.out.println("CANCEL"); } else if (inputValue.equals("")) { Comienzo.main(args); } else { JOptionPane.showMessageDialog(null, "¡Bienvenido... " + inputValue + "!"); } } } What you did by JOptionPane.OK_CANCEL_OPTION == JOptionPane.CANCEL_OPTION was comparing two constants with each other that happen to have the same value. As the constants cannot change according to your input, your code cannot react on the input.
has comment: http://stackoverflow.com/comment/39683599

web-inf
type: Tag
tag name: web-inf
tags question: http://stackoverflow.com/q/25484261

http://stackoverflow.com/comment/39691443
has text: Interesting use of method references for `Class::isInstance` and `Class::cast`.
score: 8
type: AnswerComment
comment on: http://stackoverflow.com/a/25439912
type: Comment

http://stackoverflow.com/comment/39884930
comment on: http://stackoverflow.com/q/25543015
score: 0
type: Comment
has text: Do you want different `MenuBar` for different `Scene` ?
type: QuestionComment

http://stackoverflow.com/comment/39679851
type: QuestionComment
has text: Such code is always bad to read or to maintain, but however if by my answer, I allow someone to do better, then it's not so bad. I do hope he'll do better :)
score: 0
comment on: http://stackoverflow.com/q/25430631
type: Comment

http://stackoverflow.com/comment/39657895
comment on: http://stackoverflow.com/q/25421974
has text: Exactly what type of exception is being thrown? `Exception` catches them all, and I think the only one that you need to catch is `NumberFormatException`, I may be mistaken though
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25480698
answers question: http://stackoverflow.com/q/25480619
upvote count: 2
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39844941
has body: You can easily achieve encapsulation by exposing only interfaces, not the implementation. In C++ interface is just a class with only pure virtual methods: class Interface { public: virtual void method() = 0; }; If your API is based on interfaces, besides encapsulation it will be also more modular and flexible, less coupled and more testable. So it's highly desirable to use interfaces in the API instead of implementation classes. Of course you will have to use factories, builders and other design patterns to construct the real instances implementing interfaces.

http://stackoverflow.com/a/25584146
type: Answer
has body: Since you are using Log4j 2, you may want to use a ThresholdFilter. Using this filter, your configuration file can be as follows: <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d %-5p (%c.java:%L).%M - %m%n" /> <ThresholdFilter level="DEBUG" /> <PatternLayout pattern="%d %-5p (%c.java:%L).%M - %m%n" /> <ThresholdFilter level="ERROR" /> <AppenderRef ref="appFile" /> <AppenderRef ref="errorFile" />
has comment: http://stackoverflow.com/comment/137097056
downvote count: 0
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/25532338
has comment: http://stackoverflow.com/comment/40031673

http://stackoverflow.com/q/25471340
accepted answer: http://stackoverflow.com/a/25471522
has answer: http://stackoverflow.com/a/25471522
has comment: http://stackoverflow.com/comment/39750134
type: Question
has comment: http://stackoverflow.com/comment/39750265
has comment: http://stackoverflow.com/comment/39750475
tagged with: inheritance
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/39750659
type: AnsweredQuestion
has body: I had previously implemented Abstract Factory Pattern on simple problems and it worked. So I tried to use same thing to solve this problem but I was confused. I wrote the bottom level classes but confused how to combine them to a single program. What Should I do and How should it be done? I am using Java to write a code to calculate tax. I am having base class TaxPayer. Taxpayer can have multiple incomeSource. There can be many types of TaxPayer or IncomeSource. There can be many income headings for different income sources as its attributes, which will be stored in database. The tax rate will be different for different taxpayer type and amount of taxableIncome. Base class Taxpayer is defined as public abstract class TaxPayer { private List&lt;IncomeSource&gt; incomeSource; double taxRate; Address address; other attributes here; public Double getTaxRate(){ return 0.25; //default tax rate } } public abstract class IncomeSource { private String incomeSourceName; private Double incomeHeading1, incomeHeading2, incomeHeading3; private Double totalIncome = incomeHeading1 + incomeHeading2 + incomeHeading3; } There can be more levels of IncomeSource inheritance with different income headings. Similarly tax payer type can be modeled into following inheritance structure Base Class: Taxpayer * IndividualPerson * Male, Female, OldAge * Business * Bank, ITIndustry, HydroElectricIndustry * TaxFree * SocialOrganization, ReligiousOrganization, PoliticalParty etc. The subclasses of TaxPayer generally modifies the taxRate to be applied to taxableIncome and sometimes changes taxableIncome with some logic. For an example: abstract class IndividualPerson extends TaxPayer{ if (incomeSource.taxableIncome &gt; 250000) taxRate = ratex; if (incomeSource.taxableIncome &gt; 500000) taxRate = ratey; @override public getTaxRate() { return taxRate; } } class Female extends IndividualPerson { if (incomeSource.getNumberOfIncomeSource() &gt; 1) taxRate = taxRate + rate1; else taxRate = taxRate - rat…
score: 0
tagged with: oop
tagged with: java
has title: How to implement multilevel inheritance using design pattern
answer count: 1
has comment: http://stackoverflow.com/comment/39750331

http://stackoverflow.com/q/25527932
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/26012795
upvote count: 5
score: 5
has title: Spring Security SAML Implementation
has comment: http://stackoverflow.com/comment/39989611
has comment: http://stackoverflow.com/comment/39952710
has answer: http://stackoverflow.com/a/26012795
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: saml
downvote count: 0
tagged with: java
has body: I am starting with new Spring project where i am planning to use SSO. I have red the blogs and come to know spring security SAML will be best solution for SP. So i have implemented Spring Security SAML sample application provided by spring site https://github.com/SpringSource/spring-security-saml as SP along with Shibboleth IDP. IDP connects with LDAP server. I am able to execute the Spring security sample application. I am confused how can i use this Spring security SAML extension along with multiple spring projects. Any example link or suggestions on architecturing the Spring SAML project integration with multiple Spring MVC application will be helpful.
tagged with: spring-saml
answer count: 1
has comment: http://stackoverflow.com/comment/39999258

http://stackoverflow.com/comment/39843200
comment on: http://stackoverflow.com/q/25521249
has text: We usually just have one disptacher per publish instance and never used it as a load balancer. Check the documentation at http://docs.adobe.com/docs/en/dispatcher.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25458036
tagged with: java
has title: Android - Getting a list of nearby places
has body: I need to be able to get a list of nearby places within my app. I want this to be inside a NavigationDrawer as well. Just like Google Now's Nearby Places card: Although I want this to be wrapped inside a NavigationDrawer. Any way to do this? Thanks.
tagged with: google-places-api
type: UnansweredQuestion
score: 1
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25458096
tagged with: google-now
tagged with: android

http://stackoverflow.com/q/25437688
tagged with: java
has title: Difference between standard Java SDK by Sun and Java development package by Apple
has body: I have run across these two options, what to install in my mac and still not well understand the difference between the "SDK provided by Sun" and the "Java for Mac Development Package". Obviously, I do java programming, but "Java for Mac Development Package" downloaded from developer.apple.com only supports version up to 6 (they call 10.6 for some reason), while the one provided by Sun is of version 7. Can someone, please, explain to me, from the perspectives of a Java developer: (1) What are the differences between the two? (2) which one should I install? The only advantage I know from the apple's version is I can have access to the source code, while the one from Sun does not provide that, so when I need to look the the source code of Java in eclipse, I need the Apple's version.
tagged with: macos
type: Question
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39687615
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39687433
has comment: http://stackoverflow.com/comment/39687388

http://stackoverflow.com/q/25416336
downvote count: 0
upvote count: 1
tagged with: swing
answer count: 1
favorite count: 0
type: Question
has title: Jprogressbar.setStringpainted(true); is painting two strings
tagged with: java
has answer: http://stackoverflow.com/a/25416393
type: UnansweredQuestion
tagged with: paintcomponent
score: 1
tagged with: custom-component
has body: This code is creating a problem that is when I click the button two strings are being painted one horizontal and one vertical, but need only horizontal string to be painted, so please tell what should I do??? import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JProgressBar; public class R implements ActionListener { static int y; CustomProgressBar b = new CustomProgressBar(); public static void main(String arg[]) throws Exception { new R(); } public R() throws Exception { JFrame f = new JFrame(); JButton btn = new JButton("Click"); f.setExtendedState(JFrame.MAXIMIZED_BOTH); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setUndecorated(true); f.setLayout(new FlowLayout()); btn.addActionListener(this); f.add(b); f.add(btn); f.setVisible(true); } class CustomProgressBar extends JProgressBar{ private static final long serialVersionUID = 1L; private boolean isStringToBePainted = false; public CustomProgressBar() { super(JProgressBar.VERTICAL,0,100); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(isStringToBePainted ) { Dimension size = CustomProgressBar.this.getSize(); if( CustomProgressBar.this.getPercentComplete()&lt;0.9 ) R.y = (int)( size.height - size.height * CustomProgressBar.this.getPercentComplete() ); String text = getString(); g.setColor(Color.BLACK ); g.drawString(text, 0, R.y); } } @Override public void setStringPainted(boolean b) { super.setStringPainted(b); isStringToBePainted=b; } } @Override public void actionPerformed(ActionEvent e) { b.setStringPainted(true); } }
tagged with: jprogressbar

http://stackoverflow.com/q/25509870
score: 1
upvote count: 1
tagged with: java
answer count: 1
has title: Embedded Tomcat 8 Application Configured Programmatically
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25510034
tagged with: maven
tagged with: spring
tagged with: tomcat
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25510034
type: AnsweredQuestion
has body: Is there a way to create an application with embedded Tomcat 8 that is configured programmatically (not through a web.xml)? I'm trying to start this application via main() and not through Maven's Tomcat plugin.
downvote count: 0

http://stackoverflow.com/comment/39659970
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25423170
has text: Why don't you just place a breakpoint where you need it to stop?
score: 0

http://stackoverflow.com/a/25421803
score: 0
answers question: http://stackoverflow.com/q/25421654
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25421654
has body: Just return from the method. public void doXxx(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // ... if (someCondition) { return; } // ... }
has comment: http://stackoverflow.com/comment/39659681
type: Answer
has comment: http://stackoverflow.com/comment/39659703

http://stackoverflow.com/q/25427684
accepted answer: http://stackoverflow.com/a/25431209
downvote count: 0
has title: Using @Profile in spring boot
has answer: http://stackoverflow.com/a/25431209
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39673492
tagged with: spring-boot
tagged with: java
has body: I have spring boot application (1.1.5.RELEASE) and enabling my profiles via the configuration protperty spring.profiles.active=MyProfile The profile gets activated correctly which I can see by beans from that profile being created. Then I have a @Controller used as follows: @Controller @RequestMapping("/someUrl") @Profile("MyProfile") public class MyController { ... } This controller is not instantiated and URL used in the controller are not mapped. In the same package I have another controllers which are not limited by @Profile and these get instsantiated and mapped as expected. So is using @Profile annotation on controller something which is not compatible with spring boot? Is there other approach I should be using? Edit: It seems to be a bug after all as if I include -Dspring.profiles.active=MyProfile as JVM property the controller gets instantiated :'( Edit2: So here comes the interesting part: If you define spring.profiles.active in application.properties which is loaded by default from classpath thne it works when you rename the file to test.properties and include it via @PropertySource("classpath:test.properties") it stops working. Will raise a bug against it. Edit 3: As promised: https://github.com/spring-projects/spring-boot/issues/1417 Thanks!
possible better answer: http://stackoverflow.com/a/25428644
favorite count: 0
type: Question
score: 9
has answer: http://stackoverflow.com/a/25428644
answer count: 2
has comment: http://stackoverflow.com/comment/39669588
upvote count: 9
has comment: http://stackoverflow.com/comment/39674097

http://stackoverflow.com/comment/75882761
comment on: http://stackoverflow.com/q/25406157
score: 1
type: Comment
type: QuestionComment
has text: benchmarks give the definitive answer, but even after you may not know the *why* ..

http://stackoverflow.com/a/25399246
has body: Do not play with db path and file permissions for your case. IMO Rooted and Normal Device are mutually exclusive audience. Only For your testing rooted devices create db on sd card with path derived from Environment.getExternalStorage** method. TO HAVE YOUR DB ON SD CARD. DO SOMETHING LIKE THIS. Put this class in your code packages. package com.test.db; import java.io.File; import android.content.Context; import android.content.ContextWrapper; import android.database.DatabaseErrorHandler; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.os.Environment; /** * Custom context wrapper to proxy the database file path. * Instead of storing data on internal storage for app * we will storing the data on external sd card. */ public class DatabaseContext extends ContextWrapper { /* * Used for logging. */ private static final String DEBUG_CONTEXT = "DatabaseContext"; /* * Constructor wrapping given app context. */ public DatabaseContext(Context base) { super(base); } /** * Proxy the path to data base file for every operation * @see android.content.ContextWrapper#getDatabasePath(java.lang.String) */ @Override public File getDatabasePath(String name) { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { // We can read and write the media File sdcard = Environment.getExternalStorageDirectory(); String dbfile = sdcard.getAbsolutePath() + File.separator + "com.test" + File.separator + "database" + File.separator + name; if (!dbfile.endsWith(".db")) { dbfile += ".db"; } File result = new File(dbfile); if (!result.getParentFile().exists()) { if(!result.getParentFile().mkdirs()){ result = new File(sdcard, name); } } if (android.util.Log.isLoggable(DEBUG_CONTEXT, android.util.Log.WARN)) { android.util.Log.w(DEBUG_CONTEXT, "getDatabasePath(" + name + ") = " + result.getAbsolutePath()); } return result; } else { // Something else is wrong. It may be one of many other…
has comment: http://stackoverflow.com/comment/39616443
upvote count: 2
has comment: http://stackoverflow.com/comment/39617373
downvote count: 0
has comment: http://stackoverflow.com/comment/39616971
has comment: http://stackoverflow.com/comment/39616838
has comment: http://stackoverflow.com/comment/39616702
has comment: http://stackoverflow.com/comment/39616488
has comment: http://stackoverflow.com/comment/39615825
has comment: http://stackoverflow.com/comment/39618259
has comment: http://stackoverflow.com/comment/39617447
type: Answer
has comment: http://stackoverflow.com/comment/39616372
answers question: http://stackoverflow.com/q/25397417
score: 2

http://stackoverflow.com/q/25430238
tagged with: io
has title: how to estimate total IO
tagged with: nio
has answer: http://stackoverflow.com/a/25430382
score: 0
type: UnansweredQuestion
tagged with: java
answer count: 1
has body: I am developing a process that works as a facade for all clients to access data (reports size vary from 100 kb to few MB), with few thousands run each day but exact number is unknown and may vary significantly from day to day. The motivations behind building façade is we have several servers behind the scene that can generate the data but we want to have some sort of load balancing to make best use of all servers we have also the clients don’t need to know a individual server they need to hit. So the façade selects a server, round the report and send back the data to client. So there are two IO involved here for a given report Between Client and Façade server Between façade server and the processing node I know this is little vague topic but how can I estimate the total IO to see if the façade is going to become a bottleneck in itself as all IO goes through it. Any insight, tips would be greatly appreciated.
type: Question
tagged with: sockets
tagged with: netty

http://stackoverflow.com/q/25537090
has answer: http://stackoverflow.com/a/25537177
answer count: 9
has answer: http://stackoverflow.com/a/25537269
tagged with: if-statement
has answer: http://stackoverflow.com/a/25537114
type: UnansweredQuestion
score: -1
has answer: http://stackoverflow.com/a/25539480
has answer: http://stackoverflow.com/a/25537116
has answer: http://stackoverflow.com/a/25537118
has answer: http://stackoverflow.com/a/25537119
has body: In my program, I have a String called yesOrNo that is a keyboard input. I created an if statement to test if yesOrNo is one of the following : "Y", "y", "Yes", "yes" by using the || operator. I got the error message: The operator || is undefined for the argument type(s) java.lang.String, java.lang.String. What is the right way to do something like this? Thanks. Scanner keyboard = new Scanner(System.in); String yesOrNo = keyboard.nextLine(); System.out.println(yesOrNo + "?" ); if (yesOrNo.equals("Y" || "y" || "Yes || "yes")){
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25537115
has title: How to make a x = y or z statement in Java
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25537142
type: Question

http://stackoverflow.com/comment/39651265
type: AnswerComment
has text: @Tess, you can undo and select mine as best, If you want to.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25404589

http://stackoverflow.com/q/25539262
downvote count: 1
favorite count: 0
type: Question
has body: I'm currently following a youtube tutorial for beginners at Java. It's currently showing me how to use arrays with different methods. class apples { public static void main(String args[]) { int bucky[]={3,4,5,6,7}; change(bucky); for(int y:bucky) System.out.println(y); } public static void change(int x[]){ for(int counter=0;counter&lt;x.length;counter++) x[counter]+=5; } } More importantly the int x in the change method I do not know why it is used and the tutorial explained it very briefly.
has comment: http://stackoverflow.com/comment/39875646
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25539333
type: UnansweredQuestion
tagged with: java
tagged with: arrays
upvote count: 1
has title: Java: Why is int x and int y used in this code (Arrays in methods)
has answer: http://stackoverflow.com/a/25539293

http://stackoverflow.com/q/25412769
tagged with: android
tagged with: java
has body: I'm trying to install ListViewAnimations on my local maven repository. So I cloned the git repo and I ran mvn install. Unfortunately, I'm stuck with that error : [ERROR] Failed to execute goal on project lib-core: Could not resolve dependencies for project com.nhaarman.listviewanimations:lib-core:apklib:3.0.0-SNAPSHOT: The following artifacts could not be resolved: com.google.android:android:jar:4.4.2_r3, com.android.support:support-annotations:jar:19.1.0: Failure to find com.google.android:android:jar:4.4.2_r3 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central I don't understand how to resolve this : The latest version of com.google.android:android at maven central is 4.1.1.4 I could use the maven SDK deployer, but it install android:android:4.4.2_r3, not com.google.android:android:jar:4.4.2_r3... Thanks in advance for your help.
score: 2
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25424288
has title: Where is com.google.android:android:jar:4.4.2_r3?
downvote count: 0
has answer: http://stackoverflow.com/a/25424288
tagged with: maven
answer count: 1
favorite count: 0
type: Question

http://stackoverflow.com/a/25429157
answers question: http://stackoverflow.com/q/25428909
has body: Ok the solution was sooo simple, that it's almost a-shame I haven't found it earlier. The hint was in this link: https://issues.jasig.org/browse/CASC-174 Servlet 3.0 has request.login(username, password) method which does all I needed.
has comment: http://stackoverflow.com/comment/139558175
type: Answer
score: 0

web-services
tags question: http://stackoverflow.com/q/25507584
tags question: http://stackoverflow.com/q/25420741
tags question: http://stackoverflow.com/q/25483338
type: Tag
tags question: http://stackoverflow.com/q/25509825
tags question: http://stackoverflow.com/q/25398081
tags question: http://stackoverflow.com/q/25527971
tags question: http://stackoverflow.com/q/25460106
tags question: http://stackoverflow.com/q/25476762
tags question: http://stackoverflow.com/q/25528477
tags question: http://stackoverflow.com/q/25455908
tags question: http://stackoverflow.com/q/25399312
tags question: http://stackoverflow.com/q/25505292
tags question: http://stackoverflow.com/q/25545239
tags question: http://stackoverflow.com/q/25475541
tags question: http://stackoverflow.com/q/25404163
tags question: http://stackoverflow.com/q/25518143
tags question: http://stackoverflow.com/q/25500413
tags question: http://stackoverflow.com/q/25509402
tags question: http://stackoverflow.com/q/25528093
tags question: http://stackoverflow.com/q/25443864
tags question: http://stackoverflow.com/q/25420522
tags question: http://stackoverflow.com/q/25512544
tags question: http://stackoverflow.com/q/25411762
tags question: http://stackoverflow.com/q/25482141
tags question: http://stackoverflow.com/q/25507761
tags question: http://stackoverflow.com/q/25480233
tags question: http://stackoverflow.com/q/25499025
tags question: http://stackoverflow.com/q/25509111
tags question: http://stackoverflow.com/q/25514653
tags question: http://stackoverflow.com/q/25485449
tags question: http://stackoverflow.com/q/25413035
tag name: web-services
tags question: http://stackoverflow.com/q/25513324
tags question: http://stackoverflow.com/q/25483534
tags question: http://stackoverflow.com/q/25489504
tags question: http://stackoverflow.com/q/25515024
tags question: http://stackoverflow.com/q/25391606
tags question: http://stackoverflow.com/q/25521691
tags question: http://stackoverflow.com/q/25491617
tags question: http://stackoverflow.com/q/25470319
tags question: http://stackoverflow.com/q/25489716
tags question: http://stackoverflow.com/q/25513552
tags question: http://stackoverflow.com/q/25406563
tags question: http://stackoverflow.com/q/25534559
tags question: http://stackoverflow.com/q/25479797
tags question: http://stackoverflow.com/q/25543854
tags question: http://stackoverflow.com/q/25420697
tags question: http://stackoverflow.com/q/25529833
tags question: http://stackoverflow.com/q/25446997
tags question: http://stackoverflow.com/q/25424302
tags question: http://stackoverflow.com/q/25430454
tags question: http://stackoverflow.com/q/25418925
tags question: http://stackoverflow.com/q/25421123
tags question: http://stackoverflow.com/q/25502507
tags question: http://stackoverflow.com/q/25408961
tags question: http://stackoverflow.com/q/25531928
tags question: http://stackoverflow.com/q/25420441

http://stackoverflow.com/a/25540697
score: 0
type: Answer
has body: I access the url by chrome, it says that is not secret link. Why not try change the url to https://www.cub.com/content/dam/B2C/enterprisebannerwebsites/Cub/CUB_WK25_HP_BackToSchool.jpg PS: just add wwwto the url header. updated: I use Android-Universal-Image-Loader and look for Document, the image is loaded!!! PS：Maybe you you need the web ca: openssl s_client -connect cub.com:443 -----BEGIN CERTIFICATE----- [binary] -----END CERTIFICATE----- The follow is the code I used to replace that BaseImageDownLoader: protected HttpsURLConnection createConnection(String url, Object extra) throws IOException { String encodedUrl = Uri.encode(url, ALLOWED_URI_CHARS); // Load CAs from an InputStream // (could be from a resource or ByteArrayInputStream or ...) CertificateFactory cf = null; try { cf = CertificateFactory.getInstance("X.509"); } catch (CertificateException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // From https://www.washington.edu/itconnect/security/ca/load-der.crt InputStream caInput = new BufferedInputStream(new FileInputStream(Environment.getExternalStorageDirectory() + "/cub.crt")); Certificate ca = null; try { try { ca = cf.generateCertificate(caInput); System.out.println("ca=" + ((X509Certificate) ca).getSubjectDN()); } catch (CertificateException e) { // TODO Auto-generated catch block e.printStackTrace(); } } finally { caInput.close(); } // Create a KeyStore containing our trusted CAs String keyStoreType = KeyStore.getDefaultType(); KeyStore keyStore = null; try { keyStore = KeyStore.getInstance(keyStoreType); try { keyStore.load(null, null); keyStore.setCertificateEntry("ca", ca); } catch (NoSuchAlgorithmException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (CertificateException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // Create a TrustManager that trusts the CAs in our KeyStore String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm(); TrustManagerFactory tmf = null; try { tmf …
answers question: http://stackoverflow.com/q/25540646

http://stackoverflow.com/comment/39724337
has text: You already have an example of that in your code: `FieldInsnNode(GETSTATIC, `. It accesses the field MinecraftForge.EVENT_BUS.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25457423
score: 2

http://stackoverflow.com/comment/39649588
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25416923
has text: @HotLicks Thats not true. StackOverflow is made for people like us :)
type: AnswerComment

http://stackoverflow.com/comment/39802874
has text: @Neil Lunn if i am missing something so please can you provide me some examples how to store xml into mongodb? See the code below where i am using the way to store xml into mongodb. **String json3 = "{'_id':'"+id+"','xml':'"+xmlFile+"'}"; DBObject dbObject = (DBObject)JSON.parse(json3); collection.insert(dbObject);**
type: Comment
comment on: http://stackoverflow.com/q/25486782
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39844828
type: AnswerComment
has text: @membersound My best guess would be that the existence of `Condition` does something internally that prevents `AutowiredAnnotationBeanPostProcessor` from working
comment on: http://stackoverflow.com/a/25522472
score: 0
type: Comment

http://stackoverflow.com/comment/39839799
type: Comment
type: QuestionComment
has text: you can try Apache POI.
comment on: http://stackoverflow.com/q/25519654
score: 0

http://stackoverflow.com/comment/39658056
comment on: http://stackoverflow.com/q/25421665
score: 0
type: Comment
type: QuestionComment
has text: that can be proguard issue. was proguar enabled at project.properties file? if so do you have -keep public class * extends android.app.Application at your proguard conf file?

http://stackoverflow.com/q/25439565
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39691391
has answer: http://stackoverflow.com/a/25440069
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25439709
has comment: http://stackoverflow.com/comment/39690614
answer count: 3
has comment: http://stackoverflow.com/comment/39690512
tagged with: sql
score: 1
has answer: http://stackoverflow.com/a/25439709
tagged with: java
accepted answer: http://stackoverflow.com/a/25439701
tagged with: jdbc
tagged with: mysql
has body: I have a table named Domain_Test and column are:- ID Domain Processed Here ID is auto increment and Domain contains links and processed contains 0. Basically i need a query through which I can retrieve the domain and at the same time need to update processed column to 1. And I'm using java to do all this.
has title: How to insert and retrieve at the same time in MySQL
has comment: http://stackoverflow.com/comment/39690645
has comment: http://stackoverflow.com/comment/39690615
has comment: http://stackoverflow.com/comment/39690593
has answer: http://stackoverflow.com/a/25439701
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39690558

http://stackoverflow.com/a/25515519
has comment: http://stackoverflow.com/comment/39833270
type: Answer
has body: It's because you provide an implementation for render() in your Game class, rather than use a separate Screen. If you use Screens, you mustn't provide an implementation for render() in your Game class. Also, you should allocate the Texture for the SplashScreen in a constructor, rather than in the show() method. But that's just a minor caveat.
has comment: http://stackoverflow.com/comment/39842156
answers question: http://stackoverflow.com/q/25513359
score: 0

http://stackoverflow.com/comment/39643144
has text: Hi, I have moved it to the root config, but it's still the same.
comment on: http://stackoverflow.com/a/25412659
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25437051
has answer: http://stackoverflow.com/a/25437124
has comment: http://stackoverflow.com/comment/39686703
score: 0
tagged with: command-prompt
answer count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25437450
tagged with: eclipse
has body: I'm currently in the process of learning more about Java. I downloaded a sample program that has about 5 different .java files in the source folder. Whenever I try to execute the class files in the command prompt using "java ClassNameHere", I get a message in the cmd prompt that says "Error: Could not find or load main class ClassNameHere". I've tried recompiling them using the javac command and they compiles without any issues. Its just the class file i'm having trouble with. In addition to this, I also cannot run the java files using Eclipse. Instead of getting an option to "Run as Java Application", "non applicable" appears under the "Run as" tab in Eclipse. I've tried a number of different solutions already posted online, including another command that uses "java -cp . ClassNameHere" or something along those lines and they have not worked for me. Any help is appreciated. Edit Link to program from my drive since I'm not home https://docs.google.com/file/d/0B9_pcTVZTnfEeVdzZmM0ZmFkTmc/edit?usp=docslist_api
type: Question
has comment: http://stackoverflow.com/comment/39686489
has title: Error when executing class file in command prompt
has answer: http://stackoverflow.com/a/25437450
possible better answer: http://stackoverflow.com/a/25437124
has answer: http://stackoverflow.com/a/25437270
type: AnsweredQuestion

http://stackoverflow.com/comment/39754194
type: QuestionComment
has text: @TheLostMind, thanks to both of you, now I know this reason, I should use volatile. Can you answer my second question? Assignment of object reference is Atomic, so the value of cache is either old value or new value. So even HashMap is not thread safe, it won't be go wrong(Maybe just always read the old values). Because my thread just read the value.
score: 0
comment on: http://stackoverflow.com/q/25473315
type: Comment

http://stackoverflow.com/a/25459661
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25428759
type: Answer
has body: From above code I think you are tunneling a remote 3309 port to a local port on 3309 (and not 27020). Per your code: int tunnelLocalPort = 3309; String tunnelRemoteHost = "host"; int tunnelRemotePort = 3306; Check the host and port of the remote host and map it accordingly. Set the local port to what you are listening in the code (27020). Try the whole exercise without code first maybe: Tunnel the remote MongodDB server using PuTTY (or command line if you are on Linux). Connect via Mongo to the local port where you mapped the remote port.
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/25428759
type: AcceptedAnswer

http://stackoverflow.com/comment/39798267
type: QuestionComment
comment on: http://stackoverflow.com/q/25497129
has text: `R = 15/100` should give you 0 if both are integers. You need to cast as `double` to get the value 0.15. Also, is there a particular reason you need to pass numeric arguments as strings?
score: 0
type: Comment

http://stackoverflow.com/q/25547366
favorite count: 0
type: Question
upvote count: 5
score: 5
has answer: http://stackoverflow.com/a/25551340
tagged with: java-7
has comment: http://stackoverflow.com/comment/39891810
has comment: http://stackoverflow.com/comment/39891719
has comment: http://stackoverflow.com/comment/39897244
tagged with: coldfusion
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25551340
downvote count: 0
tagged with: java-6
tagged with: java
has comment: http://stackoverflow.com/comment/39897804
answer count: 1
has title: Valid mask patterns for dateTimeFormat
has body: I was given code that uses the dateTimeFormat function. The original developer used a mask of "MM-HH-YY-dd-NN". This code works on his machine. And it works on our test server. But it does not work on my local machine. I can only make it work when I change the mask to "MM-HH-yy-dd-NN"; Note the difference here is the upper case "YY" and the lower case "yy" In looking at the documentation at https://wikidocs.adobe.com/wiki/display/coldfusionen/DateTimeFormat it looks like lower case yy is the officially supported way of doing things. Does anyone know why YY would be supported in some situations and not others? I suspect it may be some localization code somewhere, but I'm not finding any differences in my CF admin and the one on the test server. Is there something I can do on my machine to make the YY work? My machine is a Windows 7 VM running on Mac while the server is a Windows server 2008. My JVM is 1.6.0_29 while the server is running 1.7.0 Are these differences sufficient to explain the issue? Here is some simple code for test: &lt;cfscript&gt; testTime=now(); lowermask= "MM-HH-yy-dd-NN"; uppermask= "MM-HH-YY-dd-NN"; result = { lower=dateTimeFormat(testTime, lowermask) ,upper=dateTimeFormat(testTime, uppermask) }; writedump(result); &lt;/cfscript&gt; It looks like the problem is in the underlying Java version. The error I get is: java.lang.IllegalArgumentException: Illegal pattern character 'Y' at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:768) at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:575) at java.text.SimpleDateFormat.&lt;init&gt;(SimpleDateFormat.java:500) at coldfusion.util.DateUtils.getCFDateTimeFormat(DateUtils.java:673) at coldfusion.util.DateUtils.formatDateTime(DateUtils.java:942) at coldfusion.runtime.CFPage.LSDateTimeFormat(CFPage.java:1750) at coldfusion.runtime.CFPage.LSDateTimeFormat(CFPage.java:1742) at coldfusion.runtime.CFPage.DateTimeFormat(CFPage.java:1722) at cftemp2ecfm333879290.runPage(C:\inetpub\wwwroot\te…

http://stackoverflow.com/a/25459461
downvote count: 0
has comment: http://stackoverflow.com/comment/39801064
answers question: http://stackoverflow.com/q/25459306
score: 2
has comment: http://stackoverflow.com/comment/39728296
has comment: http://stackoverflow.com/comment/39728258
type: Answer
has body: In your onClick method, you can just set the visibility to GONE to remove the view as shown below: View.OnClickListener addListener = new View.OnClickListener() { @Override public void onClick(View v) { final RelativeLayout newView = (RelativeLayout) getLayoutInflater().inflate(R.layout.product_row_detail, null); newView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); ImageButton btnRemove = (ImageButton) newView.findViewById(R.id.btnRemove); btnRemove.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { newView.setVisibility(View.GONE); // remove (hide) your view } }); container.addView(newView); And to enable it again, you can set its visibility to VISIBLE as shown below: newView.setVIsibility(View.VISIBLE); Or you could just show/hide your spinner as shown below: your_spinner.setVisibility(View.GONE); // to remove (hide) your_spinner.setVisibility(View.VISIBLE); // to make it visible If you want to only disable the spinner: your_spinner.setEnabled(false); Hope it helps.
has comment: http://stackoverflow.com/comment/39728167
upvote count: 2

http://stackoverflow.com/comment/39701276
has text: do i have to create getters and setters for price field? And i am also confused about using s:iterator as even text price is not showing up.Please help
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25444805
type: Comment

soap-client
tags question: http://stackoverflow.com/q/25408961
tag name: soap-client
tags question: http://stackoverflow.com/q/25512438
type: Tag

http://stackoverflow.com/comment/39711703
has text: @user3218114 I make the changes in HttpRequest as you indicated, please see the edit.
comment on: http://stackoverflow.com/q/25450671
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39856451
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25528986
has text: You probably have different decimal points (`,` or `.`) on your windows computer and mac. Check your locale settings.

http://stackoverflow.com/a/25502118
has comment: http://stackoverflow.com/comment/39807018
accepted answer of: http://stackoverflow.com/q/25502092
downvote count: 0
answers question: http://stackoverflow.com/q/25502092
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39806946
score: 3
upvote count: 3
has body: Change your constructor as below myCursorAdapter = new SimpleCursorAdapter(getActivity(), R.layout.message_list_item, cursor, fromFieldNames, toViewIDs); The first param is a Context. This QuestionsNew.this is not a valid context. Fragment does not extend Context. Activity java.lang.Object ↳ android.content.Context // check this ↳ android.content.ContextWrapper ↳ android.view.ContextThemeWrapper ↳ android.app.Activity // check this Fragment java.lang.Object ↳ android.app.Fragment // check this So get context in fragment use getActivity() public final Activity getActivity () Added in API level 11 Return the Activity this fragment is currently associated with. Also SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) This constructor was deprecated in API level 11. This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use LoaderManager with a CursorLoader. It is same when you use ArrayAdapter in Fragment class. The first param to the constructor of ArrayAdapter is a valid context. So even in that case you need to use getActivity() instead of FragmentName.this.
type: Answer

http://stackoverflow.com/comment/39635626
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25407420
has text: To clarify: what you seem to REALLY want to do is have a json template with most of the same values. In other words, you are NOT receiving a JSON string, making one change to it, and forwarding it on somewhere else. Correct?

http://stackoverflow.com/a/25498495
has comment: http://stackoverflow.com/comment/39808689
type: Answer
has comment: http://stackoverflow.com/comment/39810976
accepted answer of: http://stackoverflow.com/q/25495274
score: 0
has comment: http://stackoverflow.com/comment/39811498
answers question: http://stackoverflow.com/q/25495274
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39823024
has body: You need to create a new List before iterating and then iterate over Map#values() and then add every List to the new List via its addAll() method. List&lt;Article&gt; selectedArticles = new ArrayList&lt;&gt;(); for (List&lt;Article&gt; selection : selections.values()) { selectedArticles.addAll(selection); } // Now use selectedArticles. See also: Java tutorial - Collections - Lists

audio
tags question: http://stackoverflow.com/q/25511727
tags question: http://stackoverflow.com/q/25510139
tags question: http://stackoverflow.com/q/25414132
tags question: http://stackoverflow.com/q/25481262
tags question: http://stackoverflow.com/q/25397227
tags question: http://stackoverflow.com/q/25541023
tags question: http://stackoverflow.com/q/25474553
tags question: http://stackoverflow.com/q/25434606
tags question: http://stackoverflow.com/q/25421066
type: Tag
tags question: http://stackoverflow.com/q/25505682
tags question: http://stackoverflow.com/q/25536449
tags question: http://stackoverflow.com/q/25507189
tag name: audio
tags question: http://stackoverflow.com/q/25425681

http://stackoverflow.com/q/25455903
has comment: http://stackoverflow.com/comment/39721675
tagged with: java
has answer: http://stackoverflow.com/a/30794973
downvote count: 0
has answer: http://stackoverflow.com/a/33830107
has title: Codility FrogJmp strange Java score
has comment: http://stackoverflow.com/comment/39721842
has answer: http://stackoverflow.com/a/53937403
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/69237970
has answer: http://stackoverflow.com/a/42898849
has answer: http://stackoverflow.com/a/63361686
has answer: http://stackoverflow.com/a/67324052
has answer: http://stackoverflow.com/a/27189215
accepted answer: http://stackoverflow.com/a/25456053
has answer: http://stackoverflow.com/a/57909607
has answer: http://stackoverflow.com/a/27582110
score: 6
has answer: http://stackoverflow.com/a/30777341
has answer: http://stackoverflow.com/a/25456053
answer count: 18
has answer: http://stackoverflow.com/a/30325961
has body: So I decided to try out Codility. The first task - FrogJmp was ridiculous easy, however to my surprise I scored 44%. Solution, even if correct was obviously unacceptable in terms of performance. Original solution: public int solution2(int X, int Y, int D) { return (int) Math.ceil((float)(Y -X)/D); } So I decided to try it with different code, without floating point arithmetic. public int solution(int X, int Y, int D) { int diff = Y - X; if (diff % D == 0) return diff /D; else return diff/D + 1; } This time I got 100%. So I wanted to check the performance myself and wrote simple test: class Solution { public int solution(int X, int Y, int D) { int diff = Y - X; if (diff % D == 0) return diff /D; else return diff/D + 1; } public int solution2(int X, int Y, int D) { return (int) Math.ceil((float)(Y -X)/D); } private static Random ran = new Random(System.currentTimeMillis()); public static int getRandom(int a, int b){ return ran.nextInt(b - a + 1) + a; } public static void main(String[] args) { int size = 1000_000; int max = 1000_000_000; int[] xs = new int[size]; int[] ys = new int[size]; int[] ds = new int[size]; for (int i = 0; i &lt; size; i++) { int y = getRandom(1, max); int x = getRandom(1, y); int d = getRandom(1, max); xs[i] = x; ys[i] = y; ds[i] = d; } long start = System.nanoTime(); Solution sol = new Solution(); for (int i = 0; i &lt; size; i++) { sol.solution2(xs[i], ys[i], ds[i]); } long diff = System.nanoTime() - start; System.out.println("took: " + diff/1000000 + "ms"); } } To my surprise, on my machine the solution 1 takes on average 13ms and solution 2 (the one reported as absolutely ineffective) 10 ms. What am I missing? Maybe it has to do something with expected time and space complexity of the tasks. expected worst-case time complexity is O(1); expected worst-case space complexity is O(1). Does not solution 2 have constant time &amp; space complexity? Also I cannot make sense of this results report for 44% solution: What does it mean??
upvote count: 6
has answer: http://stackoverflow.com/a/53995751
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38342793
has answer: http://stackoverflow.com/a/25589281
has answer: http://stackoverflow.com/a/26918155
possible better answer: http://stackoverflow.com/a/27582110
has answer: http://stackoverflow.com/a/33451183
tagged with: time-complexity

http://stackoverflow.com/q/25456181
tagged with: interface
has body: I have a converter interface that looks something like this: public interface MyTypeConverter&lt;T&gt; { public MyObject toMyObject(T obj); public T fromMyObject(MyObject mo); } I also have an implementation of that interface: public class ABCTypeConverter implements MyTypeConverter&lt;ABCObject&gt; { public MyObject toMyObject(ABCObject obj) { ...do conversion... } public ABCObject fromMyObject(MyObject mo) { ...do conversion... } } And a factory that evaluates the objects type, and returns an appropriate converter implementation: public class MyTypeConverterFactory { public static MyTypeConverter&lt;?&gt; create(Object source) { if ( source instanceof ABCObject ) return new ABCTypeConverter(); ...and so on... } } Now the problem I am having is in referencing the Factory's returned converter instance by using the interface: MyTypeConverter&lt;?&gt; converter = MyTypeConverterFactory.create(someObject); MyObject mo = converter.toMyObject(someObject); The last line gives me the following compile-time error: The method toMyObject(capture#3-of ?) in the type MyTypeConverter&lt;capture#3-of ?&gt; is not applicable for the arguments (ABCObject) So how could I reference the converter in a generic fashion? EDIT The core of my question is: How do I call a method on an interface reference without first casting to the underlying concrete type? And if I can't, then what is the point of creating a generic interface to begin with? I.E., How do I do this (regardless of how I get the reference): MyTypeConverter&lt;?&gt; converter = MyTypeConverterFactory.create(someObject); MyObject mo = converter.toMyObject(someObject); Without first casting "converter" to its underlying concrete type?
tagged with: java
linked to: http://stackoverflow.com/q/3696295
has answer: http://stackoverflow.com/a/25456252
tagged with: generics
answer count: 2
duplicate of: http://stackoverflow.com/q/3696295
type: UnansweredQuestion
has title: Reference Object Through Its Implemented Generalized Interface
has answer: http://stackoverflow.com/a/25456442
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
score: 0

message-queue
type: Tag
tags question: http://stackoverflow.com/q/25434176
tag name: message-queue

http://stackoverflow.com/comment/39716426
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25453342
score: 0
has text: run 'mvn clean install' from command line and see if it build right. if not then issue in pom else issue in eclipse project build configuration. I am presuming you are using m2e on eclipse.

http://stackoverflow.com/a/25494565
has comment: http://stackoverflow.com/comment/39819931
has body: Return code is: 409, ReasonPhrase: The repository 'metasystems-snapshot' rejected the artifact 'metasystems-snapshot:com/lowagie/itext/2.1.7.js1/itext-2.1.7.js1.jar' due to its snapshot/release handling policy.. As Error Code 409 suggests, you are trying to deploy a snapshot version into a release only repository. Hence the conflict. Select a snapshot repository instead of a release one in your pom.xml or select a release library rather than the snapshot library for your release version.
type: Answer
has comment: http://stackoverflow.com/comment/39814553
answers question: http://stackoverflow.com/q/25493742
has comment: http://stackoverflow.com/comment/39814314
has comment: http://stackoverflow.com/comment/39813987
has comment: http://stackoverflow.com/comment/39793742
upvote count: 1
has comment: http://stackoverflow.com/comment/39793896
score: 1
downvote count: 0

http://stackoverflow.com/comment/39824864
has text: I agree with @LuiggiMendoza that the truncation will happen in the database and not at the JDBC level.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25510982

http://stackoverflow.com/q/25543854
type: Question
has title: Call a java Rest webservice on email event
tagged with: rest
has answer: http://stackoverflow.com/a/25544096
type: UnansweredQuestion
score: -1
upvote count: 0
tagged with: java
answer count: 1
downvote count: 1
tagged with: web-services
has body: I have a webservice x exposed.If I get a mail in my email containing attachment I want to call this webservice.I am not asking for code.I am asking your suggestion in high level how this can be done?
favorite count: 0

http://stackoverflow.com/comment/39608073
type: Comment
comment on: http://stackoverflow.com/q/25393995
type: QuestionComment
has text: If you change from linkText to cssSelector does that work better?
score: 0

http://stackoverflow.com/a/25667688
score: 0
has body: You can directly make a field as required in Visualforce using required attribute to a specific component &lt;apex:inputField value="{!Account.Name}" required="true"/&gt; To make a field required using Javascript in VisualForce page please &lt;apex:page StandardController="Account"&gt; &lt;script&gt; function setRequired() { if (document .getElementById('{!$Component.theForm.thePageBlock.thePageBlockSection.accPhone}').value == '') alert("Phone number will not be blank"); } &lt;/script&gt; &lt;apex:form id="theForm"&gt; &lt;apex:pageBlock id="thePageBlock"&gt; &lt;apex:pageBlockButtons&gt; &lt;apex:commandButton value="submit" action="{!save}" onclick="setRequired();" /&gt; &lt;/apex:pageBlockButtons&gt; &lt;apex:pageBlockSection id="thePageBlockSection"&gt; &lt;apex:inputField id="accPhone" value="{!Account.Phone}" /&gt; &lt;apex:inputField value="{!Account.Name}" /&gt; &lt;/apex:pageBlockSection&gt; &lt;/apex:pageBlock&gt; &lt;/apex:form&gt; &lt;/apex:page&gt; Regards, Naveen Software Engineer http://www.autorabit.com
type: Answer
answers question: http://stackoverflow.com/q/25529108

http://stackoverflow.com/a/25506224
score: 5
type: Answer
has body: Because you are using Java 6, checking the modified date or file contents is your only option (there's another answer that discusses using the newer java.nio.file functionality, and if you have the option of moving to Java 7, you should really, really consider that). To answer your original question: You didn't specify the location of the file (i.e. is it on a local disk or a server somewhere else) - I'll respond assuming local disk, but if the file is on a different machine, network latencies and netbios/dfs/whatever-network-file-system-you-use will exacerbate the differences. Checking modified date on a file involves reading the meta data from disk. Checking the contents of the file require reading the file contents from disk (if the file is small, this will be one read operation. If the file is larger, it could be multiple read operations). Reading the content of the file will probably involve read/write lock checking. Generally speaking, checking the modified date on the file will not require read/write lock checking (depending on the file system, there may still be consistency locks occurring on the meta data disk page, but those are generally lighter weight than file locks). If the file changes frequently (i.e. you actually expect it to change every minute), then checking the modified date is just overhead - you are going to read the file contents in most cases anyway. If the file doesn't change frequently, then there would definitely be an advantage to modified date checking if the file was large (and you had to read the entire file to get at your information). If the file is small, and doesn't change frequently, then it's pretty much a wash. In most cases, the file contents and the file meta data are already going to be paged into RAM - so both operations are a relatively efficient check of contents in RAM. I personally would do the modified date check just b/c it logically makes sense (and it protects you from the performance hit if the file size ever grows…
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25501961
answers question: http://stackoverflow.com/q/25501961
upvote count: 5

http://stackoverflow.com/comment/39810365
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25487886
has text: I've tried to do so by opening the port 25 like this : sudo ufw allow out 25 but it doesn't work

http://stackoverflow.com/a/25434698
downvote count: 0
answers question: http://stackoverflow.com/q/25433081
upvote count: 1
has body: If you're looking at comparing dates, isBefore / isAfter in java.util.Date class is useful. java.sql.Date allows you to create a Date as opposed to a DateTime. java.util.Calendar is what I usually use for date manipulation / comparison in my own code. The Java APIs state that java.util.Date is deprecated in favour of it. You can pass in a java.util.Date using setTime. java.util.Calendar also has locales and timezones. It also has before and after methods. Joda is a heavily used Java date/time API, but it doesn't come included in the Domino server.
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39691000

http://stackoverflow.com/comment/39638102
score: 0
comment on: http://stackoverflow.com/q/25411055
has text: The problem is when running the program the data being displayed (which is setting up a series of progressbars and altering them based on voltage levels being read in on a separate thread) is super slow/choppy.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39766880
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25480229
has text: TCP won't notice a closed socket until you try to write to the stream.
score: 1

http://stackoverflow.com/a/25401109
answers question: http://stackoverflow.com/q/25400559
score: 1
type: Answer
has body: Reading the documentation, there is a way to pop the back stack based on either the transaction name or the id provided by commit. Using the name may be easier since it shouldn't require keeping track of a number that may change and reinforces the "unique back stack entry" logic. Since you want only one back stack entry per Fragment, make the back state name the Fragment's class name (via getClass().getName()). Then when replacing a Fragment, use the popBackStackImmediate() method. If it returns true, it means there is an instance of the Fragment in the back stack. If not, actually execute the Fragment replacement logic. private void replaceFragment (Fragment fragment){ String backStateName = fragment.getClass().getName(); FragmentManager manager = getSupportFragmentManager(); boolean fragmentPopped = manager.popBackStackImmediate (backStateName, 0); if (!fragmentPopped){ //fragment not in back stack, create it. FragmentTransaction ft = manager.beginTransaction(); ft.replace(R.id.content_frame, fragment); ft.addToBackStack(backStateName); ft.commit(); } }
accepted answer of: http://stackoverflow.com/q/25400559
downvote count: 0
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39737210
comment on: http://stackoverflow.com/q/25464425
type: Comment
type: QuestionComment
has text: You should at least post the JSON that you're sending. Also, read http://wiki.fasterxml.com/JacksonFAQDateHandling
score: 2

http://stackoverflow.com/q/25510707
tagged with: corba
has title: Add elements in ObjectList in Java using CORBA
type: AnsweredQuestion
has body: I have an unbounded sequence in the IDL file as follows : struct Info { string name; }; typedef sequence&lt;Info&gt; InfoList; InfoList search(in short length); ServantClass present in server implments the interface as follows. public Info[] search(short length) { Info[] infolist; for(int i =0; i&lt;= length; i++) { /* * I want to add/push a 'name' into infolist. * may be something like infolist.push() */ } } How can I push name elements into the info objet. Any suggestions?
score: 2
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25511362
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25511362
has comment: http://stackoverflow.com/comment/39827295
favorite count: 0
type: Question
tagged with: idl

http://stackoverflow.com/comment/39888339
has text: could you please tell me how exactly i could use it.
type: Comment
comment on: http://stackoverflow.com/a/25546573
score: 0
type: AnswerComment

http://stackoverflow.com/a/25391790
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/39642998
answers question: http://stackoverflow.com/q/25391540
downvote count: 0
has body: you are getting NPE on String Egen = Rgen.getOnItemSelectedListener().toString(); You need to get the spinner value before you access it: You can get the spinner value by using code like below: Rgen.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) { Object item = parent.getItemAtPosition(pos); } public void onNothingSelected(AdapterView&lt;?&gt; parent) { } });

http://stackoverflow.com/a/25454181
type: Answer
answers question: http://stackoverflow.com/q/25452832
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25452832
upvote count: 2
has body: Use Connection&lt;Message&gt;: public abstract class Message { private transient Connection&lt;Message&gt; conn; ... }

http://stackoverflow.com/q/25541591
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39880300
downvote count: 0
score: 1
upvote count: 1
tagged with: java
answer count: 1
has title: Converting XML text to many different classes
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
has body: My issue is converting text within a field to a specific class (for purposes of launching different Activities). My XML file will be expanded into two different classes. However, each object will have a reference to another class (which is an Activity), and this reference is unique for each item in the XML file. So, it will look similar to the following, albeit with more properties: ActivityA.class ActivityA1.class ActivityA2.class ActivityB.class ActivityB1.class In the end, I'm trying to mimic AndroidManifest.xml file in a way. This XML file will be parsed then eventually turned into an ExpandableListView on my Navigation Drawer. Ultimately, I'm trying to avoid coding in every detail of the menu, and would rather also have it all in one place. The classes look similar to the following: public class NavListGroup { // Id for this group, for later matching private int mGroupId; // The displayed name of this Group private String mGroupName; // As needed for now, only launches an activity // Determines the destination private Class mActivityDestination; // Easily determines if the group has children under it private boolean mHasChildren = false; // Holds all the children items that belongs under this group private List<NavListChild> mChildrenList; } public class NavListChild { // Id for this child item, for later matching private int mChildId; // The displayed name of this child item private String mChildName; // As needed for now, only launches an activity // Determines the destination private Class mActivityDestination; } (The XML also holds the ID as well, if I still need it in the end) The reason for needing the member Class variable is that, once the group or child item is clicked, an intent will be launched- however, every item has a different activity/class. I could use a master list [matched via Ids to classes in a second list that's coded directly in], but that would go against the purpose of making the XML file in the first place. I've tried searching everywh…
has answer: http://stackoverflow.com/a/25542244
accepted answer: http://stackoverflow.com/a/25542244
tagged with: android
has comment: http://stackoverflow.com/comment/39880546
has comment: http://stackoverflow.com/comment/39879898
has comment: http://stackoverflow.com/comment/39879776
has comment: http://stackoverflow.com/comment/39880101

http://stackoverflow.com/a/25523721
accepted answer of: http://stackoverflow.com/q/25523585
has body: Dont reinvent the wheel. Try cron.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/25523585
has comment: http://stackoverflow.com/comment/39877425
type: AcceptedAnswer
score: 1
downvote count: 1

http://stackoverflow.com/comment/39799377
has text: If he is using a setter outside the constructor this will not work.
comment on: http://stackoverflow.com/a/25497847
type: AnswerComment
score: 3
type: Comment

http://stackoverflow.com/a/25413152
downvote count: 0
has body: A URL in itself is not SOAP or REST, it's a URL. (are the adjectives SOAPy and RESTful?) First, the example of your REST resource: http://localhost:8080/axis2/services/SalaryService/getSalary?name=zhangsan looks you're building some type RPC over HTTP, like your trying to use quasi-REST structure to implement a remote function calls. Many would not consider this good REST. SOAP is an XML encoded messaging system implemented over some transport layer. SOAP is not limited to HTTP for transport while REST is by it's nature. The fact you can HTTP for transport for SOAP via URLs and structure those URLs however you want is inconsequential. Also, the fact that most SOAP APIs are probably mostly implemented across HTTP in reality is also irrelevant. REST is a concept of using the HTTP verbs (PUT, GET, POST, etc...) and response codes as they are intended as the protocol to access and control resources. This includes for creation, modification, deletion, etc... of those resources. The structure of a SOAP url might in fact look exactly like a REST api, but with REST, the structure should strongly reflect the logical structure of the resource. You don't have to to be fully RESTful, but if not your REST API wouldn't be developer friendly. SOAP isn't necessarily required to have nice urls that reflect data structure as you can provide a WSDL which outlines and can describe the soap services available with just about any URL structure you use. In fact, I've seen quite a few totally acceptable SOAP services that had urls to that seem to be arbitrarily dropped in over the course of time, not reflecting any type of structure.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25413035
score: 4
answers question: http://stackoverflow.com/q/25413035
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/39642118
has comment: http://stackoverflow.com/comment/39642212

http://stackoverflow.com/q/25508735
tagged with: proguard
type: Question
linked to: http://stackoverflow.com/q/23353173
answer count: 2
has comment: http://stackoverflow.com/comment/39820433
has comment: http://stackoverflow.com/comment/39823096
accepted answer: http://stackoverflow.com/a/25627329
downvote count: 2
has title: can't find referenced method 'android.app.RemoteInput[] getRemoteInputs()' in class android.app.Notification$Action
has comment: http://stackoverflow.com/comment/39822653
has comment: http://stackoverflow.com/comment/39821890
has comment: http://stackoverflow.com/comment/39820859
has comment: http://stackoverflow.com/comment/39822151
type: AnsweredQuestion
has body: I am kind of stuck from past 1 week from this issue. I am trying to export my android app for final release but it gives following errror while exporting. Proguard returned with error code 1. See console [2014-08-26 19:55:11 - ] Note: there were 1281 duplicate class definitions. [2014-08-26 19:55:11 - ] Warning: android.support.v4.app.NotificationCompatApi20: can't find referenced method 'android.app.RemoteInput[] getRemoteInputs()' in class android.app.Notification$Action [2014-08-26 19:55:11 - ] Warning: android.support.v4.app.NotificationCompatApi20: can't find referenced method 'android.os.Bundle getExtras()' in class android.app.Notification$Action [2014-08-26 19:55:11 - ] Warning: android.support.v4.app.NotificationCompatApi20: can't find referenced class android.app.Notification$Action$Builder [2014-08-26 19:55:11 - ] Warning: android.support.v4.app.NotificationCompatApi20: can't find referenced class android.app.Notification$Action$Builder [2014-08-26 19:55:11 - ] Warning: android.support.v4.app.NotificationCompatApi20: can't find referenced class android.app.Notification$Action$Builder [2014-08-26 19:55:11 - ] Warning: android.support.v4.app.NotificationCompatApi20: can't find referenced class android.app.Notification$Action$Builder [2014-08-26 19:55:11 - ] Warning: android.support.v4.app.NotificationCompatApi20: can't find referenced class android.app.Notification$Action$Builder [2014-08-26 19:55:11 - ] Warning: android.support.v4.app.NotificationCompatApi20: can't find referenced method 'java.lang.String getGroup()' in class android.app.Notification [2014-08-26 19:55:11 - ] Warning: android.support.v4.app.NotificationCompatApi20: can't find referenced method 'java.lang.String getSortKey()' in class android.app.Notification I am using below entries in my proguard-project.txt file. -keepclassmembers class fqcn.of.javascript.interface.for.webview { public *; } -keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault -keepclassmembers class * { @…
has comment: http://stackoverflow.com/comment/39821331
upvote count: 3
score: 1
tagged with: android
tagged with: java
possible better answer: http://stackoverflow.com/a/25589725
has comment: http://stackoverflow.com/comment/39820482
has answer: http://stackoverflow.com/a/25627329
has comment: http://stackoverflow.com/comment/39823059
has answer: http://stackoverflow.com/a/25589725
tagged with: eclipse
favorite count: 0

http://stackoverflow.com/q/25490593
tagged with: java
answer count: 1
has body: Using the Java SDK, I have my application that I need to input domain name from the UI. However my question is if it is possible for rhc alias to be called from Java code? rhc alias proxy www.xyz.com
type: Question
tagged with: openshift-client-tools
accepted answer: http://stackoverflow.com/a/25490794
has answer: http://stackoverflow.com/a/25490794
tagged with: dns
tagged with: openshift
tagged with: cname
has title: Run "rhc alias" in Java
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25410483
accepted answer: http://stackoverflow.com/a/25418381
score: 3
tagged with: thymeleaf
has answer: http://stackoverflow.com/a/25418381
upvote count: 3
has body: I have a &lt;select&gt; tag in HTML and need to generate options from 1 to 53 and then pick one I'm sending with the doPost method. I tried to use the solution I found here: http://forum.thymeleaf.org/generating-content-for-select-programatically-td4024742.html, &lt;select name="week_scroll" style="width: 70px; height: 27px"&gt; &lt;option th:each="n : ${#numbers.sequence(1,53)" th:text="${n}" /&gt; &lt;/select&gt; but I get an error: org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as each: "n : ${#numbers.sequence(1,53)" also, what th: tag should I use to select from the list once it's been generated?
tagged with: java
answer count: 1
downvote count: 0
tagged with: drop-down-menu
has comment: http://stackoverflow.com/comment/39648172
has title: Thymeleaf tag generating options (numbers)
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/html
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/comment/39734549
comment on: http://stackoverflow.com/a/25462686
type: Comment
score: 0
type: AnswerComment
has text: As you didn't speak of serialization in your original post, I didn't either in my answer :-) - just edited ...

http://stackoverflow.com/comment/39610983
has text: B b = c; this assignment will happen at run time right.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25396444
score: 0

http://stackoverflow.com/a/25446289
answers question: http://stackoverflow.com/q/25445918
type: Answer
has body: You need to understand generic and type-casting first. As far as your question is concerned, Object Class stood on top level in inheritance, means Object is the parent class of All java classes. So you can cast any object in into Object class with out casting, but when you need to get you object back in its actual class you have to cast it. like String str = (String) netPara.get(key); you need to look into polymorphism, casting, and generic concepts. Generic come to solve the problem you are facing right now.
score: 0

http://stackoverflow.com/comment/39721412
comment on: http://stackoverflow.com/q/25455878
has text: *Post your stack trace from the crash.*
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39805734
comment on: http://stackoverflow.com/q/25501217
type: QuestionComment
type: Comment
score: 0
has text: 1) See also [`AbstractButton.setMargin(Insets)`](http://docs.oracle.com/javase/8/docs/api/javax/swing/AbstractButton.html#setMargin-java.awt.Insets-) 2) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example).

http://stackoverflow.com/a/25503180
has body: A java application is never single threaded (Garbage Collector thread among other). So you always end up with several thread. Moreover, Linux implement thread as Light-weight process therefore, each Java thread will appear as a process with a unique PID in htop.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39809813
downvote count: 0
upvote count: 7
has comment: http://stackoverflow.com/comment/39812935
has comment: http://stackoverflow.com/comment/39810099
has comment: http://stackoverflow.com/comment/39810187
has comment: http://stackoverflow.com/comment/39809938
type: Answer
has comment: http://stackoverflow.com/comment/39812708
accepted answer of: http://stackoverflow.com/q/25502812
answers question: http://stackoverflow.com/q/25502812
score: 7

http://stackoverflow.com/comment/125106867
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25415005
has text: @apangin How were you able to find the address range corresponding to a particular dll?

http://stackoverflow.com/a/25499814
has body: With the Java 8 Stream api you can do this very easily. Assuming the array is not primitive: public &lt;T extends Comparable&lt;? super T&gt;&gt; T max(final T[] array) { return Stream.of(array).max(naturalOrder()).get(); } This forces the object in the array to implement Comparable to itself or some superclass of itself - i.e. it has a "natural order". With a primitive array, Java 8 has IntStream, LongStream and DoubleStream which can be used like so: public long max(final long[] array) { return LongStream.of(array).max().getAsLong(); } Note that both these methods with throw a NoSuchElementException if an empty array is passed - this is by design. There is no sensible default to return when finding the max() of an empty array and Java 8 therefore returns a Optional[XXX] which can be used to determine if a result was calculated.
has comment: http://stackoverflow.com/comment/39839089
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25499550

http://stackoverflow.com/q/25478444
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25478475
upvote count: 2
has title: Getting the value of a super class field
accepted answer: http://stackoverflow.com/a/25478465
possible better answer: http://stackoverflow.com/a/25478497
has answer: http://stackoverflow.com/a/25478478
has answer: http://stackoverflow.com/a/25478465
has answer: http://stackoverflow.com/a/25478497
answer count: 6
has comment: http://stackoverflow.com/comment/39763318
tagged with: inheritance
has comment: http://stackoverflow.com/comment/39763217
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25478489
score: 1
tagged with: java
has body: In the following code, super.type brings the value of this.type. // http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=303&amp;p_certName=SQ1Z0_803 class Feline { public String type = "f "; public void hh(){ System.out.print("FFFFF ");} } public class Cougar extends Feline { public void hh(){ super.hh(); this.type = "c "; System.out.print("CCCCC "+this.type + super.type); } public static void main(String[] args) { new Cougar().hh(); } } How can i get the value of super.type in the descendant class ? TIA.
has answer: http://stackoverflow.com/a/25478544
downvote count: 1

processbuilder
tags question: http://stackoverflow.com/q/25434401
tags question: http://stackoverflow.com/q/25508024
tag name: processbuilder
tags question: http://stackoverflow.com/q/25403765
type: Tag

http://stackoverflow.com/comment/39824175
type: Comment
type: AnswerComment
score: 0
has text: Its output from some server,that indicate some problem during loading data in it.It always contain "!!!" symbol before error,that's why i use `indexOf()` method@starf
comment on: http://stackoverflow.com/a/25509893

http://stackoverflow.com/q/25495912
has answer: http://stackoverflow.com/a/70420306
type: UnansweredQuestion
tagged with: mocking
has answer: http://stackoverflow.com/a/25507716
tagged with: java
downvote count: 0
answer count: 3
score: 17
favorite count: 0
upvote count: 17
has title: Matching an array of Objects using Mockito
type: Question
has body: I'm trying to set up a mock for a method that takes an array of Request objects: client.batchCall(Request[]) I've tried these two variations: when(clientMock.batchCall(any(Request[].class))).thenReturn(result); ... verify(clientMock).batchCall(any(Request[].class)); and when(clientMock.batchCall((Request[])anyObject())).thenReturn(result); ... verify(clientMock).batchCall((Request[])anyObject()); But I can tell the mocks aren't being invoked. They both result in the following error: Argument(s) are different! Wanted: clientMock.batchCall( &lt;any&gt; ); -&gt; at com.my.pkg.MyUnitTest.call_test(MyUnitTest.java:95) Actual invocation has different arguments: clientMock.batchCall( {Request id:123}, {Request id:456} ); Why does the matcher not match the array? Is there a special matcher I need to use to match an array of objects? The closest thing I can find is AdditionalMatches.aryEq(), but that requires that I specify the exact contents of the array, which I'd rather not do.
tagged with: mockito
has answer: http://stackoverflow.com/a/47661024

http://stackoverflow.com/comment/39822573
has text: The absolute path is: /restful/src/main/java/com/project/cc/restful/resources/file.json
comment on: http://stackoverflow.com/a/25509535
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25536181
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39878532
has body: Something like this!? Start by creating your own subclass of JTextPane. Implement the draw method and use the FontMetrics from the Graphics Context to get the height of your text. public class MyTextPane extends JTextPane { @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setColor(new Color(255, 0, 0, 128)); FontMetrics fm = g2.getFontMetrics(); int textHeight = fm.getHeight(); for (int i = textHeight; i &lt; getHeight(); i += (6 * textHeight)) { g2.drawLine(0, i + 1, getWidth(), i + 1); } g2.dispose(); } }
score: 3
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25535277
answers question: http://stackoverflow.com/q/25535277

http://stackoverflow.com/comment/39799325
type: Comment
has text: Making the relationship bidirectional is a big problem in this case?
comment on: http://stackoverflow.com/q/25497597
score: 0
type: QuestionComment

http://stackoverflow.com/a/25535536
answers question: http://stackoverflow.com/q/25528634
downvote count: 0
has comment: http://stackoverflow.com/comment/39881910
has body: Store all the sockets in a List before submitting them to the pool. Then the shutdown thread can call close() on all the sockets, which should cause the blocked threads to throw SocketExceptions.
upvote count: 1
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39883302
has comment: http://stackoverflow.com/comment/39880428

http://stackoverflow.com/a/25501767
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25501549
has body: It is because break will break the iteration of the for loop, and exit out of loop immediately. You should change your design a bit. From what I understand you are trying to achieve (Assigning "a" to the first null element encountered and stop, print all elements in the array) following should work:- public class CheckArrayElementIsNull { public static void main(String[] args) { String[] arr = new String[3]; boolean flag=true; //use a flag that will check if null is encountered for(int i = 0; i &lt; arr.length; i++) { if(arr[i] == null &amp;&amp; flag) { // first time flag will be true arr[i] = "a"; flag=false; //set flag to false , to avoid further assignment of 'a' to null values } System.out.println(i + "="+ arr[i]); //print array } } }
has comment: http://stackoverflow.com/comment/39806509
type: Answer
has comment: http://stackoverflow.com/comment/39806399
score: 0
accepted answer of: http://stackoverflow.com/q/25501549

http://stackoverflow.com/comment/39773872
has text: it will have to have a entry for every possible combination of the two? how it is possible, plz explain
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25441063
type: AnswerComment

http://stackoverflow.com/q/25497548
has title: LibGDX - Multiple Console errors in TexureRegion
tagged with: java
has body: Heres the main chunk of code. All I'm trying to do is get a simple image to be displayed as the background of the game and after 10 hours of research I still can't get it to get it to work. public class SlingshotSteve implements ApplicationListener { // Creates our 2D images private SpriteBatch batch; private TextureRegion backgroundTexture; @Override public void create() { new Texture(Gdx.files.internal("background.jpg")); backgroundTexture = new TextureRegion(backgroundTexture, 20, 20, 50, 50); } @Override public void render() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(backgroundTexture, 0, 0); batch.end(); } Heres the Console error that I'm receiving: Exception in thread "LWJGL Application" java.lang.NullPointerException at com.badlogic.gdx.graphics.g2d.TextureRegion.setRegion(TextureRegion.java:118) at com.badlogic.gdx.graphics.g2d.TextureRegion.&lt;init&gt;(TextureRegion.java:70) at com.dakotapederson.slingshotsteve.SlingshotSteve.create(SlingshotSteve.java:21) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) I'm new at this and I'm taking this slow so please explain the issue with as much clarity as possible.
accepted answer: http://stackoverflow.com/a/25500100
type: Question
has answer: http://stackoverflow.com/a/25500100
answer count: 1
has comment: http://stackoverflow.com/comment/39802184
type: AnsweredQuestion
score: 0
tagged with: libgdx

http://stackoverflow.com/comment/39631931
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25407935
has text: +1 Wundwin Born. HashMap and TreeMap are completely different in terms of behaviour and performances and don't fit to the same use cases. Go check the doc for further information, making good using of the Java Collection API is important.

http://stackoverflow.com/a/25415229
has body: The handler that ends up submitting the JSP view must add a model (request) attribute with the name transaction, so that this &lt;form:form commandName="transaction" action="login/"&gt; can use it as a template to construct &lt;input&gt; elements. Currently, you are not doing that. The easiest solution would be to add a handler method to your TransactionController class which will return your JSP view's name. The @ModelAttribute annotated method will take care of the above.
answers question: http://stackoverflow.com/q/25415107
has comment: http://stackoverflow.com/comment/39646145
has comment: http://stackoverflow.com/comment/39646073
type: Answer
has comment: http://stackoverflow.com/comment/39646129
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39646177

http://stackoverflow.com/comment/39722232
type: Comment
has text: I am going to accept this answer. My other issue was I need to use this.cordova.getActivity().getApplicationContext() instead of just getApplicationContext(), now.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25440153

http://stackoverflow.com/a/25390545
score: 8
upvote count: 8
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/79242805
has comment: http://stackoverflow.com/comment/78923894
downvote count: 0
has body: Aha, I found this idea, which depends only on the svnversion command-line utility in SVN. <exec executable="svnversion" outputproperty="svnversion" /> <echo message="SVN Version: ${svnversion}"/> Here's where it captures the version in an ant property: <exec executable="svnversion" outputproperty="svnversion" />
accepted answer of: http://stackoverflow.com/q/25390200
type: Answer
answers question: http://stackoverflow.com/q/25390200

http://stackoverflow.com/comment/39838801
type: QuestionComment
has text: okay i shouldve added the whole code
comment on: http://stackoverflow.com/q/25518974
score: 0
type: Comment

http://stackoverflow.com/q/25531025
linked to: http://stackoverflow.com/q/289727
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39883858
tagged with: parameter-passing
tagged with: persistence
has title: Java persistence: named queries. Multiple parameters changes boolean values to int?
has comment: http://stackoverflow.com/comment/39882357
score: 0
tagged with: named-parameters
answer count: 0
tagged with: java
type: Question
has body: I'm an amateur programmer and I'm having trouble with the java eclipse persistence named queries. I have an entity class. In this class I have created named queries. With the ClientInformation.getList I have two parameters. One on active (Boolean) and one on type (int). When I remove either one it works like a charm, but when I try them both it transforms the boolean value to an integer. Entity class package datamodel; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; @Entity @Table(name = "CLIENT_INFORMATION") @XmlRootElement @NamedQueries({ @NamedQuery(name = "ClientInformation.getList", query = "SELECT c.ciName FROM ClientInformation c WHERE " + "(c.ciActive = true or c.ciActive = :ciActive) AND " + "(:ciType = 0 OR c.ciType = :ciType)"), @NamedQuery(name = "ClientInformation.getID", query = "SELECT c.ciId FROM ClientInformation c WHERE c.ciName like :ciName"), @NamedQuery(name = "ClientInformation.findAll", query = "SELECT c FROM ClientInformation c"), @NamedQuery(name = "ClientInformation.findByCiId", query = "SELECT c FROM ClientInformation c WHERE c.ciId = :ciId"), @NamedQuery(name = "ClientInformation.findByCiType", query = "SELECT c FROM ClientInformation c WHERE c.ciType = :ciType")}) public class ClientInformation implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "CI_ID") private Integer ciId; @Lob @Column(name = "CI_NAME", unique=true) private String ciName; @Lob @Column(name = "CI_ADDRESS") private String ciAddress; @Lob @Column(name = "CI_AREACODE") private String c…
has comment: http://stackoverflow.com/comment/39860411

http://stackoverflow.com/q/25513428
type: UnansweredQuestion
has title: Insert ScrollView into layout
tagged with: android
score: 0
has body: i'm tring to add a ScrollView to this layout but when i add it the Button is positioned over the last EditText and i don't understand why. Anyone can help me to understand why and how can i fix? thanks in advance. &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:fitsSystemWindows="true"&gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/titolo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_marginLeft="20dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:fontFamily="sans-serif-light" android:textSize="20sp" android:text="Titolo"/&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/titolo" android:layout_alignStart="@+id/titolo" android:layout_below="@+id/titolo" android:layout_marginRight="20dp" android:layout_marginEnd="20dp" android:ems="10"/&gt; &lt;TextView android:id="@+id/album" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginLeft="20dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_below="@+id/editText1" android:fontFamily="sans-serif-light" android:textSize="20sp" android:text="Album"/&gt; &lt;EditText android:id="@+id/editText2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/album" android:layout_alignStart="@+id/album" android:layout_below="@+id/album" android:layout_marginRight="20dp" android:layout_…
tagged with: java
has answer: http://stackoverflow.com/a/25513465
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
type: Question

http://stackoverflow.com/q/25532469
has comment: http://stackoverflow.com/comment/39862994
tagged with: java
has title: web project is not working on localhost
has comment: http://stackoverflow.com/comment/39863366
tagged with: tomcat
type: Question
has comment: http://stackoverflow.com/comment/39863996
has body: I have a Java web project which has been developed in another machine and I imported it to in my Eclipse. Actually my Eclipse is Spring Tool Suite Bundle. After building my project successfully, I tried to access it using following URL. http://localhost:8081/ It does not show anything and keeps loading. I have configured 8081 as my port number in server.xml file and I have given it in the build.properties file as well. It is like this appserver.home=C:/apache-tomcat-8.0.11 tomcat.manager.url=http://localhost:8081/admin server is working fine. The project is originally built using tomcat 6, but I am using tomcat 8. Could someone please help me to overcome this issue. Thank you all! server.xml file <?xml version='1.0' encoding='utf-8'?> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
type: UnansweredQuestion
tagged with: spring
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39874980
score: 0
has comment: http://stackoverflow.com/comment/39863255
has comment: http://stackoverflow.com/comment/39863346
answer count: 0

http://stackoverflow.com/comment/39738191
type: Comment
type: QuestionComment
has text: A `TreeMap<Integer, Article>`? Although price would have to be unique. You can also search a `TreeSet` by using a "template object" - use it to find the next element higher or lower than the template.
comment on: http://stackoverflow.com/q/25465005
score: 0

http://stackoverflow.com/comment/39654274
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25419891
has text: @Mustafasabir no i dont try it because of the complexity.. i will try it later if there is no way out.. is there any other way that i can try without re-installing glassfish sir?
score: 0

http://stackoverflow.com/comment/39762679
type: QuestionComment
comment on: http://stackoverflow.com/q/25477939
score: 2
type: Comment
has text: If using sed isn't a requirement...what about just using an IDE like eclipse, netbeans, or intellij? They have refactoring features that would allow you to do this without writing a script. While learning to write the script is a worth while investment this may be better solved long term with an IDE.

http://stackoverflow.com/comment/39842273
comment on: http://stackoverflow.com/q/25520980
score: 1
type: Comment
has text: I am actually surprised it compiles rather than say "ambiguous method call".
type: QuestionComment

http://stackoverflow.com/q/25409232
answer count: 1
has comment: http://stackoverflow.com/comment/39634765
favorite count: 0
tagged with: arraylist
type: AnsweredQuestion
has title: Extracting Data from an ArrayList
has comment: http://stackoverflow.com/comment/39634925
tagged with: java
downvote count: 3
score: -1
has body: I am trying to code a very simple blackjack game and I am currently stuck at a point where I am trying to determine a "winner". I have an ArrayList which represents a deck of cards (deckOfCards) and I have an ArrayList that represents the cards dealt to n players (playersCards). The idea of the ArrayList, playersCards, is that up to every 6th spot of the list represents a a different player's hand. For example, if only 2 players were playing it would look like this. playersCards[1,2,6,8,6,10,4,6,5,6,3,9] And that list would split into, player1's hand [1,2,6,8,6,10] and player2's hand [4,6,5,6,3,9]. I am having trouble splitting the playersCards arrayList into n different lists like so. Any help would be appreciated!
has answer: http://stackoverflow.com/a/25409348
type: Question
accepted answer: http://stackoverflow.com/a/25409348
upvote count: 2
has comment: http://stackoverflow.com/comment/39634443

http://stackoverflow.com/q/25490676
favorite count: 0
score: 1
tagged with: java
has title: crawling mutiple websites concurrently in single program
has body: 1.how to crawl more than 2 sites at a same time in single program 2.How to get in inUrl in implemented class of Runnabkle 1.List inUrl=new ArrayList(); System.out.println("Numof url"); final int urlSize=scanner.nextInt(); int count =0; while (count &lt; urlSize) { System.out.println("Enter Name of url"); inUrl.add(scanner.next()); count++; } ExecutorService executor = Executors.newFixedThreadPool(MYTHREADS); for (int i = 0; i &lt; inUrl.size(); i++) { //System.out.println(); System.out.println(inUrl.get(i)); Runnable worker = new MyRunnable(inUrl.get(i)); executor.execute(worker); executor.shutdown(); 2.public static class MyRunnable implements Runnable { public String inUrl; int s; int urlSize=s; List&lt;String&gt; Url; public MyRunnable(String inUrl) { this.inUrl = inUrl; } 3.how to repeat the crawling for Multiplesites in run method
type: Question
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25433175
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25431959
answers question: http://stackoverflow.com/q/25431959
upvote count: 26
score: 26
type: Answer
has body: I don't think there's any guarantee this will always work, but you can try setting focus to something that inherently doesn't accept keyboard input (such as a layout pane): import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class NoFocusTest extends Application { @Override public void start(Stage primaryStage) { TextField tf1 = new TextField(); tf1.setPromptText("Enter something"); TextField tf2 = new TextField(); tf2.setPromptText("Enter something else"); VBox root = new VBox(5, tf1, tf2); primaryStage.setScene(new Scene(root, 250, 150)); primaryStage.show(); root.requestFocus(); } }

apache-camel
tags question: http://stackoverflow.com/q/25460568
tags question: http://stackoverflow.com/q/25494929
tags question: http://stackoverflow.com/q/25446997
tags question: http://stackoverflow.com/q/25476291
tags question: http://stackoverflow.com/q/25546936
tags question: http://stackoverflow.com/q/25472136
tag name: apache-camel
tags question: http://stackoverflow.com/q/25463356
tags question: http://stackoverflow.com/q/25524582
tags question: http://stackoverflow.com/q/25484436
type: Tag

http://stackoverflow.com/q/25525510
tagged with: java
has comment: http://stackoverflow.com/comment/39850983
has answer: http://stackoverflow.com/a/25525562
accepted answer: http://stackoverflow.com/a/25525562
has answer: http://stackoverflow.com/a/25525648
linked to: http://stackoverflow.com/q/22622464
has answer: http://stackoverflow.com/a/25525560
has body: I have following class import java.util.Scanner; public class Album{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.println("How many songs do your CD contain?"); int songs = sc.nextInt(); String[] songNames = new String[songs]; for (int i = 0; i &lt; songs; i++) { System.out.println("Please enter song nr " + (i+1) + ": "); songNames[i] = sc.nextLine(); // What is wrong here? (See result for this line of code) // It is working when I use "sc.next();" // but then I can't type a song with 2 or more words. // Takes every word for a new song name. } System.out.println(); System.out.println("Your CD contains:"); System.out.println("================="); System.out.println(); for (int i = 0; i &lt; songNames.length; i++) { System.out.println("Song nr " + (i+1) + ": " + songNames[i]); } } } I can't type song name nr 1 because it Always shows first two together. Like this if I type 3: How many songs do your CD contain? 3 Please enter song nr 1: Please enter song nr 2:
possible better answer: http://stackoverflow.com/a/25525560
type: AnsweredQuestion
has title: reading input with Scanner; output is printed twice
tagged with: java.util.scanner
downvote count: 0
duplicate of: http://stackoverflow.com/q/7056749
upvote count: 1
tagged with: string
has answer: http://stackoverflow.com/a/25525605
linked to: http://stackoverflow.com/q/7056749
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25525622
answer count: 5
score: 1

http://stackoverflow.com/comment/39825551
comment on: http://stackoverflow.com/a/25511866
has text: That still won't work, since the division will have already been carried out as integer division. You get 0.0.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25544467
answers question: http://stackoverflow.com/q/25543692
type: Answer
score: 3
upvote count: 3
downvote count: 0
has body: If you want to develop the webservices using only Spring framework then Spring provides Spring MVC. Spring MVC has its own set of annotations. For e.g. "@RequestMapping". Spring MVC doesn't even adhere to the JAX-RS principles. There are various opensource frameworks (like Jersey) which supports "JAX-RS" and can be integrated with Spring. However, just in case you want to compare the Spring MVC with Jersey then below is the comparison. I personally support Jersey over SPring MVC as Spring MVC is not originally meant for webservices but for UI application. Same relative paths in multiple @Controllers not supported @ExceptionHandler is controller-centric Standard content negotiation can’t respond with a fixed response type (SPR-6937) JSR 303 bean validation not applied in @Controllers (SPR-6928, scheduled for 3.1) Formatting responses (i.e. Date) not working using Spring formatter annotations You cannot return a bean from an exception handler and expect it to be automatically serialized to xml or json based on the incoming accept header. HTH...

http://stackoverflow.com/comment/39806335
has text: 1.0.4 of what? If that's Spring Data MongoDB then ancient is probably the best way of describing that version :). The current version is 1.5.2.
type: Comment
comment on: http://stackoverflow.com/a/25447005
score: 0
type: AnswerComment

http://stackoverflow.com/a/25549747
answers question: http://stackoverflow.com/q/25548987
has body: Create a separate thread to call redirectSystemStreams, not the main thread. And you might want to increase your sleepDelay to at least 1000.
score: 0
type: Answer

xstream
tags question: http://stackoverflow.com/q/25415624
tags question: http://stackoverflow.com/q/25546413
tags question: http://stackoverflow.com/q/25524850
tags question: http://stackoverflow.com/q/25433862
type: Tag
tag name: xstream

http://stackoverflow.com/q/25536324
type: Question
has title: JButton does not appear on panel after i invoke the instantiation method
upvote count: 0
tagged with: layout
type: UnansweredQuestion
answer count: 1
tagged with: jcomponent
has comment: http://stackoverflow.com/comment/39870592
tagged with: swing
downvote count: 1
favorite count: 0
tagged with: jbutton
has body: Coded this in netbeans so I did not write all the code for the creation of the rest of the GUI myself. btn_Next is the button that is already on the panel private void place_Button() { btn_Next.setLocation((btn_Next.getX()+30), btn_Next.getY()); btn_Next.revalidate(); btn_Next.repaint(); JButton btn_Back = new JButton("Back"); pnl_Buttons.add(btn_Back); btn_Back.setPreferredSize(btn_Next.getPreferredSize()); btn_Back.setLocation((btn_Next.getX()- 100), btn_Next.getY()); btn_Back.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { switch_Works_Back(); } }); btn_Back.setVisible(true); pnl_Buttons.revalidate(); pnl_Buttons.repaint(); }
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25536615

http://stackoverflow.com/q/25539093
upvote count: 2
answer count: 1
downvote count: 0
has title: Android Studio: The following classes could not be instantiated: - com.google.android.gms.ads.AdView (Open Class, Show Exception)
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25539165
has comment: http://stackoverflow.com/comment/39875433
has comment: http://stackoverflow.com/comment/54575521
tagged with: android
tagged with: java
has body: The ads show up perfectly on the emulator but I still see this error on the device preview. This error blocks the preview with a rendering problems. I've tried everything in SO and nothing worked. Here is my .java: import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.AdView; public class ols_home extends ActionBarActivity { private AdView adView; private static final String AD_UNIT_ID = "ca-app-pub-8360704058410758/3766067820"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_ols_home); adView = new AdView(this); adView.setAdSize(AdSize.SMART_BANNER); adView.setAdUnitId(AD_UNIT_ID); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .build(); AdView adView = (AdView) this.findViewById(R.id.adView); adView.loadAd(adRequest); Button button = (Button) findViewById(R.id.button); Button button2 = (Button) findViewById(R.id.button2); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(ols_home.this, About_Section.class)); } }); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(ols_home.this, Explore.class)); } }); My Activity.xml: &lt;com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="ca-app-pub-8360704058410758/3766067820" ads:adSize="SMART_BANNER" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" /&gt; My Manifest.xml: &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" &lt;uses-feature android:name="android.hardware.touchscreen" /&gt; &lt;uses…
linked to: http://stackoverflow.com/q/24930782
tagged with: admob
accepted answer: http://stackoverflow.com/a/25539165
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/25411358
tagged with: textarea
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39639059
tagged with: webview
score: 1
upvote count: 1
has body: I need to put a value in a textarea of a website in a webview. So I tried several things : get the textarea with javascript : something like webview1.loadUrl("javascript:document.getElementsByTagName('table')[0].children[0] .... But the desired textarea is in a iframe, and I don't know how to access it. Put a setOnTouchListener on my webview and paste from clipboard the desired value, but I don't know how to simulate a CTRL+V Parse the website with Jsoup, but I cannot get the html after authenticaton (Jsoup authentication failed) Any other ideas ?
has comment: http://stackoverflow.com/comment/39639649
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/1452871
answer count: 0
linked to: http://stackoverflow.com/q/25384534
has title: Put text inside a textarea in a webview

http://stackoverflow.com/comment/39817657
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25507295
type: Comment
has text: Hashmap does seem the way forward. Thank you for your help.

http://stackoverflow.com/comment/39794643
has text: What makes an instance different from another one just because it is annotated you still need to store an instance in a accessible place in order to retrieve it later.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25494624

http://stackoverflow.com/a/25499543
has body: AFAIK, No, there is no library for this. First you'd need a list of all locales: http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html Then, for each Locale, format the current date accordingly: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html Then compare the output with the format you have. You might get more than one matches, through this method, since there are many countries that use the same masks for dates.
answers question: http://stackoverflow.com/q/25499425
type: Answer
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/25463098
has comment: http://stackoverflow.com/comment/39735591
has comment: http://stackoverflow.com/comment/39735921
has comment: http://stackoverflow.com/comment/39736045
has comment: http://stackoverflow.com/comment/39736022
has comment: http://stackoverflow.com/comment/39735936
has comment: http://stackoverflow.com/comment/39735775
type: Answer
score: 6
upvote count: 6
accepted answer of: http://stackoverflow.com/q/25463005
has comment: http://stackoverflow.com/comment/39735814
has body: color.getRGB() does not return a value from 0..255, it returns an integer composited of your red, green and blue values, including the Alpha value. Presumably, this alpha value is 0xFF, which makes any combined color end up as 0xFFrrggbb, or, as you got, a huge negative number when written in decimals. To see the "gray" level assigned, just check ColAvgVal. Note that a better formula to convert between RGB and grayscale is to use the PAL/NTSC conversion: gray = 0.299 * red + 0.587 * green + 0.114 * blue because "full blue" should be darker in grayscale than "full red" and "full green". Note: if you use this formula directly, watch out for floating point rounding errors. In theory, it should not return a value outside of 0..255 for gray; in practice, it will. So test and clamp the result. Another option which does not require testing-and-clamping per pixel, is to use an integer-only version: gray = (299 * red + 587 * green + 114 * blue)/1000; which should work with only a very small rounding error.
has comment: http://stackoverflow.com/comment/39735860
answers question: http://stackoverflow.com/q/25463005
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39735620

http://stackoverflow.com/comment/39846433
comment on: http://stackoverflow.com/a/25522414
type: Comment
has text: But in @Stateless I can´t save data in session for after use
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39862308
score: 0
comment on: http://stackoverflow.com/a/25531836
type: Comment
type: AnswerComment
has text: That could work! But how do I actually get the maxId integer out of the cursor?

http://stackoverflow.com/a/25403478
score: 0
has body: You can use MDC.put. eg MDC.put("threadName",Thread.currentThread().getName()); Using that you can put thread name. Using Log4j appender you can print the thread name [%X{threadName} in logs
type: Answer
answers question: http://stackoverflow.com/q/25403291

http://stackoverflow.com/comment/39717807
type: Comment
comment on: http://stackoverflow.com/q/25453916
has text: Can you give a more detailed description of the problem? Is the other developer just sending raw RGB bytes? What's the order of the bytes being received? Row-wise? Column-wise? Do you know the image width and height before hand? You can't start reconstructing an image or creating an image file based on raw RGB data without knowing how the data is being sent, and the size of the image itself.
score: 2
type: QuestionComment

http://stackoverflow.com/comment/39838303
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25518476
score: 0
has text: I have to write it like a lambda. Of course! Thanks, it works.

http://stackoverflow.com/a/25439912
has comment: http://stackoverflow.com/comment/39691938
has comment: http://stackoverflow.com/comment/39691390
has body: This would be my version of your code using JDK 8 streams, method references, and lambda expressions: server.findServices() .stream() .map(Service::getContainer) .filter(Engine.class::isInstance) .map(Engine.class::cast) .flatMap(engine -&gt; Arrays.stream(engine.findChildren())) .filter(Host.class::isInstance) .map(Host.class::cast) .flatMap(host -&gt; Arrays.stream(host.findChildren())) .filter(Context.class::isInstance) .map(Context.class::cast) .map(context -&gt; { ContextInfo info = new ContextInfo(context.getPath()); info.setThisPart(context.getThisPart()); info.setNotImportant(context.getNotImportant()); return info; }) .collect(Collectors.toList()); In this approach, I replace your if-statements for filter predicates. Take into account that an instanceof check can be replaced with a Predicate&lt;T&gt; Predicate&lt;Object&gt; isEngine = someObject -&gt; someObject instanceof Engine; which can also be expressed as Predicate&lt;Object&gt; isEngine = Engine.class::isInstance Similarly, your casts can be replaced by Function&lt;T,R&gt;. Function&lt;Object,Engine&gt; castToEngine = someObject -&gt; (Engine) someObject; Which is pretty much the same as Function&lt;Object,Engine&gt; castToEngine = Engine.class::cast; And adding items manually to a list in the for loop can be replaced with a collector. In production code, the lambda that transforms a Context into a ContextInfo can (and should) be extracted into a separate method, and used as a method reference.
has comment: http://stackoverflow.com/comment/39691811
has comment: http://stackoverflow.com/comment/39691181
has comment: http://stackoverflow.com/comment/39693732
downvote count: 0
has comment: http://stackoverflow.com/comment/39693853
has comment: http://stackoverflow.com/comment/39691443
has comment: http://stackoverflow.com/comment/39691206
score: 26
type: Answer
answers question: http://stackoverflow.com/q/25439277
has comment: http://stackoverflow.com/comment/39691258
upvote count: 26

http://stackoverflow.com/q/25473049
tagged with: java
has comment: http://stackoverflow.com/comment/39753433
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39753638
favorite count: 0
type: Question
tagged with: compiler-errors
score: 5
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/32932227
has comment: http://stackoverflow.com/comment/39753562
answer count: 5
has comment: http://stackoverflow.com/comment/39753327
has body: Everytime I try to export any of the projects from my workspace into a Java jar file, I end up with an error: JAR creation failed. See details for additional information. Class files on classpath not found or not accessible for: 'Server Manager/src/me/Zahach/ServerManager/main.java' And this error is repeated for every class in my project. I tried reinstalling Eclipse, that didn't work. I then tried to recreate a project and drag and drop my packages into it, that didn't work either. What is going on?
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/39753408
possible better answer: http://stackoverflow.com/a/32932227
tagged with: export
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/56468731
has answer: http://stackoverflow.com/a/25512250
has answer: http://stackoverflow.com/a/40243799
accepted answer: http://stackoverflow.com/a/25512250
has answer: http://stackoverflow.com/a/46465086
has title: Unable to export any of my projects into a .jar file

http://stackoverflow.com/comment/39687403
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25437673
type: Comment
has text: Do you know how to create *any* Java array?

http://stackoverflow.com/q/25507614
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25507765
has title: Reading a txt file (weird symbols) JAVA
upvote count: 1
has answer: http://stackoverflow.com/a/25507807
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39820405
has comment: http://stackoverflow.com/comment/39818165
linked to: http://stackoverflow.com/q/6030744
linked to: http://stackoverflow.com/q/17066265
score: 1
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/5585826
linked to: http://stackoverflow.com/q/24106734
has body: im trying to read a txt file downloaded from an arduino server. I can download the file and save it on internal storage, but when i want to read it, i see weird symbols and i can't see all saved text, only 6 o 7 characters. I don't know what happen. public void downloadFile (String fileDownloadPath, String saveFilePath){ try{ File SaveFile = new File(saveFilePath); URL u= new URL ("http://169.254.0.1:44300/169.254.0.1"); URLConnection con=u.openConnection(); int lengthofContent=con.getContentLength(); DataInputStream DIStream = new DataInputStream(u.openStream()); byte [] buffer = new byte[2000]; DIStream.read(buffer); DIStream.close(); DataOutputStream DOStream = new DataOutputStream(new FileOutputStream(SaveFile)); DOStream.write(buffer); DOStream.flush(); DOStream.close(); System.out.println ("o"); hideProgressIndicator(); } catch (FileNotFoundException e){ hideProgressIndicator(); } catch (IOException e){ hideProgressIndicator(); } catch (Exception e){ } } when i want to read it i use this: private String readFile() { String result = "", line; try { BufferedReader br = new BufferedReader((new FileReader("/data/data/com.example.sensolog/files/LOL.txt"))); while((line = br.readLine()) != null) { result += line + "\n"; } System.out.println (result); br.close(); } catch(Exception e) { e.printStackTrace(); } return result ; } And the results are the followings : 08-26 15:38:11.498: I/System.out(30593): SERVIDORn�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������...
has comment: http://stackoverflow.com/comment/39817564
answer count: 2
has comment: http://stackoverflow.com/comment/39817543

http://stackoverflow.com/q/25533343
tagged with: jakarta-ee
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/39866319
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39864469
has comment: http://stackoverflow.com/comment/39864587
has body: My instances go down because of heap space issue frequently and when I take the thread dump it is always failing at Current CompileTask: **C2:8428** ! //The number will vary org.apache.poi.ss.util.SheetUtil.getColumnWidth(Lorg/apache/poi/ss/usermodel/Sheet;IZ)D (799 bytes) JavaThread "CompilerThread1" daemon [_thread_in_native, id=12321 This is a compiler thread and it is requesting for nearly 18gb of memory when it fails. We are using apache po version 3.8-beta4. I am not using getColumnWidth function anywhere but look like the autoSize method is calling this function. Any idea why this should request for 18gb of mem and why it is a compiler thread? The application server is Jboss 5
has comment: http://stackoverflow.com/comment/39878278
score: 0
tagged with: performance
answer count: 0
tagged with: java
tagged with: heap-dump
has title: Apache poi getColumn width is bringing the instance down
type: Question

http://stackoverflow.com/comment/39885027
comment on: http://stackoverflow.com/q/25544107
score: 1
type: Comment
type: QuestionComment
has text: what have you tried? what programming language are you using? maybe some snippets of what you've tried might help you in getting a relevant answer

http://stackoverflow.com/comment/39666440
has text: I still haven't tried conversion, b/c I'll first have to figure out table of contents updating. We have toc inside a template, which should be updated, after the data is applied. I thought XDocReport had these functionality, but it doesn't, and I'll have to build it from scratch.
type: AnswerComment
comment on: http://stackoverflow.com/a/25422717
score: 0
type: Comment

http://stackoverflow.com/comment/39706041
comment on: http://stackoverflow.com/a/25447717
type: Comment
score: 0
type: AnswerComment
has text: @JonK: Exactly my point: `if (!o instanceof test) return false` will *not* return with a false when `o` is a subclass of test.

http://stackoverflow.com/comment/41785799
score: 0
has text: It is a solution about "Java->C++->Java" chain implementation. Why not?
comment on: http://stackoverflow.com/a/26522377
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39621432
score: 0
type: Comment
has text: Thank you!It's finally starting to make a bit of sense haha :)
type: AnswerComment
comment on: http://stackoverflow.com/a/25401412

http://stackoverflow.com/q/25430160
tagged with: css-parsing
tagged with: css
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has body: I am trying to use CSS Parser in a java project to extract the CSS rules/DOM from a String of the text input. All the examples that I have come across take the css file as input. Is there a way to bypass the file reading and work with the string content of the css file directly. Because the class that I am working on gets only the string content of the css file and all the reading has already been taken care of. Right now I have this, where the 'cssfile' is the filepath for css file being parsed. InputStream stream = oParser.getClass().getResourceAsStream(cssfile); InputSource source = new InputSource(new InputStreamReader(stream)); CSSOMParser parser = new CSSOMParser(); CSSStyleSheet stylesheet = parser.parseStyleSheet(source, null, null); CSSRuleList ruleList = stylesheet.getCssRules(); System.out.println("Number of rules: " + ruleList.getLength()); Reference link
tagged with: parsing
type: Question
has title: CSS parser parsing string content
accepted answer: http://stackoverflow.com/a/25433254
linked to: http://stackoverflow.com/q/1513587
has answer: http://stackoverflow.com/a/25433254

http://stackoverflow.com/q/25453727
has body: i was following the navigation drawer training on android developers and the layout is causing an error and i added the support library so am not sure what is causing the problem &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;FrameLayout android:id="frag_container" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; &lt;ListView android:id="@+id/drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="@android:color/transperant" android:dividerHeight="0dp" android:background="#111"/&gt; &lt;/android.support.v4.widget.DrawerLayout&gt;
has comment: http://stackoverflow.com/comment/39727320
type: Question
has title: drawerlayout com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/xml
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39717248

http://stackoverflow.com/q/25396657
has comment: http://stackoverflow.com/comment/39611102
has comment: http://stackoverflow.com/comment/39611071
tagged with: java
tagged with: events
has answer: http://stackoverflow.com/a/25397608
has title: Not any listener for ServletConfig
tagged with: servlets
type: Question
has body: I have one question that while there is a listener for ServletContext events why there is none for ServletConfig events? Or if it is there kindly tell me what is it?
score: 0
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/a/25455169
has body: change this @Override public int getChildrenCount(int groupPosition) { return 0; } to this: @Override public int getChildrenCount(int groupPosition) { return this.childsList.get(groupPosition) .size(); } you returned childCount ,zero so you can see groups but no children.
has comment: http://stackoverflow.com/comment/39720758
has comment: http://stackoverflow.com/comment/39720487
type: Answer
has comment: http://stackoverflow.com/comment/39720644
score: 0
accepted answer of: http://stackoverflow.com/q/25454920
has comment: http://stackoverflow.com/comment/39720182
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39720261
has comment: http://stackoverflow.com/comment/39720193
answers question: http://stackoverflow.com/q/25454920
has comment: http://stackoverflow.com/comment/39720356
has comment: http://stackoverflow.com/comment/39720310

http://stackoverflow.com/q/25483296
has body: i'm following this tutorial right here Copied and past exact code, changed servlet's name and the mapping in web.xml as well, but when i try to login (as "admin", exists in mysql database), i get a blank page with the following url : http://localhost:8080/project6/LoginServdo?username=admin&amp;password=admin And nothing happens, if anyone encoutred this problem before, thank you in advance.
tagged with: servlets
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39771823
tagged with: mysql
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39772325
answer count: 2
has title: Blank page when using post method to send data from a jsp login form to a servlet
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25496328
has comment: http://stackoverflow.com/comment/39772526
downvote count: 0
tagged with: jsp
upvote count: 1
has answer: http://stackoverflow.com/a/25496441

http://stackoverflow.com/a/25462622
has body: The application icon and the home button are 2 different images. The application icon can be set directly in your manifest: <application android:icon="@drawable/ic_launcher" ...> And the home icon or the up indicator (as it's really called), can be changed by using overriding homeAsUpIndicator in your custom style: Of course you will need to use the custom theme for your specific Activities or the whole application (again in your manifest activity/application tags: android:theme="@style/AppTheme"
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25462475

http://stackoverflow.com/a/25512009
answers question: http://stackoverflow.com/q/25505870
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/39862127
type: Answer
has comment: http://stackoverflow.com/comment/64484169
has comment: http://stackoverflow.com/comment/39862211
has comment: http://stackoverflow.com/comment/39860087
has body: Java 8 and 7u40 and later include support for x86 AES intrinsics for the built-in SunJCE provider, but the feature is not enabled by default (it is). Search globals.hpp for "AES": product(bool, UseAES, false, \ "Control whether AES instructions can be used on x86/x64") \ ... product(bool, UseAESIntrinsics, false, \ "Use intrinsics for AES versions of crypto") \ You can enable the feature by passing the -XX:+UseAES -XX:+UseAESIntrinsics options to the virtual machine.
downvote count: 0

http://stackoverflow.com/a/25489814
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39821712
has body: You could use redis, which is a distributed cache that is simple to use. http://redis.io/ You can add key value pairs to the RAM based database, and you can set a time limit on when they should be expired. The cache does not persist to the harddisk though.
type: Answer
answers question: http://stackoverflow.com/q/25489716
score: 1

http://stackoverflow.com/q/25425873
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39664971
has comment: http://stackoverflow.com/comment/39665297
type: UnansweredQuestion
has title: Java PrintWriter not flushing full String
has comment: http://stackoverflow.com/comment/39665573
tagged with: io
has comment: http://stackoverflow.com/comment/39665064
tagged with: appfuse
has answer: http://stackoverflow.com/a/70970429
has body: Im using AJAX to retrieve a JSONP response of an external system, however the response is being (for the lack of a better work) truncated. My front-end page will make the AJAX call to the URL, my system will generate a response which is added to a PrintWriter and then flush the Printwriter. However the content returned is not complete. PrintWriter pw = response.getWriter(); pw.write(callBackFn); pw.write("(" + requestsJSON + ")"); pw.flush(); pw.close(); Please note that the response is approx 120 000 characters. Ive tried looking for a reason for the cut-off but have found nothing like it. EDIT public ActionForward getJSON(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { List requestList = RequestUtil.convertRequestsHashMapToRequestsList((HashMap)request.getSession().getServletContext().getAttribute(Constants.REQUESTS_CACHE_MAP)); String requestsJSON = ""; if (!requestList.isEmpty()) { Requests requestObj = (Requests) requestList.get(0); requestsJSON += "{\"key\":\"" + requestObj.getRequestId() + "\",\"value\":\"" + requestObj.getSubject() + "\"}"; for (int i = 1; i &lt; requestList.size(); i++) { requestObj = (Requests) requestList.get(i); requestsJSON += ",{\"key\":\"" + requestObj.getRequestId() + "\",\"value\":\"" + requestObj.getSubject() + "\"}"; } } requestsJSON = "{\"values\":["+requestsJSON+"]}"; String callBackFn = (String) request.getParameter("callback"); System.out.println("#### Character length: " + (callBackFn + "(" + requestsJSON + ")").length()); PrintWriter pw = response.getWriter(); pw.write(callBackFn); pw.write("(" + requestsJSON + ")"); pw.flush(); pw.close(); return null; } NOTE: The system that I've added the above method to is quite old and not maintained. it was created using AppFuse 1.8.2 (which uses Spring 2) and is running Java 1.4. Unfortunately the system wasn't written very well so updating to a later version of Java is not an option. With regards to how the returned…
score: 1
tagged with: java
answer count: 1
downvote count: 0
tagged with: printwriter
upvote count: 1

reflection
tags question: http://stackoverflow.com/q/25541152
tags question: http://stackoverflow.com/q/25494768
tags question: http://stackoverflow.com/q/25531141
tags question: http://stackoverflow.com/q/25515860
tags question: http://stackoverflow.com/q/25416662
tags question: http://stackoverflow.com/q/25522624
tags question: http://stackoverflow.com/q/25503454
tags question: http://stackoverflow.com/q/25494624
tags question: http://stackoverflow.com/q/25423132
tags question: http://stackoverflow.com/q/25487900
tags question: http://stackoverflow.com/q/25395443
tags question: http://stackoverflow.com/q/25499865
tags question: http://stackoverflow.com/q/25503697
tags question: http://stackoverflow.com/q/25407656
tags question: http://stackoverflow.com/q/25536211
tags question: http://stackoverflow.com/q/25546600
tag name: reflection
tags question: http://stackoverflow.com/q/25448104
tags question: http://stackoverflow.com/q/25464700
type: Tag
tags question: http://stackoverflow.com/q/25527480
tags question: http://stackoverflow.com/q/25492905

http://stackoverflow.com/a/25480397
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39766822
answers question: http://stackoverflow.com/q/25480229
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25480229
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39766901
has body: Try to do something like this: Create service for processing your heavy loop in new threads (manually created by you). When user hits URL in browser create thread with heavy loop in new thread (by processing service) and return to user some internal id of this thread (this id may be generated by you) which will allow you to identify this thread in service from point 1. Make some kind of pinger from client to server (for example on every 5 seconds client will ping processing service with thread id). Write last time of ping for this thread in thread-processing service. In thread-processing service from point 1, create next thread for checking each thread if ping was in last 5 seconds. If not - interrupt thread.

http://stackoverflow.com/a/25426452
type: Answer
has comment: http://stackoverflow.com/comment/39667593
score: 0
answers question: http://stackoverflow.com/q/25426094
has body: You can use the Quartz Scheduler,a simple cron api for Java
has comment: http://stackoverflow.com/comment/39666117
has comment: http://stackoverflow.com/comment/39716888

http://stackoverflow.com/comment/39830381
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25512011
has text: Thank you, how could I add implement an algorithm so that now the total questions answered is also considered, I.e. if u answer 75/100 correct that is a better score than 3/4 as it is more reliable due to a larger sample size?

http://stackoverflow.com/q/25501563
has comment: http://stackoverflow.com/comment/39806235
has title: Queue implementation with Generics in Java
tagged with: java
has comment: http://stackoverflow.com/comment/39805977
has answer: http://stackoverflow.com/a/25501893
tagged with: generics
tagged with: queue
type: Question
has comment: http://stackoverflow.com/comment/39806490
score: 0
has comment: http://stackoverflow.com/comment/39806880
has comment: http://stackoverflow.com/comment/39806201
has comment: http://stackoverflow.com/comment/39806290
answer count: 2
has answer: http://stackoverflow.com/a/25502311
has comment: http://stackoverflow.com/comment/39806429
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39806628
has comment: http://stackoverflow.com/comment/39806971
has comment: http://stackoverflow.com/comment/39805925
has comment: http://stackoverflow.com/comment/39807133
has body: trying to make an immutable queue and performing standard queue operations on it,using generics.the problem is i dont know much about generics :( please bear with me about the flow and structure of the code so far i have import java.lang.*; import.java.util.*; import java.util.NoSuchElementException; public class ImmutableQueue&lt;E&gt; { private final List&lt;E&gt; elmnts; public ImmutableQueue(List&lt;E&gt; elmnts) { this.elmnts = elmnts; return elmnts.newInstance(); } public ImmutableQueue() { elmnts = new LinkedList&lt;E&gt;(); } public ImmutableQueue&lt;E&gt; enqueue(E e) { if(e.equals("null")) throws IllegalArgumentException; List&lt;E&gt; copy = new LinkedList&lt;E&gt;(elmnts); copy.add(elmnts); copy.addlast(e); Iterator iterator = copy.iterator(); while(iterator.hasNext()) { Object prnt = itr.next(); System.out.println(prnt+" "); } } public ImmutableQueue&lt;E&gt; dequeue() { if (elmnts.size() == 0) { throw new NoSuchElementException(); } List&lt;E&gt; copy = new LinkedList&lt;E&gt;(elmnts); copy.add(elmnts); copy.remove(0); Iterator iterator = copy.iterator(); while(iterator.hasNext()) { Object prnt = itr.next(); System.out.println(prnt+" "); } } public E peek() { String fsel=elmnts.get(0); System.out.println("First Element in the Queue is "+fsel); return null; } public int size() { int size=0; Iterator iterator = elmnts.iterator(); while(iterator.hasNext()) { size++; } return size; } public static void main(String [] arg) { int a; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)) ; ImmutableQueue&lt;E&gt; imqu=new LinkedList&lt;E&gt;(); System.out.println("Create Queue/Add Elements to Queue ? ('N' or 'n' to stop)"); &lt;E&gt; e=br.readLine(); while(e!='n' || e!='N') { imqu.insert(e); } System.out.println(":: Queue Operations ::"); System.out.println("\n\n\n21.Enqueue\n2.Dequeue\n3.Peek\n4.size"); a=Integer.parseInt(br.readLine()); System.out.println("Choice"+a); switch(a) { case 1: System.out.println("Element to be Enqueued : "); &lt;E…
has comment: http://stackoverflow.com/comment/39806289

http://stackoverflow.com/comment/39668886
type: Comment
has text: sorry the question still stands once ive returned this how would i then get the menuItems back. I know how to do this with an array but this is new to me
comment on: http://stackoverflow.com/a/25427719
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39724662
type: AnswerComment
has text: Sorry I didn't catch an additional language specific issue separate from the question.
comment on: http://stackoverflow.com/a/25457633
score: 1
type: Comment

http://stackoverflow.com/comment/39883139
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25539921
type: QuestionComment
has text: Random shot: What's the default color of a Pixmap? Could it be the code's drawing black on black onto the Pixmap?

http://stackoverflow.com/comment/39812019
score: 0
type: Comment
type: QuestionComment
has text: I'd consider putting it in my classpath and reading it as a resource.
comment on: http://stackoverflow.com/q/25504928

http://stackoverflow.com/comment/39812046
has text: @BranislavLazic Yes. Sorry and thanks for figuring out the mistake. I updated the comment
type: Comment
comment on: http://stackoverflow.com/q/25504854
type: QuestionComment
score: 0

http://stackoverflow.com/q/25549733
has answer: http://stackoverflow.com/a/25550142
has comment: http://stackoverflow.com/comment/39894588
upvote count: 0
has comment: http://stackoverflow.com/comment/39896292
possible better answer: http://stackoverflow.com/a/25549851
tagged with: arrays
score: -3
has answer: http://stackoverflow.com/a/25550129
has comment: http://stackoverflow.com/comment/39894667
has comment: http://stackoverflow.com/comment/39894487
has comment: http://stackoverflow.com/comment/39894635
has comment: http://stackoverflow.com/comment/39896100
has answer: http://stackoverflow.com/a/25549851
has comment: http://stackoverflow.com/comment/39894619
tagged with: awt
has comment: http://stackoverflow.com/comment/39894561
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39896056
has comment: http://stackoverflow.com/comment/39894929
has comment: http://stackoverflow.com/comment/39896391
has comment: http://stackoverflow.com/comment/39894532
has answer: http://stackoverflow.com/a/25549857
accepted answer: http://stackoverflow.com/a/25550129
has comment: http://stackoverflow.com/comment/39896139
has comment: http://stackoverflow.com/comment/39894545
has comment: http://stackoverflow.com/comment/39895149
tagged with: java
has comment: http://stackoverflow.com/comment/39894720
has title: How can I stop my text array from flashing and switching in Java?
downvote count: 3
has comment: http://stackoverflow.com/comment/39894916
answer count: 4
has body: I am having a problem with my text array, the text keeps switching constantly. This is the code that I have so far for it: private void drawSplash(Graphics2D g) { if (displayed == false) { Random r = new Random(); String list; String items[] = { "Buggy!", "New Game!", "Roll up, roll up!", "Made from Scratch" }; int amount; amount = (int) (Math.random() * 25 + 1); list = items[r.nextInt(3 + 1)]; System.out.println(list); g.setFont(font2); g.setColor(Color.BLACK); g.drawString(list, 320, 240); displayed = true; } } I want to make it so that whenever the program is restarted, the string change. Can anyone help me with this please? It's really bugging me.
favorite count: 0
type: Question

http://stackoverflow.com/comment/39702016
type: QuestionComment
comment on: http://stackoverflow.com/q/25445981
score: 0
has text: Your question is very unclear then. I'm reading it as asking why your Terminal references Java 6 when you need Java 7 (ignore the '1.' bit, that's been irrelevant since Java 5 / 1.5 was introduced). If you're asking about 1.7 vs 7, there's no difference.
type: Comment

http://stackoverflow.com/q/25522391
tagged with: applet
answer count: 1
type: Question
has body: How do I go from the Eclipse project to making a file that will run the applet in a browser? From what I understand, I have to make it into a .jar file and then make an html file with the applet tag, like follows: &lt;html&gt; &lt;body&gt; &lt;applet name="TerisApplet.java" code = "TetrisApplet.jar"&gt; &lt;/applet&gt; &lt;/body&gt; &lt;/html&gt; I do this and I run into nothing but trouble. Right now I am receiving a ClassNotFoundException. What am I doing wrong? If someone can walk me through step by step from getting the Java Applet from Eclipse into an applet running over a browser, that would be awesome. This is for my own learning experience btw and not for school. I'm pretty good with Java I think but fairly new to applets.
has comment: http://stackoverflow.com/comment/39874128
accepted answer: http://stackoverflow.com/a/45188635
has comment: http://stackoverflow.com/comment/39874184
has answer: http://stackoverflow.com/a/45188635
has comment: http://stackoverflow.com/comment/39874181
tagged with: japplet
type: AnsweredQuestion
tagged with: classnotfoundexception
score: 0
tagged with: java
has title: How do I turn an applet I made in Eclipse into something that will run in a web browser?
tagged with: jar

http://stackoverflow.com/q/25515680
has comment: http://stackoverflow.com/comment/39833546
score: 0
has comment: http://stackoverflow.com/comment/39833137
has title: Unable to get string response from Spring mapping
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39834498
answer count: 1
has comment: http://stackoverflow.com/comment/39833085
has comment: http://stackoverflow.com/comment/39833165
has body: I've been working on a Spring based web project. Most of the endpoints are set to return XML, and they work just fine using a REST marshaller. As part of the project demonstration, I'd like to have a dashboard that displays the data in a more human readable format. Problem is, I can't get the endpoint to return a String. When I try to access the endpoint, I get the following error message: JBWEB000065: HTTP Status 406 - JBWEB000309: type JBWEB000067: Status report JBWEB000068: message JBWEB000069: description JBWEB000126: The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request 'Accept' headers. The mapping request code is as follows: @RequestMapping(value="/dash", method=RequestMethod.GET, headers="Accept=*/*",produces="text/plain") @ResponseBody public String customerPortal() { return "WEB-INF/jsp/Dash.jsp"; } The other (XML) endpoints work just fine, and the file itself exists. At this point, I'd settle for any way to transmit HTML to the browser, I don't need anything fancy, just a single file that won't run afoul of the AJAX single origin restrictions. I apologize if there's an easy solution to this, I've tried half a dozen different solutions and cannot find any way to get the server to send anything but XML. Edit: After removing the @ResponseBody, method, headers, and produces annotations, it now gives the following response: JBWEB000065: HTTP Status 500 - Could not resolve view with name '/WEB-INF/jsp/ScorpioDash.jsp' in servlet with name 'scorpio-restservice' JBWEB000309: type JBWEB000066: Exception report JBWEB000068: message Could not resolve view with name '/WEB-INF/jsp/ScorpioDash.jsp' in servlet with name 'scorpio-restservice' JBWEB000069: description JBWEB000145: The server encountered an internal error that prevented it from fulfilling this request. JBWEB000070: exception javax.servlet.ServletException: Could not resolve view with name '/WEB-INF/jsp/ScorpioDash.jsp' i…
has comment: http://stackoverflow.com/comment/39833394
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/39833358
has answer: http://stackoverflow.com/a/25516793
has comment: http://stackoverflow.com/comment/39835048
tagged with: java
has comment: http://stackoverflow.com/comment/39833427
tagged with: spring

http://stackoverflow.com/a/45086349
score: 0
has comment: http://stackoverflow.com/comment/79929677
has body: I am sure you are using Spring data with @RepositoryRestResource annotation @RepositoryRestResource public interface XX extends CrudRepository&lt;AA, String&gt; If you want to remove default HAL behavior you can add following annotaion param @RepositoryRestResource(exported = false) public interface XX extends CrudRepository&lt;AA, String&gt; Above configurition Spring Data REST to only expose rest endpoints for resources in the parent project, without having to explicitly annotate every repository in the dependency project. As per doc Hiding certain repositories, query methods, or fields You may not want a certain repository, a query method on a repository, or a field of your entity to be exported at all. Examples include hiding fields like password on a User object or similar sensitive data. To tell the exporter to not export these items, annotate them with @RestResource and set exported = false. For example, to skip exporting a Repository: @RepositoryRestResource(exported = false) interface PersonRepository extends CrudRepository&lt;Person, Long&gt; {}
answers question: http://stackoverflow.com/q/25431087
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/39841009
type: QuestionComment
comment on: http://stackoverflow.com/q/25520383
has text: So, where are you stuck?
type: Comment
score: 2

http://stackoverflow.com/q/25526465
linked to: http://stackoverflow.com/q/25252441
answer count: 1
linked to: http://stackoverflow.com/q/3873215
has body: This question is a follow up another question: Abstract class with default value I am trying to define a abstract Range class which will serve as the base implementation of a number of range classes. The intended use is irrelevant for this question, but so far I have: /** * Abstract generic utility class for handling ranges */ public abstract class Range&lt;T extends Number&gt; implements Collection&lt;T&gt;{ // Variables to hold the range configuration protected T start; protected T stop; protected T step; /** * Constructs a range by defining it's limits and step size. * * @param start The beginning of the range. * @param stop The end of the range. * @param step The stepping */ public Range(T start, T stop, T step) { this.start = start; this.stop = stop; this.step = step; } } (Irrelevant stuff omitted above) Now I want to implement Collection, so I implement Size as following in my abstract class: @Override public int size() { return (this.stop - this.start) / this.step; } But Number seems to be to general for it to work. Do I need to implement this in the subclasses, or is there an abstract way?
tagged with: abstract-class
has answer: http://stackoverflow.com/a/25526505
has comment: http://stackoverflow.com/comment/39851884
tagged with: java
has title: Math operators and Java Numbers
duplicate of: http://stackoverflow.com/q/3873215
type: Question
linked to: http://stackoverflow.com/q/23826149
score: 0
type: UnansweredQuestion

push
tags question: http://stackoverflow.com/q/25541349
tag name: push
type: Tag

http://stackoverflow.com/a/25442236
has comment: http://stackoverflow.com/comment/116041669
has comment: http://stackoverflow.com/comment/39698295
has comment: http://stackoverflow.com/comment/116898049
has comment: http://stackoverflow.com/comment/70931312
has comment: http://stackoverflow.com/comment/39698231
upvote count: 22
has body: you have to setup mirror nexus * http://internal/nexus/content/repositories/thirdparty google google http://google-maven-repository.googlecode.com/svn/repository then add internal & external repo nexus central central http://internal/nexus/content/repositories/thirdparty google google http://google-maven-repository.googlecode.com/svn/repository
downvote count: 0
type: Answer
score: 22
answers question: http://stackoverflow.com/q/25424338
has comment: http://stackoverflow.com/comment/71742643

http://stackoverflow.com/comment/39746007
comment on: http://stackoverflow.com/q/25468867
has text: Oops, I meant a2.m2() in both cases.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25478968
has comment: http://stackoverflow.com/comment/39764233
has comment: http://stackoverflow.com/comment/39765555
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/39764139
downvote count: 0
has body: Without looking the layout XML, and by reading the problem description that you want to take 2 numbers from user, I can only assume that those 2 EditTexts are empty when the activity is started. @Override protected void onCreate(Bundle savedInstanceState) { ... EditText wiekEditText = (EditText) findViewById(R.id.inWiek); EditText tspoczEditText = (EditText) findViewById(R.id.inTspocz); // edit text are still empty... int wiek = Integer.parseInt(wiekEditText.getText().toString()); // error occurs! int tspocz = Integer.parseInt(tspoczEditText.getText().toString()); ... } You probably want to parse the number after user interaction, perhaps by putting the code to OnClickListener, or TextWatcher This example is using OnClickListener. The calculation will be done after user clicks the button. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); // add 'final' final EditText wiekEditText = (EditText) findViewById(R.id.inWiek); final EditText tspoczEditText = (EditText) findViewById(R.id.inTspocz); // remove offending code final EditText tempWiekEdit = wiekEditText; TabHost tabHost = (TabHost) findViewById(R.id.tabHost); ... final Button Btn = (Button) findViewById(R.id.Btn); Btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // move the parsing code here int Tmax, RT; int wiek = Integer.parseInt(wiekEditText.getText().toString()); int tspocz = Integer.parseInt(tspoczEditText.getText().toString()); Tmax = 220 - wiek; RT = Tmax - tspocz; Wynik = 70*RT/100 + tspocz; Toast.makeText(getApplicationContext(),"blablabla"+ Wynik,Toast.LENGTH_SHORT).show(); } }); ... } -or- to prevent the error, put default number for the first time by adding android:text="0" on the layout XML. &lt;EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="number" android:ems="10" android:id="@+id/inTspocz" android:layout_marginTop="2…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39765066
has comment: http://stackoverflow.com/comment/39764272
has comment: http://stackoverflow.com/comment/39764380
accepted answer of: http://stackoverflow.com/q/25478857
has comment: http://stackoverflow.com/comment/39764307
has comment: http://stackoverflow.com/comment/39764648
type: Answer
answers question: http://stackoverflow.com/q/25478857
has comment: http://stackoverflow.com/comment/39765201
has comment: http://stackoverflow.com/comment/39765114

javascript
tags question: http://stackoverflow.com/q/25508378
tags question: http://stackoverflow.com/q/25499567
tags question: http://stackoverflow.com/q/25430104
tags question: http://stackoverflow.com/q/25474527
tags question: http://stackoverflow.com/q/25455977
tags question: http://stackoverflow.com/q/25536053
tags question: http://stackoverflow.com/q/25466283
tags question: http://stackoverflow.com/q/25523153
tags question: http://stackoverflow.com/q/25483927
tags question: http://stackoverflow.com/q/25445654
tags question: http://stackoverflow.com/q/25438418
tags question: http://stackoverflow.com/q/25478129
tags question: http://stackoverflow.com/q/25512316
tags question: http://stackoverflow.com/q/25481292
tags question: http://stackoverflow.com/q/25472055
tags question: http://stackoverflow.com/q/25542795
tags question: http://stackoverflow.com/q/25550418
tags question: http://stackoverflow.com/q/25422528
tags question: http://stackoverflow.com/q/25471022
tags question: http://stackoverflow.com/q/25390272
tags question: http://stackoverflow.com/q/25450036
tags question: http://stackoverflow.com/q/25505358
tags question: http://stackoverflow.com/q/25490820
tags question: http://stackoverflow.com/q/25472966
tags question: http://stackoverflow.com/q/25497954
tags question: http://stackoverflow.com/q/25485515
tags question: http://stackoverflow.com/q/25549866
tags question: http://stackoverflow.com/q/25549265
tags question: http://stackoverflow.com/q/25407527
tags question: http://stackoverflow.com/q/25423883
tags question: http://stackoverflow.com/q/25525477
tags question: http://stackoverflow.com/q/25412848
tags question: http://stackoverflow.com/q/25485735
tags question: http://stackoverflow.com/q/25397298
tags question: http://stackoverflow.com/q/25407934
tags question: http://stackoverflow.com/q/25422531
tag name: javascript
tags question: http://stackoverflow.com/q/25529108
tags question: http://stackoverflow.com/q/25486283
tags question: http://stackoverflow.com/q/25537634
tags question: http://stackoverflow.com/q/25408575
tags question: http://stackoverflow.com/q/25414922
tags question: http://stackoverflow.com/q/25475023
tags question: http://stackoverflow.com/q/25415430
tags question: http://stackoverflow.com/q/25449103
tags question: http://stackoverflow.com/q/25444637
tags question: http://stackoverflow.com/q/25535878
tags question: http://stackoverflow.com/q/25436244
tags question: http://stackoverflow.com/q/25398383
tags question: http://stackoverflow.com/q/25549044
tags question: http://stackoverflow.com/q/25463427
tags question: http://stackoverflow.com/q/25478900
tags question: http://stackoverflow.com/q/25447055
tags question: http://stackoverflow.com/q/25440278
tags question: http://stackoverflow.com/q/25513305
tags question: http://stackoverflow.com/q/25426272
tags question: http://stackoverflow.com/q/25417583
tags question: http://stackoverflow.com/q/25514164
type: Tag
tags question: http://stackoverflow.com/q/25550616
tags question: http://stackoverflow.com/q/25519316
tags question: http://stackoverflow.com/q/25439099
tags question: http://stackoverflow.com/q/25425056
tags question: http://stackoverflow.com/q/25481395
tags question: http://stackoverflow.com/q/25511352
tags question: http://stackoverflow.com/q/25462230
tags question: http://stackoverflow.com/q/25462850
tags question: http://stackoverflow.com/q/25546778

http://stackoverflow.com/q/25443827
upvote count: 2
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/27642104
possible better answer: http://stackoverflow.com/a/27642104
has title: What JDBC property corresponds to mysql command line's "--skip-secure-auth" option?
downvote count: 0
has answer: http://stackoverflow.com/a/25447062
accepted answer: http://stackoverflow.com/a/25447062
favorite count: 0
type: Question
has body: I have one legacy database which needs to be connected like this from command prompt mysql --uUserName -hHostName -pPassword -P3307 -A Schema --skip-secure-auth How do I specify the same in JDBC properties --skip-secure-auth jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://HostName:3307/Schema jdbc.user=UserName jdbc.password=Password jdbc.maxConnections=5
tagged with: java
tagged with: command-line-arguments
tagged with: jdbc
tagged with: mysql
score: 2

http://stackoverflow.com/q/25462954
type: Question
tagged with: libgdx
tagged with: bulletphysics
accepted answer: http://stackoverflow.com/a/25463421
downvote count: 0
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25463421
upvote count: 3
has title: How does the LibGDX Bullet extension's ContactListener work?
tagged with: java
answer count: 1
favorite count: 0
has body: I have been reading through this blog post about using the LibGDX Bullet wrapper: http://blog.xoppa.com/using-the-libgdx-3d-physics-bullet-wrapper-part1/ I am having trouble understanding the part about using ContactListener callbacks. To create a collision callback, all you do is extend the ContactListener class with an overridden method and then instantiate it. Nothing else needs to be done. The code works perfectly without ever referring to the instance again. How is this possible?

http://stackoverflow.com/a/25448238
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25448196
downvote count: 0
has body: Replace while (x &lt;= list.length) { with while (x &lt; list.length) { This is because the last iteration will fill more than 20 elements in the array. Also you should initialize product to 1 instead of 0.

http://stackoverflow.com/q/25416420
tagged with: paintcomponent
has body: I have a class named ControlsPanel. If I press a JButton (Start) in this class, the value of a boolean (isPressed) changes to true. In another class (CashRegistersPanel) I want to draw an Image, but only of the value of the boolean in the previous class is true. Of course the value of this boolean is false in the begining, so it doesn't draw anything. These are my two classes: public ControlsPanel(final ParametersPanel panel) { start = new JButton("Start"); stop = new JButton("Stop"); start.setFont(new Font("Arial", Font.BOLD, 14)); stop.setFont(new Font("Arial", Font.BOLD, 14)); this.setLayout(null); this.setBackground(new Color(199,202,255)); this.add(start); this.add(stop); start.setBounds(10, 10, 280, 30); stop.setBounds(10, 50, 280, 30); stop.setEnabled(false); start.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (start.getText().equals("Start")) { start.setText("Pause"); stop.setEnabled(true); startIsPressed = true; } } }); public boolean StartisPressed() { return startIsPressed; } } And public class CashRegistersPanel extends JPanel{ private Image img; private int amount; private ParametersPanel parametersPanel; private ControlsPanel controlsPanel; private boolean startIsPressed; public CashRegistersPanel(ParametersPanel parametersPanel, ControlsPanel controlPanel) { this.parametersPanel = parametersPanel; this.controlsPanel = controlPanel; startIsPressed = controlsPanel.StartisPressed(); this.setBackground(new Color(237,237,237)); this.setLayout(null); CashRegister cashRegister = new CashRegister(); img = cashRegister.getImg(); amount = parametersPanel.getAmountOfRegisters(); } //Painting CashRegisters public void paintComponent(Graphics g) { if(startIsPressed) { super.paintComponent(g); for (int i = 1; i &lt;= amount; i++) { g.drawImage(img, 30, i*50, this); } } } }
score: 0
tagged with: java
answer count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/25416492
has title: Drawing with paintComponent after value of Jbutton changed in another class
type: Question
type: UnansweredQuestion

http://stackoverflow.com/a/25511909
accepted answer of: http://stackoverflow.com/q/25511672
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25511672
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/39839212
downvote count: 0
has body: If you use ObjectMapper you could probably use a bean to map your JSON directly to your Java object without doing it by yourself. For your code, and based on the comment: public static void main(String[] args) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); String json= "{\"insertDataRequest\":{\"id\":98, \"name\":\"Mercer Island\",\"age\":12,\"designation\":\"SEE\"}}"; JsonNode root2 = objectMapper.readTree(json); for (JsonNode rootnode : root2.get("insertDataRequest")) { if (rootnode.has("id")) { int id = rootnode.get("id").intValue(); System.out.println(id); } if (rootnode.has("name")) { String name = rootnode.get("name").toString().replace("\"", ""); System.out.println(name); } if (rootnode.has("age")) { int age = rootnode.get("age").intValue(); System.out.println(age); } if (rootnode.has("designation")) { String designation = rootnode.get("designation").toString().replace("\"", ""); System.out.println(designation); } } } JSONNode implements Iterable.

http://stackoverflow.com/q/25529639
has body: I am working on a Spring MVC based Java Web App. On one of the pages, I need to have a drop down box - example Student names-which will help me search for Student details. The screen also has "Add", "Edit" or "Delete" functions on it- in this example Student records can be added, edited or deleted. The issue that I am having is when a Student is added, the drop-down box which I have on the "Search" does not get populated with the latest Student Added. Only if I go out of the application and come back in does it get populated. On the code side side I have the following: I have a Controller class with a method getStudentNamesList() @ModelAttribute(value = "testModelAttribute") public StudentNamesDTO getNamesList() { StudentNamesDTO studentNamesDTO = plStudentDelegate .getStudentList(); //m.addAttribute("interface", interfaceNamesDTO); return studentNamesDTO; } On the JSP page I have the following: Interface * <form:select id="cstSlct" path="studentNm"> <form:option value="">Select One</form:option> <form:options items="${testAttribute.studentNmList}" /> </form:select> I do see the method getNamesList() being called and the retrieve being done from the database. But for some reason the drop-down box on the JSP page is not being updated with the value. Please help
type: Question
answer count: 2
has title: Drop-down box in JSP Spring MVC
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39857767
tagged with: spring-mvc
score: 0
has answer: http://stackoverflow.com/a/25530435
has answer: http://stackoverflow.com/a/25533720
has comment: http://stackoverflow.com/comment/39858067
has comment: http://stackoverflow.com/comment/39858201
tagged with: java
tagged with: jsp

http://stackoverflow.com/q/25478706
tagged with: android
has title: How to Extend SwarmActivity? (getting "Cannot resolve symbol 'SwarmActivity'"
score: 0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39778808
has body: I followed the instructions in http://swarmconnect.com/admin/docs/setup to setup Swarm in my Android app in Android Studio. Here is what I did so far: Step 1) I have imported the SwarmConnect library by downloading the library and importing it as a module (by choosing the library after clicking Import Module) Step 2) I added manifestmerger.enabled=true to both gradle.properties and local.properties files. Step 3) I extended SwarmActivity instead of Activity in my app public class MyActivity extends SwarmActivity { but I got the error: "Cannot resolve symbol 'SwarmActivity'". I also tried the alternative solution in Step 3 by adding in my onCreate(); onResume(); onPause() methods Swarm.setActive(this); but I got the error: "Cannot resolve symbol 'Swarm'"
has comment: http://stackoverflow.com/comment/39766630
tagged with: android-studio
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/39748638
type: AnswerComment
comment on: http://stackoverflow.com/a/25470447
has text: Look at the recent edit posted by me,it demonstrates how deadlock occurs
score: 0
type: Comment

http://stackoverflow.com/a/25483933
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25483854
type: Answer
has body: List is a generic type, primitive types are not valid substitutes for the type parameter. So in your first example when you call Arrays.asList() with an int[], the value for the type parameter will be int[] and not int, and it will return a list of int arrays. It will have only 1 element, the array itself. The second case will be a List&lt;String&gt;, properly holding the 4 strings which you pass to it.
score: 1

http://stackoverflow.com/q/25421537
answer count: 1
has answer: http://stackoverflow.com/a/25426962
downvote count: 0
upvote count: 1
has title: Time control in Universal Tween Engine
favorite count: 0
type: Question
has body: Timeline.createSequence() .push(Tween.set(cuptop1, SpriteAccessor.ALPHA).target(0).start(tweenManager)) .push(Tween.set(cuptop2, SpriteAccessor.ALPHA).target(0).start(tweenManager)) .push(Timeline.createParallel() .push(Tween.to(cuptop1, SpriteAccessor.ALPHA,0.5f).delay(0.5f).target(1).start(tweenManager)) .push(Tween.to(cuptop2, SpriteAccessor.ALPHA,0.5f).delay(0.3f).target(1).start(tweenManager)) .start(tweenManager) ) .pushPause(1) .push(Timeline.createParallel() .push(Tween.to(cuptop1, SpriteAccessor.POS_XY, 1.0f).target(10,10).ease(TweenEquations.easeNone).start(tweenManager)) .push(Tween.to(cuptop2, SpriteAccessor.POS_XY, 1.0f).target(20,20).ease(TweenEquations.easeNone).start(tweenManager)) .start(tweenManager) ) .pushPause(1) .push(Timeline.createParallel() .push(Tween.to(cuptop1, SpriteAccessor.POS_XY, 1.0f).target(100,100).ease(TweenEquations.easeNone).start(tweenManager)) .push(Tween.to(cuptop2, SpriteAccessor.POS_XY, 1.0f).target(200,200).ease(TweenEquations.easeNone).start(tweenManager)) .start(tweenManager) ) .start(tweenManager); Hi, I am new in programming. I am making an animation using tween engine. It should be like this: First, 2 cups appear at (100, 100) and (200, 200) respectively at the same time. A second later, 2 cups move to (10, 10) and (20, 20) respectively at the same time. Finally, they move back to their original position at the same time.returns However, the 3 steps happen at the same time and ignore the pushPause. How can I correct it? Thanks!
tagged with: libgdx
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25426962
score: 1
tagged with: java

http://stackoverflow.com/comment/39605418
type: Comment
type: QuestionComment
has text: What is `cc` ? You should provide more code
comment on: http://stackoverflow.com/q/25393514
score: 0

http://stackoverflow.com/comment/39698995
score: 0
type: AnswerComment
has text: The issue is reading value on the first and on the last lines of the method. These readings are outside of synchronized block so no happens-before relationships is established between reading and writing. This is why double checked locking does not work without volatile keyword. Thus I'm pretty sure that the problem exists.
comment on: http://stackoverflow.com/a/25444068
type: Comment

http://stackoverflow.com/comment/39820263
type: AnswerComment
has text: +1 anyway as I think you are right that ABNA is not mature enough yet for use on production code. But I wonder who will volunteer to create nullity profiles for the whole of the JRE.
comment on: http://stackoverflow.com/a/25491846
type: Comment
score: 0

http://stackoverflow.com/a/25865581
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25538711
type: AcceptedAnswer
has body: Use build in Data Pump to create new BTreeMap. It has linear speed with number of records. It will sort data even if they do not fit into memory. Map newMap = db.createTreeMap("map") .pumpSource(randomIterator) //source of data to import .pumpBatchSize(1000000) //sort data from source, batch size must be set so it fits into memory .make()
type: Answer
accepted answer of: http://stackoverflow.com/q/25538711
upvote count: 2

http://stackoverflow.com/comment/39810204
score: 1
comment on: http://stackoverflow.com/q/25503059
type: Comment
type: QuestionComment
has text: well on settings there is primary language. it is russian others were checked too. the problem is that I can check one primary language only. Maybe somehow I should force locale inside intent. Dont know but it works with different devices. But in mine it always fallback to default

rfid
tag name: rfid
type: Tag
tags question: http://stackoverflow.com/q/25431030

http://stackoverflow.com/a/25487188
has comment: http://stackoverflow.com/comment/39779558
has body: String emails = emailList.replaceAll(",", "\n");
type: Answer
score: 4
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25487146
has comment: http://stackoverflow.com/comment/39779181

http://stackoverflow.com/q/25488555
has title: Is this a proper customized synchronizer?
has comment: http://stackoverflow.com/comment/39787112
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39783379
has comment: http://stackoverflow.com/comment/39796892
has comment: http://stackoverflow.com/comment/39783788
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/17253260
has comment: http://stackoverflow.com/comment/39782130
accepted answer: http://stackoverflow.com/a/25495011
has answer: http://stackoverflow.com/a/25495011
has body: I had a strong need for a synchronizer similar to a CountDownLatch, but the starting number for the countdown is unknown. To add context, if I'm going through a buffered recordset (say from a text file or a query) and kicking off a runnable for each record, but I don't know how many records there will be... I need a synchronizer that signals when the iteration is complete and all runnables are complete. This is the synchronizer I came up with... a BufferedLatch. A method is called in the iteration loop for each record incrementing the recordSetSize. At the end of each runnable kicked off for each record, the processedRecordSetSize is incremented. When the iteration through all records is complete (but runnables may still be in queue), the setDownloadComplete() method is called letting the BufferedLatch know the recordSetSize is now fixed. The await() method waits for the iterationComplete variable to be true (recordsetSize is now fixed) and recordsetSize == processedRecordSetSize; Is this an optimal implementation of this synchronizer? Is there more concurrent opportunity that synchronization is holding back? Although testing seems to work fine, are there any gotcha's I'm overlooking? import java.util.concurrent.atomic.AtomicInteger; public final class BufferedLatch { /** A customized synchronizer built for concurrent iteration processes where the number of objects to be iterated is unknown * and a runnable will be kicked off for each object, and the await() method will wait for all runnables to be complete */ private final AtomicInteger recordsetSize = new AtomicInteger(0); private final AtomicInteger processedRecordsetSize = new AtomicInteger(0); private volatile boolean iterationComplete = false; public int incrementRecordsetSize() throws Exception { if (iterationComplete) { throw new Exception("Cannot increase recordsize after download is flagged complete!"); } else { return recordsetSize.incrementAndGet(); } } public void incrementProcessedRecordSize() { synchr…
tagged with: multithreading
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39782057
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39840556
type: Comment
type: QuestionComment
has text: How big is your heap size? sometimes generations are resized after collections and if you dont set a fixed generation size resizing may take some time to finish.
score: 0
comment on: http://stackoverflow.com/q/25518875

http://stackoverflow.com/comment/39616339
score: 1
type: Comment
type: QuestionComment
has text: give a sample char[] with elements in it
comment on: http://stackoverflow.com/q/25399642

http://stackoverflow.com/comment/39824839
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25511460
has text: Crap :-) copy paste combined with too few sleep

http://stackoverflow.com/q/25434201
has body: why running time of this code is O(n^2).(as written in cracking the coding interview book).and how it could be improved public String makeSentence(String[] words) { StringBuffer sentence = new StringBuffer(); for (String w : words) sentence.append(w); return sentence.toString(); }
downvote count: 1
has answer: http://stackoverflow.com/a/25434254
has comment: http://stackoverflow.com/comment/39680806
has title: why running time of this code is 0(n^2)
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25434252
has comment: http://stackoverflow.com/comment/39680802
favorite count: 0
type: Question
duplicate of: http://stackoverflow.com/q/7156122
has comment: http://stackoverflow.com/comment/39680898
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/7156122
type: UnansweredQuestion

jquery
tags question: http://stackoverflow.com/q/25419741
tags question: http://stackoverflow.com/q/25390272
tags question: http://stackoverflow.com/q/25433177
tags question: http://stackoverflow.com/q/25449763
tags question: http://stackoverflow.com/q/25391125
tags question: http://stackoverflow.com/q/25519316
type: Tag
tag name: jquery
tags question: http://stackoverflow.com/q/25447331
tags question: http://stackoverflow.com/q/25419787
tags question: http://stackoverflow.com/q/25537634
tags question: http://stackoverflow.com/q/25414922
tags question: http://stackoverflow.com/q/25449994
tags question: http://stackoverflow.com/q/25420244
tags question: http://stackoverflow.com/q/25532419
tags question: http://stackoverflow.com/q/25450036
tags question: http://stackoverflow.com/q/25428533
tags question: http://stackoverflow.com/q/25550616
tags question: http://stackoverflow.com/q/25439914
tags question: http://stackoverflow.com/q/25541214
tags question: http://stackoverflow.com/q/25497479
tags question: http://stackoverflow.com/q/25442115
tags question: http://stackoverflow.com/q/25438418
tags question: http://stackoverflow.com/q/25491428

http://stackoverflow.com/q/25413068
has title: IntelliJ still truncates output
has answer: http://stackoverflow.com/a/25413654
linked to: http://stackoverflow.com/q/7836313
has comment: http://stackoverflow.com/comment/39642931
tagged with: java
has body: Read this, did not help. Running IntelliJ 13.1.4 on Windows 7. I want to see the full output when I run my project; instead, I see only a truncated snippet: I copied idea.properties to C:\Users\.IdeaIC13 and changed idea.cycle.buffer.size to various values - disabled, 65535, etc. No change, whenever I build, I still see truncated output. How do I get my full build output?
has comment: http://stackoverflow.com/comment/39642536
type: Question
has comment: http://stackoverflow.com/comment/39642695
type: UnansweredQuestion
tagged with: intellij-idea
answer count: 1
score: 0

http://stackoverflow.com/a/25439180
upvote count: 1
has body: Could there still be a chance that the File constructor may not see the value of myPath? Answer is yes it is possible since Java Memory Model guarantees visibility of only final fields :- "A new guarantee of initialization safety should be provided. If an object is properly constructed (which means that references to it do not escape during construction), then all threads which see a reference to that object will also see the values for its final fields that were set in the constructor, without the need for synchronization." JSR 133 Link However I feel this situation is impossible to recreate (I too had tried earlier a similar theory but ended in vain). There is a case of unsafe publication/escape of this reference within the constructor which can lead to the scenario of myPath not being initialized properly. An example for this is given in Listing 3.7 of the book you mentioned. Below is an example of making your class this reference to escape in constructor. public class MultiThreadingClass implements Runnable{ public static volatile MultiThreadingClass unsafeObject; private String myPath ="c:\\somepath"; public MultiThreadingClass() { unsafeObject = this; ..... } public void beginmt(){ Holder h = new Holder(); h.setPath(new File(myPath)); //line 6 h.begin(); } } The above class can cause other threads to access unsafeObject reference even before the myPath is correctly set but again recreating this scenario might be difficult.
type: Answer
answers question: http://stackoverflow.com/q/25438681
downvote count: 0
score: 1

http://stackoverflow.com/a/25493203
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25493166
upvote count: 1
score: 1
type: Answer
has body: You cannot access the network on the Main Thread. This is to prevent your UI's rendering from being blocked by a long running call to the network. You need to put the network logic in its own thread. I recommend using an AsyncTask. Also, you should not create your own Activity this way. If you need two Activities to communicate. Use startActivityForResult and setResult to pass data back and forth using the Intent's data bundle. By the looks of it, you are using the Second Activity purely for data retrieval. You should consider doing this in a Service instead. You will still need to handle threading in the Service (or you can use an IntentService)
answers question: http://stackoverflow.com/q/25493166

http://stackoverflow.com/a/25402112
answers question: http://stackoverflow.com/q/25401557
has comment: http://stackoverflow.com/comment/39621350
has comment: http://stackoverflow.com/comment/39622340
score: 0
type: Answer
has body: Check this one ((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20}) For practice http://www.regexr.com/

http://stackoverflow.com/q/25517223
has body: Say there's a 2d boolean array boolean[][] = { x x x x x x x x x x x x x x x x x x x x x x x x x x x x } Criteria: Each column must have 2 'true' Each row cannot have more than 4 'true' For example a solution can be: boolean[][] = { T T T T F F F T T T T F F F F F F F T T T F F F F T T T } Another one: boolean[][] = { T F T F F T T F T T T F F F F F F T T T F T T F F T F T } How to write a recursive function to find out all possible combinations given the two criteria above? I wish I can show something that I tried, but I don't even know how to start. I tried to solve this by using object oriented way, by creating class for the row or column but doesn't seem to help simplifying it since the rows and columns are closely affecting each other. Thanks in advance!
has comment: http://stackoverflow.com/comment/39856582
favorite count: 0
has comment: http://stackoverflow.com/comment/39836155
type: AnsweredQuestion
has title: Find out all possible combinations of a 2D boolean array given some criteria (using Java)
accepted answer: http://stackoverflow.com/a/25517935
upvote count: 5
has comment: http://stackoverflow.com/comment/39836036
tagged with: java
has comment: http://stackoverflow.com/comment/39837340
has answer: http://stackoverflow.com/a/25517935
has comment: http://stackoverflow.com/comment/39837018
type: Question
has comment: http://stackoverflow.com/comment/39836680
has comment: http://stackoverflow.com/comment/39836587
has comment: http://stackoverflow.com/comment/39838571
score: 2
has comment: http://stackoverflow.com/comment/39837691
answer count: 1
downvote count: 3

http://stackoverflow.com/comment/39991683
comment on: http://stackoverflow.com/q/25526562
type: Comment
type: QuestionComment
has text: Well, after testing, it appears that the object needs 3.5s to be instanciated. This can't be done whenever the user clicks on a link.
score: 0

http://stackoverflow.com/q/25481126
accepted answer: http://stackoverflow.com/a/25523434
has comment: http://stackoverflow.com/comment/39768174
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39847596
has body: I am working on the below use cases. Create User Delete user Update User Now I can design it in 2 ways Design # 1 -- Creating UserOperations class --> Having total of 3 methods, one methods each for creating ,deleting and updating User. Design # 2 -- Creating 3 Classes --> CreateUser class, DeleteUser class and UpdateUser class. As per SRP (Single Responsibility principle) as in SOLID principles, I feel we have 3 responsibilities which are creating User, deleting User and Updating user and so we need 3 classes as mentioned above in point 2. Please suggest what should be the good design - Design #1 or Design # 2.
has comment: http://stackoverflow.com/comment/39768808
tagged with: single-responsibility-principle
has comment: http://stackoverflow.com/comment/39768036
has comment: http://stackoverflow.com/comment/39768145
has answer: http://stackoverflow.com/a/25523434
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39768672
has comment: http://stackoverflow.com/comment/39768173
score: 1
upvote count: 3
tagged with: java
downvote count: 2
has title: Designing User related classes
tagged with: solid-principles
answer count: 1
has comment: http://stackoverflow.com/comment/39768117

http://stackoverflow.com/q/25512696
has answer: http://stackoverflow.com/a/25512933
linked to: http://stackoverflow.com/q/2193226
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25512777
has comment: http://stackoverflow.com/comment/39827131
tagged with: jar
has comment: http://stackoverflow.com/comment/39832661
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39827129
has comment: http://stackoverflow.com/comment/39828324
has title: Jar file not loading in eclipse
tagged with: java
has comment: http://stackoverflow.com/comment/39827150
has answer: http://stackoverflow.com/a/25512777
accepted answer: http://stackoverflow.com/a/25512933
has body: I created a jar file and would like to implement it into my other projects. However, I am getting an error "cannot be resolved to a type." I added the .jar file to the Build Path Libraries within eclipse but the error persists. EDIT: I tried following the tutorial here: http://www.programcreek.com/2011/07/build-a-java-library-for-yourself/ However, this still does not work. System.out.println(Simple.add(1,2)); I get the error "Cannot be resolved" on the Simple class name. EDIT: package TEST; public class AccessSimple { public void access() { System.out.println(Simple.add(1, 2)); } } Here is the class I am using to access my jar file. It is not part of the default package.
tagged with: eclipse

http://stackoverflow.com/a/25461195
answers question: http://stackoverflow.com/q/25460986
has comment: http://stackoverflow.com/comment/39734617
has body: Works like a charm for me (check out the basic example provided below). A common mistake is to forget to set a size on the root component to perform the layout of the painted components (by invoking doLayout() on root component and all its descendants) Finally, rather use paint(Graphics) than paintAll(Graphics) which might not work if your component is not showing. import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Desktop; import java.awt.Dimension; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import java.util.Random; import javax.imageio.ImageIO; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class TestPrint { private static final int MY_WIDTH = 400; private static final int MY_HEIGHT = 400; private static final int STEPS = 20; protected static void initUI() throws MalformedURLException { Random r = new Random(); final List&lt;Color&gt; colors = new ArrayList&lt;Color&gt;(); for (int i = 0; i &lt; STEPS; i++) { colors.add(new Color(r.nextInt(256), r.nextInt(256), r.nextInt(256))); } JPanel panel = new JPanel() { @Override protected void paintComponent(java.awt.Graphics g) { super.paintComponent(g); for (int i = 0; i &lt; STEPS; i++) { g.setColor(colors.get(i)); g.fillRect(0 + (getWidth() / STEPS * i / 2), 0 + (getHeight() / STEPS * i / 2), getWidth() - (getWidth() / STEPS * i), getHeight() - getHeight() / STEPS * i); } }; @Override public Dimension getPreferredSize() { return new Dimension(MY_WIDTH, MY_HEIGHT); } }; panel.setSize(panel.getPreferredSize()); layoutRecursively(panel); BufferedImage bi = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB); panel.paint(bi.getGraphics()); File file = new File("test.png"); try { ImageIO.write(bi, "png", file); Desktop.getDesktop().open(file); } catch (IOException e) { // T…
type: Answer
has comment: http://stackoverflow.com/comment/39736823
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/a/25441026
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39693610
downvote count: 0
has comment: http://stackoverflow.com/comment/39693130
has comment: http://stackoverflow.com/comment/39693566
has comment: http://stackoverflow.com/comment/39693258
upvote count: 1
has comment: http://stackoverflow.com/comment/39693875
answers question: http://stackoverflow.com/q/25440889
has comment: http://stackoverflow.com/comment/39693215
score: 1
has comment: http://stackoverflow.com/comment/39693991
type: Answer
accepted answer of: http://stackoverflow.com/q/25440889
has comment: http://stackoverflow.com/comment/39693324
has body: An ssh url would never include a user account to access the bitbucket server. It generally use a service account like 'git' (as seen in "Troubleshoot SSH Issues") git@bitbucket.org:accountname/reponame.git # or ssh://git@bitbucket.org/accountname/reponame.git In your case, if you have under your account a test.git repo: ssh://git@bitbucket.org/kanishkapanamaldenya/test.git That means: The username for the "authentication" part would be git The 'password' would be the passphrase associated with your private key (if you created it passphrase-protected) or empty (if your private key isn't passphrase protected) This presuppose that you have an account kanishkapanamaldenya on BitBucket, and that you have a Git repo name test.git in BitBucket. Eclipse itself won't create those two for you. It will simply push to it or pull from it. A path like "test/test.git" wouldn't be a valid BitBucket path anyway. It is accountname/reponame.git. If your account name on BitBucket is kanishkapanamaldenya, then the right path would be kanishkapanamaldenya/test.git.
has comment: http://stackoverflow.com/comment/39693247

http://stackoverflow.com/q/25400934
tagged with: java
favorite count: 0
type: Question
answer count: 2
has body: Two snippets from book (Concurrency chapter): class Accessor implements Runnable { private final int id; public Accessor(int idn) { id = idn; } public void run() { while(!Thread.currentThread().isInterrupted()) { ThreadLocalVariableHolder.increment(); System.out.println(this); Thread.yield(); } } public String toString() { return "#" + id + ": " + ThreadLocalVariableHolder.get(); } } public class ThreadLocalVariableHolder { private static ThreadLocal&lt;Integer&gt; value = new ThreadLocal&lt;Integer&gt;(); /*{ private Random rand = new Random(47); protected synchronized Integer initialValue() { return rand.nextInt(10000); } };*/ public static void increment() { value.set(value.get() + 1); } public static int get() { return value.get(); } public static void main(String[] args) throws Exception { ExecutorService exec = Executors.newCachedThreadPool(); for(int i = 0; i &lt; 5; i++) exec.execute(new Accessor(i)); TimeUnit.SECONDS.sleep(3); // Run for a while exec.shutdownNow(); // All Accessors will quit } } In class ThreadLocalVariableHolder is inner class ThreadLocal with method initialValue and attribute rand, wich are not explicitly used. If I comment whole content of class (as I did here), it still generates similar results. I suppose, that this code is obsolete. Do you anybody understand, why is this code inside the inner class and what is the purpose?
has title: Bruce Eckel ThinkingIn Java 4-th edition, ThreadLocalVariableHolder
tagged with: multithreading
downvote count: 0
accepted answer: http://stackoverflow.com/a/25401108
upvote count: 1
possible better answer: http://stackoverflow.com/a/25409838
has answer: http://stackoverflow.com/a/25401108
has answer: http://stackoverflow.com/a/25409838
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39621249
score: 1

http://stackoverflow.com/comment/39716364
score: 0
comment on: http://stackoverflow.com/q/25453404
has text: You need to change the file object i the loop. in your case you ever ask for the same file!!
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25463308
has comment: http://stackoverflow.com/comment/39785490
tagged with: java
answer count: 1
has title: How to build the achartengine library after modification?
has comment: http://stackoverflow.com/comment/39757069
tagged with: achartengine
has body: I modified the achartengine code to optimize it for myself but how do I build the lib in AndroidStudio? (I'm new in coding) I found a build.xml file, so it should be possible to run ant jar to create the lib, but how do I do that...? or is there a better way?
has comment: http://stackoverflow.com/comment/39766345
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/56920094
has comment: http://stackoverflow.com/comment/39757250
tagged with: android
tagged with: libs
has comment: http://stackoverflow.com/comment/39792145
has comment: http://stackoverflow.com/comment/39807117
tagged with: android-studio
score: 0

http://stackoverflow.com/q/25474385
has comment: http://stackoverflow.com/comment/39794532
has comment: http://stackoverflow.com/comment/39789150
has comment: http://stackoverflow.com/comment/52860815
has body: I am developing an OSGi plugin (bundle) which performs encryption on Strings. The Strings themselves are encrypted using AES. I am encrypting the AES key with RSA. All works perfectly in my unit tests. When I deploy the plugin into Karaf (haven't tried any other OSGi containers at present), the result of the encrypted key is a bunch of zero bytes with a final 1-byte. There are no exceptions being thrown. Everything looks normal except that when I go in with the debugger, I discover that the RSA public key cipher is using a key-spec where the value of the public exponent is zero. This obviously makes no sense and it doesn't surprise me that the output is mainly zeroes. Can anyone suggest why this might be happening? Adding some code fragments: public static Cipher createRsaCipher(final boolean keyTypePublic, final int mode, final KeySpec keySpec) throws GeneralSecurityException { final KeyFactory kfpri = KeyFactory.getInstance(RSA); final Cipher result = Cipher.getInstance(RSA); result.init(mode, keyTypePublic ? kfpri.generatePublic(keySpec) : kfpri.generatePrivate(keySpec)); return result; } private static Cipher createPublicKeyEncryptionCipher(final URL key) throws IOException, GeneralSecurityException { try (InputStream stream = key.openStream()) { final byte[] encodedKey = readPublicKeyBytes(stream); final X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(encodedKey); return CipherFactory.createRsaCipher(true, Cipher.ENCRYPT_MODE, publicKeySpec); } } private static byte[] encrypt(final byte[] source, Cipher cipher) throws GeneralSecurityException { final int bytes = source.length; final int outputSize = cipher.getOutputSize(bytes); final byte[] buffer = new byte[outputSize]; int resultLength = 0; final int n = cipher.doFinal(source, 0, bytes, buffer, 0); resultLength += n; final byte[] result = new byte[resultLength]; System.arraycopy(buffer, 0, result, 0, resultLength); return result; } openssl rsa -in private.pem -pubout -outform DER -out public.der mor…
type: Question
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39790038
type: UnansweredQuestion
tagged with: blueprint-osgi
tagged with: encryption
has comment: http://stackoverflow.com/comment/39798446
has comment: http://stackoverflow.com/comment/39793085
has title: Zero public exponent in RSA
has comment: http://stackoverflow.com/comment/39755951
has comment: http://stackoverflow.com/comment/39789359
has comment: http://stackoverflow.com/comment/39761358
tagged with: karaf
has comment: http://stackoverflow.com/comment/39767178
tagged with: java
tagged with: rsa

http://stackoverflow.com/comment/39851671
type: Comment
type: QuestionComment
has text: That is a prefect solution ! Thank you .
score: 0
comment on: http://stackoverflow.com/q/25526220

http://stackoverflow.com/comment/39753262
comment on: http://stackoverflow.com/q/25472584
has text: See [this question](http://stackoverflow.com/questions/930289/how-can-i-find-all-the-methods-that-call-a-given-method-in-java). Especially first answer about [ASM](http://asm.ow2.org/).
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/39647617
type: AnswerComment
has text: @user3756283 just put `str.toUpperCase()` , where did you read is an outdated way?
score: 0
comment on: http://stackoverflow.com/a/25416046
type: Comment

http://stackoverflow.com/q/25423624
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25423799
tagged with: annotations
score: -1
tagged with: inheritance
downvote count: 1
tagged with: java
answer count: 1
tagged with: eclipse
has body: I started working with testNG, and found a little confusing behaviour. i created a base class added few methods for each testNG notations then in the derived class did the same(method name different).. and run the derived class so before @test of derived class parent methods running first and derived class methods running after that i.e before annotations and after@test of child the @after annotations ran vice versa.. up to here its clear. Now , what i did was changed the name of methods in derived class same as that of parent class now when i run the child/derived class only the child class methods run . I am not able to understand why, no such thing is discussed anywhere!!
tagged with: testng
favorite count: 0
type: Question
has title: TestNG annotations, method name same as parent class methods
upvote count: 0

http://stackoverflow.com/comment/39665376
comment on: http://stackoverflow.com/a/25424482
type: Comment
score: 0
type: AnswerComment
has text: could you provide me a sample application to store xml data into MongoDB because i tried it but i didn't able to resolve it. I'll be thankful to you.

clojure
tags question: http://stackoverflow.com/q/25439971
tags question: http://stackoverflow.com/q/25458299
tag name: clojure
type: Tag
tags question: http://stackoverflow.com/q/25468663

http://stackoverflow.com/q/25521861
score: 1
tagged with: java
tagged with: servlets
accepted answer: http://stackoverflow.com/a/25521900
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25521900
has title: Accessing File Stored on a server in my servlet
possible better answer: http://stackoverflow.com/a/25521901
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25521901
has body: In my servlet file im trying to access a file stored on the server,and then im converting it to inputstream and storing it into the database. if I try with local file,Its doing well,but when I try to access the file stored in my server it is showing 500 exception. that the directory cannot be identified. Note : when I copy this directory and paste it in url,its working fine and showing the image. Here is my code, InputStream inputStream = null; inputStream = new FileInputStream("http://www.example.com/images/community.gif"); and this is for local, inputStream = new FileInputStream("D:/INDIGOWORK/PostFreeAd/WebContent/images/community.gif"); Its working fine.Please solve my problem
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/39688654
type: AnswerComment
score: 0
type: Comment
has text: Notice how I have an onClickListener to start the timer. I am able to get the start time and end time in milliseconds and store it in sharedpreferences. The problem is that I don't know how to override the time I have counting down because this is all done in a start_timer button onClickListener? Where can I go from here because I have all the values I just am unable to edit the countdown timer value...
comment on: http://stackoverflow.com/a/25419627

http://stackoverflow.com/q/25391738
tagged with: stringtemplate
score: 0
has body: I'm using StringTemplate to perform a model transformation from one language to several back ends. I'm starting from an hand-generated AST that has class hierarchies for, e.g., types within the language. My question has to do with translation of complex hierarchies within StringTemplate. Let's examine translating a Type hierarchy, which is implemented in a class hierarchy that looks something like: class Type { } class IntType extends Type { ...bitsize for integer here... } class Boolean extends Type {} class ArrayType extends Type { ...array dimensions and base type here} class RecordType extends Type { ...field information here...} Is there any way of doing conditional branching based on type information? I've seen a lot of examples that do the conditional branching directly in the concrete grammar for a language and the template follows the production, but this is not my situation. The way I see it there are at least four ways I can do this: Not use StringTemplate at all for complex hierarchies; instead translate directly in Java. However, this means that my use of templating is pretty minimal: Many of the language features I'd like to translate (parameters, declarations, etc.) each have types, so I'd have to just use templating for "leaf level" elements. "Escape" back into Java using a renderer for the Type objects. This could lead to situations where I call back to Java using a renderer and then call into another StringTemplate object for rendering the individual types, but I assume that this is o.k. Add recognizers for subtypes to my Java classes that I can use directly in the template and do conditional formatting there. Hack getter/setter methods to build string representations for the objects of interest, e.g.: Add a String getStringTemplateTypeString() to my Type class and then reference it with: type.stringTemplateTypeString I am sure that there are additional ways to do it as well; there is a lot of flexibility here. I am currently leaning towards option…
has title: StringTemplate and ASTs
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39644818
has answer: http://stackoverflow.com/a/27268422
type: Question
tagged with: abstract-syntax-tree
type: UnansweredQuestion

embedded-jetty
tag name: embedded-jetty
tags question: http://stackoverflow.com/q/25483420
type: Tag

http://stackoverflow.com/comment/39739138
type: AnswerComment
comment on: http://stackoverflow.com/a/25465538
has text: THank you. Actually I want to know if there is a way to send a post request using only a `form` . Now necessarily Gmail. I use Gmail to make my question clearer and more "feasible". Let's say any other webpage has a forms. I fill it out and click submit and get the result. Right now I am using `Selenium` to do this. But I was hoping there is an easier way to use HTTP Post
type: Comment
score: 0

http://stackoverflow.com/comment/39642974
has text: This puts the values from the input table in the correct order, however the output generates a text file with one long line of data.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25412555
type: Comment

http://stackoverflow.com/q/25503075
tagged with: keylistener
has title: Java JTable filter data
has comment: http://stackoverflow.com/comment/39808973
tagged with: jtable
upvote count: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39814532
tagged with: swing
tagged with: rowfilter
has comment: http://stackoverflow.com/comment/39809035
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39809384
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39808954
has body: I can not correctly apply the filter to the JTable. private static TableRowSorter&lt;SQLiteTableModel&gt; sorter = null; ... private void jTFSearchOtherKeyPressed(java.awt.event.KeyEvent evt) { jTableOther.setRowSorter(sorter); String text3 = jTFSearchOther.getText(); if (text3.length() == 0) { sorter.setRowFilter(null); } else { sorter.setRowFilter(RowFilter.regexFilter(text3)); } } One table is sorted, the other gives an error private void jTFSearchOtherKeyPressed(java.awt.event.KeyEvent evt) { jTableOther.setRowSorter(sorter); String text3 = jTFSearchOther.getText(); if (text3.length() == 0) { sorter.setRowFilter(null); } else { sorter.setRowFilter(RowFilter.regexFilter(text3)); } } Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 4 at testovoezadanie.demo.SQLiteTableModel.getValueAt(SQLiteTableModel.java:137) at javax.swing.JTable.getValueAt(JTable.java:2719) at javax.swing.JTable.prepareRenderer(JTable.java:5720) at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2114) at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:2016) at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1812) at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161) at javax.swing.JComponent.paintComponent(JComponent.java:777) at javax.swing.JComponent.paint(JComponent.java:1053) at javax.swing.JComponent.paintChildren(JComponent.java:886) On line 137 @Override public Object getValueAt(int row, int column) { return contents[row][column]; }
has answer: http://stackoverflow.com/a/25513132
possible better answer: http://stackoverflow.com/a/25513132
tagged with: java
has answer: http://stackoverflow.com/a/25504502
has comment: http://stackoverflow.com/comment/39809139
downvote count: 1
accepted answer: http://stackoverflow.com/a/25504502
score: -1
has comment: http://stackoverflow.com/comment/39809260

http://stackoverflow.com/comment/39746780
type: AnswerComment
has text: my error in copying the code over. Class.forName("org.postgresql.Driver") is in the code. Error remains.
comment on: http://stackoverflow.com/a/25469336
type: Comment
score: 0

http://stackoverflow.com/comment/39892080
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25548577
score: 0
has text: It depends on whether you need a shallow copy of the `Collection`s or a hard copy. A bit too broad.

http://stackoverflow.com/a/25442675
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25442580
has body: TRY Using merge sort algorithm. wikipedia page here

http://stackoverflow.com/q/25468512
has comment: http://stackoverflow.com/comment/39744603
has comment: http://stackoverflow.com/comment/39744624
has title: cannot find symbol error BufferedOutputStream(file.newOutputStream(CREATE))
has answer: http://stackoverflow.com/a/25468548
favorite count: 0
has answer: http://stackoverflow.com/a/25468570
type: Question
has comment: http://stackoverflow.com/comment/39744629
tagged with: java
type: UnansweredQuestion
score: -3
has body: Please help guys. I tried this code I read in a PDF about java programming ang encountered this error : cannot find symbol error FileOut.java:16 : error: cannot find symbol BufferedOutputStream(file.newOutputStream(CREATE)); HERE IS MY CODE: import java.nio.file.*; import java.io.*; import static java.nio.file.StandardOpenOption.*; public class FileOut { public static void main(String[] args) { Path file = Paths.get("C:\\Java\\Chapter.13\\Grades.txt"); String s = "ABCDF"; byte[] data = s.getBytes(); OutputStream output = null; try{ output = new BufferedOutputStream(file.newOutputStream(CREATE)); output.write(data); output.flush(); output.close(); } catch(Exception e){ System.out.println("Message: " + e); } } } Thank you!
has comment: http://stackoverflow.com/comment/39744660
upvote count: 0
answer count: 2
downvote count: 3

http://stackoverflow.com/a/25441467
has body: $ means it's an inner class inside ServiceAppointmentPopup, the number means it's an anonymous inner class. In general it's a convention to name inner classes like this in the JVM ClassName$InnerClassName.
answers question: http://stackoverflow.com/q/25441338
upvote count: 3
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39693942
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25441338

http://stackoverflow.com/comment/39691385
type: QuestionComment
has text: The thread is blocked in the read method waiting for data to arrive.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25440035

http://stackoverflow.com/a/25509391
has comment: http://stackoverflow.com/comment/39821012
has body: You're using simple bounding rectangles. Rect rect = Imgproc.boundingRect(points); It will detect any kind of object large enough to fit the criteria, so naturally - also people. As a simple solution i suggest measuring rect.height and rect.width - a car would usually be a lot wider that higher, while a regular person is usually higher that wider. Since the approach is very basic, you can only process basic features, so there is very little you can do. Alternatively you could pre-process the image and figure out the color blobs using openCV - a car would be usually a large wide, not very high object of the same average color. UPDATE: According to the OpenCV4Android project the sample includes the Color blob detection sample OpenCV4Android samples description. It's under Sample – color-blob-detection
has comment: http://stackoverflow.com/comment/39821880
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25509253
downvote count: 0

http://stackoverflow.com/a/25494618
downvote count: 0
upvote count: 1
score: 1
has body: Regex questions should always specify what rules you want your search, or your transformation to follow. Questions like "I have this specific string, and I want to get that specific string as a result" are never good enough, because we are left guessing what's supposed to happen if you give it a different string as input. There are always several possible ways we can interpret the question, and we have to guess which one. We are not mind readers. Assuming that your rule is "if you see | followed by some text inside and , then remove the | and the preceding text": then this should work: s = s.replaceAll("\\[\\[.*\\|(.*?\\]\\])",", followed by other . This part is in parentheses; therefore it becomes group 1. ? in .*? is a "reluctant" qualifier, which means it matches as few characters as possible to get to the next . This is necessary because you don't want the match to zoom through all your ]] if you have more than one [[..]] in the input. The replacement text is [[ followed by this third part (group 1). Thus, the second part, i.e. the text followed by |, is removed. Your attempt: s = s.replaceAll("(\\[\\[)(.+)(\\|)(.+)(\\]\\])}", "$4"); has a } in it that appears to be a typo. If you remove it, the statement will pick up the , following text, and , and replace the entire match with the text following the | (group 4). That is, it will delete the , and the , which is kind of the opposite of what you want--you're deleting the things you want to keep, mostly, and keeping the things you want to delete.
answers question: http://stackoverflow.com/q/25494450
type: Answer

http://stackoverflow.com/comment/39806193
has text: i'm usins STS (Spring tool Suite) ..i found STS.ini at folder springsouce..
score: 0
comment on: http://stackoverflow.com/q/25501292
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39843578
comment on: http://stackoverflow.com/q/25521775
score: 1
type: Comment
has text: take a look this answer http://stackoverflow.com/a/5283123/1214847
type: QuestionComment

http://stackoverflow.com/comment/39703492
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25443962
type: Comment
has text: Hi @Fildor thank you for reply. I have entered the data in db. When I run the project in netbeans. Items are displayed in combobox. But after built when I run jar file There no such item displayed in combobox.

http://stackoverflow.com/comment/39753514
type: QuestionComment
has text: That output is suspicious to me... I always see specific mapping for each method. It may indeed indicate that nothing was actually mapped. Please try my above advice.
comment on: http://stackoverflow.com/q/25473192
score: 0
type: Comment

http://stackoverflow.com/comment/39839716
type: Comment
has text: after edit is better answer +1 but don't to mix updates out of EDT to model and refresh JTables view from TableModelListener (seems like as this is OPs issue)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25519488

http://stackoverflow.com/comment/39717134
score: 0
has text: @JBNizet no problem ! I want know if exist some Container to work with JPA at J2SE. As I did say at Vaadin I use JPAContainer that is a Container to JPA.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25453660

http://stackoverflow.com/a/25448392
score: 0
has comment: http://stackoverflow.com/comment/39706745
has body: You are probably getting timeout. You can use Socket.setSoTimeout(int timeout) to change timeout (in milliseconds).
answers question: http://stackoverflow.com/q/25448154
type: Answer

http://stackoverflow.com/a/34140623
has body: In my case nothing of these worked. But the final solution was very easy: rm -r ~/Library/Preferences/AndroidStudio[X.X]/codestyles/
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25507998
type: Answer

http://stackoverflow.com/a/25502418
has comment: http://stackoverflow.com/comment/111988795
accepted answer of: http://stackoverflow.com/q/25491424
has comment: http://stackoverflow.com/comment/39904314
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: If I understand your problem correctly, you struggle with the fact the name and bracket nodes in your xml are not children of a parent node, but just come after each other. I think a solution to get the correct name element when you have the bracket element is to use JSOUP's DOM navigation methods, i.e. previousElementSibling() Here what your loop could look like: Elements brackets = doc.getElementsByTag("bracket"); for (Element bracket : brackets) { Element lis = bracket.select("li"); Element name = bracket.previousElementSibling(); System.out.println(name.text()); for (Element li : lis){ System.out.println(li.text()); } }
answers question: http://stackoverflow.com/q/25491424
has comment: http://stackoverflow.com/comment/112025315
has comment: http://stackoverflow.com/comment/40039350
has comment: http://stackoverflow.com/comment/39901356

http://stackoverflow.com/q/25527971
type: Question
has comment: http://stackoverflow.com/comment/39856370
has comment: http://stackoverflow.com/comment/39857112
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/25202176
tagged with: web-services
has body: &lt;Request&gt; &lt;EMPId&gt;?&lt;/EMPId&gt; &lt;/Request&gt; I know this is a repeated question, but i would like to post it again as i dint get a convincing answer from any of the threads i went through. My ultimate aim is to add the XML given above as the Body content of a SOAP message. You can have a look at the following link to see how i am doing it. Namespace related error on creating SOAP Request It worked fine when i was using the Websphere Application Server 7.0 library.JRE is also present, forgot to include in screen shot. Since i have to export it as a jar and run it as a stand alone application, i have to remove the dependency of 'Websphere Application Server 7.0 library'. Because, by keeping this library, my jar size will go above 100MB. So i thought of taking only the library which i needed. 'com.ibm.ws.prereq.soap.jar' Now the issue is, the Request tag of the generated SOAP request is coming in following format. &lt;Request xmlns=""&gt; &lt;EMPId&gt;?&lt;/EMPId&gt; &lt;/Request&gt; I am able to create a 'org.w3c.dom.Document' representation for the generated SOAP message. Now, can any one tell me how can I delete the xmlns="" from Request tag.
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/75295908
has comment: http://stackoverflow.com/comment/39856775
linked to: http://stackoverflow.com/q/25479797
score: 0
has title: Remove empty namespace in java using DOM
answer count: 2
has comment: http://stackoverflow.com/comment/39856682
has comment: http://stackoverflow.com/comment/39854985
has comment: http://stackoverflow.com/comment/39856445
has comment: http://stackoverflow.com/comment/39856991
tagged with: java
has answer: http://stackoverflow.com/a/52812347
has answer: http://stackoverflow.com/a/75333305
tagged with: dom

http://stackoverflow.com/comment/39748871
comment on: http://stackoverflow.com/a/25470691
type: Comment
type: AnswerComment
score: 0
has text: Glad it solved your problem. :) Would be happy if you accept this as an answer :)

http://stackoverflow.com/comment/39734148
comment on: http://stackoverflow.com/q/25462376
score: 0
has text: _"What I found is that occasionally (actually it happens randomly quite often), the list wont be updated until i click on the (seemingly blank) list."_ - I've ran opened the file button 50 times and not once did the files not show.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25527212
tagged with: sockets
tagged with: multithreading
has body: I'm writing a multithreaded server which at the moment just receives a string and send it back capitalized. My problem is that the server doesn't detect when the connection to the client is lost and the client Handler thread is therefore kept running. I have a while loop which handles the client requests and I'd like to break out of this loop if the connection is closed/lost. This is the code of the ClientHandler try { inFromServer = clientSocket.getInputStream(); DataInputStream in = new DataInputStream(inFromServer); OutputStream outToServer = clientSocket.getOutputStream(); DataOutputStream out = new DataOutputStream(outToServer); while(!clientSocket.isClosed()){ if(in.available() > 0) { String str = in.readUTF(); //Should catch EOF System.out.println("[+] From " + clientSocket.getInetAddress() + " received: " + str); String response = str.toUpperCase(); out.writeUTF(response); } } System.out.println("[+] Closing client"); } catch (IOException e) { e.printStackTrace(); } I have tried to make the while loop like this: while(!clientSocket.isClosed() && inFromServer.read() != -1) But this isn't working... Any suggestions will be appreciated.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25527580
has title: Detect closed socket
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39854124
answer count: 1
has comment: http://stackoverflow.com/comment/39853448
type: Question
tagged with: serversocket
has answer: http://stackoverflow.com/a/25527580

http://stackoverflow.com/q/25416293
type: Question
answer count: 0
has title: Invalidate touch event
type: UnansweredQuestion
tagged with: android
downvote count: 0
upvote count: 1
tagged with: android-fragments
score: 1
tagged with: java
has body: I have an activity containing several fragments which the user can switch between. But I've found that if the user holds down a button, changes fragments, and only then releases the button, the button press registers upon release (even though the button is on a fragment that's not currently being shown), which can cause some strange effects. I would like to be able to make some call upon switching fragments that invalidates any currently ongoing touch events, so holding down a button while switching fragments will have no effect. Does there exist a way to invalidate all currenly ongoing touch events?
has comment: http://stackoverflow.com/comment/39713795
has comment: http://stackoverflow.com/comment/39647977
favorite count: 0

http://stackoverflow.com/a/25451138
accepted answer of: http://stackoverflow.com/q/25446442
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: It is possible for fields, but not for single lines of code. According to the FindBugs 3.0 documentation, the @SuppressFBWarnings annotation can be applied to [Target] Type, Field, Method, Parameter, Constructor, Package (In the edu.umd.cs.findbugs.annotations package, @SuppressFBWarnings and @SuppressWarnings are equivalent.) As you can see, LOCAL_VARIABLE and ANNOTATION_TYPE are not in the list. Although there is no @Target element on the annotation, FindBugs ignores it in these two cases.
answers question: http://stackoverflow.com/q/25446442

http://stackoverflow.com/q/25506188
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39814878
has title: Managing an Item from Listview created by code
has comment: http://stackoverflow.com/comment/39815668
score: 1
upvote count: 1
tagged with: java
tagged with: listviewitem
tagged with: eclipse
favorite count: 0
type: Question
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/39814738
has body: I'm learning a lot these days reading posts on stackoverflow, got all my doubts away on java programing with eclipse, but i started to make my custom codes and i got stuck on a situation, i created a clickable listview on code and i want to change the item's text size and align toward the listview layout, any tips? Obs.: I have only 1 item available by code, this is an experiment. Thanks in advance package com.example.aulasinterativas; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class Menu extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); try { setContentView(R.layout.menu); ListView mlistView = (ListView) findViewById(R.id.listView1); mlistView.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, new String[] { "Infantil", "1° ano", "2° ano", "3° ano", "4° ano", "5° ano", "6° ano", "7° ano", "8° ano", "9° ano", "1° ano do Ensino Médio", "2° ano do Ensino Médio", "3° ano do Ensino Médio" })); mlistView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).getText(), Toast.LENGTH_SHORT) .show(); String sText = ((TextView) view).getText().toString(); Intent intent = null; if (sText.equals("1° ano")) intent = new Intent(getBaseContext(), Menu1ano.class); if (intent != null) startActivity(intent); } }); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } And my XML file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android=…

http://stackoverflow.com/comment/39705310
type: AnswerComment
has text: Thanks for the reply, but I have checked that my system has only one JDK but have two JRE.
type: Comment
comment on: http://stackoverflow.com/a/25447327
score: 0

http://stackoverflow.com/q/25502552
has comment: http://stackoverflow.com/comment/39809709
tagged with: swing
linked to: http://stackoverflow.com/q/5863870
linked to: http://stackoverflow.com/q/22029808
has comment: http://stackoverflow.com/comment/39891225
linked to: http://stackoverflow.com/q/2687345
has title: Correctly implementing the MVC pattern in GUI development using Swing in Java
tagged with: model-view-controller
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3066590
has comment: http://stackoverflow.com/comment/39808106
has comment: http://stackoverflow.com/comment/39909223
accepted answer: http://stackoverflow.com/a/25556585
upvote count: 8
has comment: http://stackoverflow.com/comment/39824211
has answer: http://stackoverflow.com/a/25504123
possible better answer: http://stackoverflow.com/a/25504123
linked to: http://stackoverflow.com/q/4550492
tagged with: java
has comment: http://stackoverflow.com/comment/39939970
has comment: http://stackoverflow.com/comment/39909344
has comment: http://stackoverflow.com/comment/39810356
favorite count: 0
score: 8
type: Question
linked to: http://stackoverflow.com/q/23415221
linked to: http://stackoverflow.com/q/23725554
linked to: http://stackoverflow.com/q/15693321
answer count: 2
has answer: http://stackoverflow.com/a/25556585
has body: Firstly, I come from a big PHP background with MVC, when I started with PHP, I browsed a lot of times, to try my best and perfect my MVC-Like design in PHP. A lot of people like answered with answers which helped me a lot. But after starting GUI development in Swing, the answers about MVC in Swing are totally different. For instance, a model is also a view? According to Oracle's Suggestions TextElementModel doesn't have any logical business here, all it does is markup (set color etc) and setting data such as set text and so on. When I developed in PHP, there is no such thing as AbstractModel because I always got told that a model is not a class, or more, it's a whole layer that processes logical business. In PHP I used Services, Data Mappers and Domain Objects, suggested from this amazing answer which helped me in PHP a lot: How should a model be structured in MVC? My attempt After reading again, I thought to give it a go and do a similar thing in Java: I have the ControllerContainer which creates all controllers: public class ControllerContainer { private JFrame frame; public ControllerContainer(JFrame rune) { this.frame = frame; } public void initControllers() { Atest test = new Atest(frame); test.registerView("test", new ViewTest(test)); } } As you see, I add the view named "test" with instance of ViewTest to the controller, now it will be visible in the frame, and can take input. My Controller class, which should be abstract, but I didn't make it abstract yet: public class Controller { private JFrame frame; private Map&lt;String, Component&gt; views = new HashMap&lt;String, Component&gt;(); public Controller(JFrame frame) { this.frame = frame; } protected void registerView(String title, Component c) { this.views.put(title, c); this.frame.add(c); } protected void deregisterView(String title) { this.frame.remove(this.views.get(title)); this.views.remove(title); } protected Component getView(String title) { return this.views.get(title); } } And an test controller: …
tagged with: user-interface
downvote count: 0

http://stackoverflow.com/comment/39618010
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25400382
has text: Do you know about appyet.com ?
type: Comment

http://stackoverflow.com/q/25517787
has comment: http://stackoverflow.com/comment/39854280
type: Question
has comment: http://stackoverflow.com/comment/39859356
has comment: http://stackoverflow.com/comment/39860627
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25530032
has title: Using the Visitor Pattern with JavaCC and JJtree
tagged with: javacc
has comment: http://stackoverflow.com/comment/39891628
tagged with: java
downvote count: 0
score: 1
upvote count: 1
has body: I wrote a scanner and parser using JavaCC and JJtree that generates an abstract syntax tree, and then I wrote a PrintVisitor class with a Visitor object for each node in the tree. However, after running the jjt file through JJtree and JavaCC, the Java compiler gave me this error: PrintVisitor.java:1: error: PrintVisitor is not abstract and does not override abstract method visit(Command, Object) in GrammarVisitor The reader will note that only one visitor object caused this error, even though I had many other visitor objects implemented in the exact same way for the other nodes in the tree. Why does only visit(Command, Object) cause an error, and how do I fix it?
answer count: 1
tagged with: visitor-pattern
has comment: http://stackoverflow.com/comment/39857336
favorite count: 0
has comment: http://stackoverflow.com/comment/39854407

http://stackoverflow.com/comment/39869277
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25535555
score: 0
has text: Thank you for changing the code to work in java. It works flawlessly now. Here is the final code: http://pastebin.com/iGJ8Fx1r Java should add a contains method for arrays, it will make some things easier.

http://stackoverflow.com/comment/39693588
type: AnswerComment
type: Comment
has text: You can, But however you can also use the Simple activity to show up the edittext and get password :)
comment on: http://stackoverflow.com/a/25441175
score: 0

http://stackoverflow.com/q/25457242
has title: Uber API: Specify multiple scopes while requesting or issuing a token returns Invalid Request Paramenters
has answer: http://stackoverflow.com/a/26569175
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/30108924
tagged with: java
score: 2
answer count: 2
tagged with: oauth
has body: I know that the OAuth 2.0 specs allows to specify multiple scopes while requesting or issuing a token, but Uber doesn't like the multiple scopes. For example: 1) [No error] parameters = { 'response_type': 'code', 'redirect_uri': 'INSERT_ROUTE_TO_STEP_TWO', 'scope': 'profile', } Returns correct token and I can retrieve the user profile via 'https://api.uber.com/v1/me' 2) [Error] parameters = { 'response_type': 'code', 'redirect_uri': 'INSERT_ROUTE_TO_STEP_TWO', 'scope': 'profile%20history', } Uber returns "Invalid Request Parameters". I tried 'scope': 'profile%20history' and 'scope': 'profile history'. Both cases returns the same error. I'm an Android developer using https://github.com/twotoasters/AndrOAuth as a test. Thanks
upvote count: 2
type: UnansweredQuestion
tagged with: oauth-2.0
downvote count: 0

http://stackoverflow.com/q/25488370
downvote count: 2
answer count: 1
has body: I have gone through resources on building chat application using socket programming in java. In every implementation people try to make a server which runs in infinite loop, accepting the connections from client and creating a separate thread for handling the chat. I want to make a chat application in which a new dialog/chat window pops when someone wants to chat with me (on client side). But the catch is that i have only one socket through which i am connected to server. all the messages has to be sent through this streams, currently i am thinking of some adhoc approaches for directing output to different client windows but i am sure that there must be some elegant way to do this.
favorite count: 0
type: Question
type: UnansweredQuestion
score: -2
tagged with: sockets
tagged with: chat
has answer: http://stackoverflow.com/a/25488511
has title: how do typical chatting application like yahoo messenger implement chatting with different users?
has comment: http://stackoverflow.com/comment/39781479
upvote count: 0
tagged with: java

http://stackoverflow.com/a/25827738
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25493986
type: Answer
has body: Oracle switched to a different installer. As always such big changes have side effects. The fact that the path now includes the full version number could well be completely unintentionally. Hint: You could extract the path from the registry (this example is for 32bit windows) [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8] "JavaHome"="C:\\Program Files\\Java\\jre1.8.0_20" Regarding the installer changes: While the installer is still an installer.exe inside an msi inside an installer.exe, many things were changed and some improved. For example the msi is now self-contained (no separate cab archive for files, no separate mst file for translations to other languages, the translations now also affects the main menu entries). However the old msi could be extracted with 7zip, the new one has an empty file table, just the two binaries installerexe and uninstallerexe. These are just some visible symptoms, internally there must be more changes.

http://stackoverflow.com/q/25507562
score: 11
tagged with: dictionary
has answer: http://stackoverflow.com/a/25507663
upvote count: 11
accepted answer: http://stackoverflow.com/a/25508040
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25508040
has body: Is there any way to replace a key using put() in a LinkedHashMap without losing the order that the key was originally inserted in?
tagged with: java
possible better answer: http://stackoverflow.com/a/25507663
downvote count: 0
favorite count: 0
type: Question
has title: Java LinkedHashMap replace key

http://stackoverflow.com/comment/39680025
comment on: http://stackoverflow.com/a/25433719
score: 0
type: AnswerComment
has text: @Bishal Arrays are also passed by value, but since they are Object(s) the value is a reference. Therefore, you can change the elements within the array without modifying the caller's reference. And that's why it works.
type: Comment

http://stackoverflow.com/comment/39778004
score: 1
type: Comment
type: AnswerComment
has text: And how does JPA know that it should be persisted as long?
comment on: http://stackoverflow.com/a/25486702

http://stackoverflow.com/a/25470695
answers question: http://stackoverflow.com/q/25470676
type: Answer
score: 3
upvote count: 3
downvote count: 0
has body: Your "p" class should be a modal JDialog, not a JFrame. This way the calling code will be on hold, and the user cannot work on the main window until the dialog window has been handled, which I think is your desired behavior. As an aside, you will want to learn and use Java naming conventions. Variable names should all begin with a lower letter while class names with an upper case letter. Also you should avoid using trivial variable names such as b or s unless they are being used for trivial purposes such as the index of a for loop. Instead use names that have some meaning so that your code becomes self-commenting. Following these suggestions as well as following good code formatting practices will allow others (such as us!) to better understand your code, and more importantly, will allow your future self to better understand just what you were thinking 6 months ago when you wrote the code. Also, you should avoid use of null layout as this makes for very inflexible GUI's that while they might look good on one platform look terrible on most other platforms or screen resolutions and that are very difficult to update and maintain.

http://stackoverflow.com/q/25530679
has answer: http://stackoverflow.com/a/25530785
possible better answer: http://stackoverflow.com/a/25530785
has title: Deal with huge JSON responses
tagged with: android
tagged with: jackson
has answer: http://stackoverflow.com/a/25530918
has answer: http://stackoverflow.com/a/25530913
accepted answer: http://stackoverflow.com/a/25530918
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39860453
tagged with: rest
has body: I think I need to rewrite some modules of my app because when the number of entities that are rendered increases, it fails and errors too. At this moment, I'm using Jackson and HttpClient. As much as I trust in Jackson, something tells me that the problem is the second lib. Can HttpClient deal with large responses? (e.g. this one that is about 400 lines) Besides that, in my app, the way I parse the request goes something like this: public Object handle(HttpResponse response, String rootName) { try { String json = EntityUtils.toString(response.getEntity()); // better "new BasicResponseHandler().handleResponse(response)" ???? int statusCode = response.getStatusLine().getStatusCode(); if ( statusCode >= 200 && statusCode < 300 ) { return createObject(json, rootName); } else{ return null; } } catch (Exception e) { throw new RuntimeException(e); } } public Object createObject (String json, String rootName) { try { this.root = this.mapper.readTree(json); String className = Finder.findClassName(rootName); Class clazz = this.getObjectClass(className); return mapper.treeToValue(root.get(rootName), clazz); } catch (Exception e) { throw new RuntimeException(e); } } How I can improve this piece of code to be more efficient with large responses? Thanks in advance!
answer count: 3
has comment: http://stackoverflow.com/comment/39866444
tagged with: java
type: Question

http://stackoverflow.com/q/25512426
type: Question
has answer: http://stackoverflow.com/a/25512581
type: AnsweredQuestion
tagged with: android-permissions
tagged with: android
tagged with: java
linked to: http://stackoverflow.com/q/9724428
favorite count: 0
upvote count: 4
has comment: http://stackoverflow.com/comment/39826638
answer count: 1
downvote count: 0
score: 4
has body: I'm trying to create an android application that can change the password of the device. I read about Device Administration Application I try to run this sample and this is my main activity code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Activity context = this; final String new_pass = ((EditText)findViewById(R.id.editext)).getText().toString(); ((Button)findViewById(R.id.button)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { DevicePolicyManager devicePolicyManager = (DevicePolicyManager)context.getSystemService(context.DEVICE_POLICY_SERVICE); ComponentName demoDeviceAdmin = new ComponentName(context, MainActivity.class); devicePolicyManager.setPasswordQuality( demoDeviceAdmin,DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED); devicePolicyManager.setPasswordMinimumLength(demoDeviceAdmin, 5); boolean result = devicePolicyManager.resetPassword("123456", DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY); Toast.makeText(context, "button_lock_password_device..."+result, Toast.LENGTH_LONG).show(); } }); } and I got this error: 08-26 22:36:51.280 15249-15249/co.rishe.secretpolice.app E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.SecurityException: No active admin ComponentInfo{com.example.secretpolice.app/com.example.secretpolice.app.MainActivity} at android.os.Parcel.readException(Parcel.java:1425) at android.os.Parcel.readException(Parcel.java:1379) at android.app.admin.IDevicePolicyManager$Stub$Proxy.setPasswordQuality(IDevicePolicyManager.java:1359) at android.app.admin.DevicePolicyManager.setPasswordQuality(DevicePolicyManager.java:323) at co.rishe.secretpolice.app.MainActivity$1.onClick(MainActivity.java:32) at android.view.View.performClick(View.java:4211) at android.view.View$PerformClick.run(View.java:17267) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92)…
accepted answer: http://stackoverflow.com/a/25512581
has title: How to change password programmatically?

http://stackoverflow.com/a/25497950
has comment: http://stackoverflow.com/comment/39838053
accepted answer of: http://stackoverflow.com/q/25497050
type: AcceptedAnswer
downvote count: 0
score: 1
has body: public void stretch() { Color.white.bind(); texture.bind GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0,0); GL11.glVertex2f(100,100); GL11.glTexCoord2f(1,0); GL11.glVertex2f(100+texture.getTextureWidth(),100); GL11.glTexCoord2f(1,1); GL11.glVertex2f(100+texture.getTextureWidth(),100+character.getTextureHeight()); GL11.glTexCoord2f(0,1); GL11.glVertex2f(100,100+texture.getTextureHeight()); GL11.glEnd(); // all the 0's were originally 100 but it was off centered } texture = TextureLoader.getTexture("PNG",ResourceLoader.getResourceAsStream("res/texture.png")); Try using this. This is usually how I do this.
answers question: http://stackoverflow.com/q/25497050
has comment: http://stackoverflow.com/comment/39816544
type: Answer
upvote count: 1

http://stackoverflow.com/a/27909108
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25506982
score: 0
has body: I know you have already achieved a solution although I would recommend you to make use of fileUpload(). Take a look at this example: @Test public void readString() throws Exception { MockMultipartFile file = new MockMultipartFile("file", "original_filename.ext", null, "data".getBytes()); webAppContextSetup(this.wac).build() .perform(fileUpload("/fileupload").file(file)) .andExpect(model().attribute("message", "Attachment uploaded successfully")); }
type: Answer
answers question: http://stackoverflow.com/q/25506982

http://stackoverflow.com/comment/39800164
type: QuestionComment
comment on: http://stackoverflow.com/q/25498276
has text: possible duplicate of [What is a NullPointerException, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it)
score: 1
type: Comment

http://stackoverflow.com/q/25490683
type: AnsweredQuestion
answer count: 2
upvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25490862
tagged with: swing
has answer: http://stackoverflow.com/a/25490862
downvote count: 1
favorite count: 0
type: Question
has title: How to update components of a JPanel if some action is performed in another JPanel?
has comment: http://stackoverflow.com/comment/39786089
accepted answer: http://stackoverflow.com/a/25490823
has comment: http://stackoverflow.com/comment/39786826
score: -1
has answer: http://stackoverflow.com/a/25490823
has body: I would like to update a JPanel if some action is performed in another JPanel. Example: A JPanel with BorderLayout contains the following: 1.) Class LabelPanel which extends JPanel and contains a JLabel that displays a value 2.) Class ButtonPanel which extends JPanel and contains a JButton If the user clicks the JButton, the value of the JLabel should be increased by 50 . The JLabel should somehow be called by an ActionListener listening to the JButton. How could you do that? MainPanel: public class MainPanel extends JPanel { public MainPanel() { this.setLayout(new BorderLayout()); this.add(new LabelPanel()); this.add(new ButtonPanel()); } } LabelPanel: public class LabelPanel extends JPanel { public LabelPanel() { this.add(new JLabel("Value: " + 0)); } } ButtonPanel: public class ButtonPanel extends JPanel { public ButtonPanel() { this.add(new JButton()); } }

http://stackoverflow.com/q/25504460
has comment: http://stackoverflow.com/comment/39811731
has title: Why there is access to package-private methods from different package if I evaluate expression during debug using IDE?
score: 0
tagged with: java
has body: For example if I have class A: class A { void xxx() {}; } and class B in different package: class B { public void yyy() { new A().xxx() // Wont compile, but can evaluate this expression during debug if put here breakpoint } }
has comment: http://stackoverflow.com/comment/39811431
type: Question
has comment: http://stackoverflow.com/comment/39811606
tagged with: intellij-idea
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/25407601
type: Answer
score: -1
upvote count: 0
downvote count: 1
has body: If you create json from php web service use this code echo utf8_encode(json_encode($result));
answers question: http://stackoverflow.com/q/25407433

http://stackoverflow.com/a/25488778
answers question: http://stackoverflow.com/q/25488334
type: Answer
score: 0
has body: Add script elements to the head section of your host page. If scripts are small and/or you do not use code splitting, there is little to no advantage in using a ScriptInjector. Verify with your browser console that the script loads correctly from a URL you provided.

http://stackoverflow.com/q/25519588
tagged with: java
tagged with: ubuntu-14.04
tagged with: netbeans
answer count: 0
tagged with: environment-variables
type: UnansweredQuestion
score: 1
downvote count: 0
has body: As i checkout my project in net beans 7.3.1,i got the following error "org.apache.subversion.javahl.ClientException: E175002: Processing REPORT request response failed: XML document structures must start and end within the same entity" if you know how to solve this kindly help me out.Since i am new to Ubuntu,also some please help me how to set the environmental variables for Java in Ubuntu?
upvote count: 1
has title: how to solve the net beans check out error org.apache.subversion.javahl.ClientException?
favorite count: 0
type: Question
tagged with: project

http://stackoverflow.com/q/25516557
has comment: http://stackoverflow.com/comment/39834849
has comment: http://stackoverflow.com/comment/39845587
has comment: http://stackoverflow.com/comment/39835127
tagged with: network-programming
score: 0
answer count: 0
type: UnansweredQuestion
has title: URLEncoder limits the response of the server
type: Question
tagged with: android
has body: I have the following problem.. when I hardcoded a url query which is like example : https://en.wikipedia.org/w/api.php?action=query&amp;list=geosearch&amp;gslimit=5&amp;gsradius=10000&amp;gscoord=51.4451254|5.4731413&amp;format=json (check the link in your browser) and I make the request to the server, I get the whole response in a string.. However when I make it dynamically I have to pass the "|" character, in URLEncoder.encode("|", "UTF-8") this format... In that case, the response is only one element of what I want.. Is it something that it is missing to me? Thanks in advance protected String doInBackground(String... query) { String response = ""; DefaultHttpClient client = new DefaultHttpClient(); HttpGet httpGet = null; // try { HttpResponse execute = null; try { //String searchTerm = URLEncoder.encode(query[0], "UTF-8"); httpGet = new HttpGet(query[0]); execute = client.execute(httpGet); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } InputStream content = null; try { content = execute.getEntity().getContent(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedReader buffer = new BufferedReader(new InputStreamReader( content)); String s = ""; try { while ((s = buffer.readLine()) != null) { response += s; } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return response; } The above part is my code.. the input query[0] is the url that I am requesting and it is similar to the link that I posted in the beginning. If I hardcoded the url (set directly the the link), I have the response. My response is a string in json format. (for now I let it string) If I make the query dynamically, for example like: gsQuery = mainPage + "&amp;gsradius=" + radius + "&amp;gscoord=" + lat…
tagged with: java
has comment: http://stackoverflow.com/comment/39840029
has comment: http://stackoverflow.com/comment/39841105

http://stackoverflow.com/comment/88988941
has text: @n.abing doesn't this trigger the success callback multiple times by passing status.ok each time you're sending a new callback?
comment on: http://stackoverflow.com/a/25484801
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39770463
type: Comment
has text: ok i' ll keep in mind, thanks a lot for the good explanations.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25482178

http://stackoverflow.com/q/25522770
has comment: http://stackoverflow.com/comment/39845614
accepted answer: http://stackoverflow.com/a/25529219
tagged with: servlets
has answer: http://stackoverflow.com/a/25529219
has comment: http://stackoverflow.com/comment/39845677
has comment: http://stackoverflow.com/comment/39854928
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: mysql
has title: mySql Column not found error occuring from servlet
answer count: 1
has body: I query a database to obtain all values from it.The query sometimes executes perfectly but at other times the query fails like this: select * from myTable where objtype='EQUI' and scnrtype='C' java.sql.SQLException: Column 'dataType' not found. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918) at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1162) at com.mysql.jdbc.ResultSetImpl.getCharacterStream(ResultSetImpl.java:2056) at com.hastha.marerp.googlemaps.DBUtils.getScreenFields(DBUtils.java:672) at com.hastha.marerp.googlemaps.DBUtils.getScreenFieldsJSON(DBUtils.java:754) at com.hastha.marerp.googlemaps.DynamicMenuItemBuilder.doGet(DynamicMenuItemBuilder.java:67) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) 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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apach…
has comment: http://stackoverflow.com/comment/39854504
has comment: http://stackoverflow.com/comment/39846336
has comment: http://stackoverflow.com/comment/39845464
type: Question
has comment: http://stackoverflow.com/comment/39845908
tagged with: jdbc
tagged with: sqlexception

http://stackoverflow.com/q/25400799
type: UnansweredQuestion
has body: The Android TTS allows you to set which speaker the speech comes out of by using map.put(TextToSpeech.Engine.KEY_PARAM_PAN, "-1"); or map.put(TextToSpeech.Engine.KEY_PARAM_PAN, "+1"); and then tts.speak(text, TextToSpeech.QUEUE_FLUSH, map); However you cannot do this for earcons as the parameter KEY_PARAM_PAN is not supported. Is there anyway of switching sounds as well? (It can be done using MediaPlayer as in this question Get media player to play first on right speaker and then on left speaker but that incurs significant overhead in terms of time so I cannot use it.)
tagged with: android
downvote count: 0
answer count: 0
tagged with: java
has title: How to switch earcons between the right and left speaker using Android TTS?
tagged with: text-to-speech
score: 1
upvote count: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/22367649

http://stackoverflow.com/comment/39890365
has text: I will be onLINE for at least 10 hours. Mayby even more. This is a temporary email I have set, contact me here when you can talk 5c0821f4@opayq.com .I will respond wethen 5 minutes after you send it.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25544758
score: 0

http://stackoverflow.com/a/25477124
accepted answer of: http://stackoverflow.com/q/25477109
answers question: http://stackoverflow.com/q/25477109
score: 6
type: Answer
upvote count: 6
type: AcceptedAnswer
downvote count: 0
has body: Because echo, start, rem etc aren't executable programs. They are shell commands. Only the command shell undertstands them. You have to run them with cmd /c echo cmd /c start chrome etc.

http://stackoverflow.com/q/25395233
tagged with: java
has comment: http://stackoverflow.com/comment/39608620
has answer: http://stackoverflow.com/a/25395513
has title: Why the regex is not working?
has comment: http://stackoverflow.com/comment/39609050
downvote count: 1
has comment: http://stackoverflow.com/comment/39608835
favorite count: 0
has comment: http://stackoverflow.com/comment/39608946
has comment: http://stackoverflow.com/comment/39608596
type: Question
has comment: http://stackoverflow.com/comment/39608893
has comment: http://stackoverflow.com/comment/39608665
has comment: http://stackoverflow.com/comment/39608612
type: UnansweredQuestion
answer count: 1
upvote count: 1
tagged with: regex
has body: I have this regular expression ^[-+]?\d+(\.\d+)?$ for a java pattern matches and I don't know why is not working. I need to accept numbers whit decimal point like this [+-]123 and [+-]123.123 but it accept [+-]123.123.123 to. What I have done bad? This is the method that check if my number is correct or not public void addPoint(){ String pattern = "^[-+]?\\d+(\\.\\d+)?$"; if(display.getText().matches(pattern)){ display.setText(display.getText()+"."); }else{ JOptionPane.showMessageDialog(null, "Error"); } }
score: 0
has comment: http://stackoverflow.com/comment/39608742
has comment: http://stackoverflow.com/comment/39611313
has comment: http://stackoverflow.com/comment/39610461

http://stackoverflow.com/a/25414911
has body: You're building JSON by hand, and doing it wrong. You need to learn the basic JSON syntax requirements A basic JSON-encoded object is {"key1":"value1","key2":"value with \" escaped internal quote"} Note all of the quotes. Your json string is a single very long object key with no associated value, which is not permitted. All keys must have values.
has comment: http://stackoverflow.com/comment/39645672
score: 1
has comment: http://stackoverflow.com/comment/39645700
has comment: http://stackoverflow.com/comment/39645872
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39645881
has comment: http://stackoverflow.com/comment/39645575
type: Answer
has comment: http://stackoverflow.com/comment/39645615
answers question: http://stackoverflow.com/q/25414884

http://stackoverflow.com/q/25422939
type: Question
has body: I have a JPanel where I dynamically add and remove sub-panels of different sizes. Therefore I am using MigLayout with absolute cell coordinates. In the following case the result is not what I expected. A simplified version of my code that illustrates the problem is the following: import java.awt.Color; import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import net.miginfocom.swing.MigLayout; public class MigLayoutDemo { private static final int CELL_WIDTH = 60; private static final int CELL_HEIGHT = 50; public static JPanel createBigPanel() { JPanel bigSubPanel = new JPanel(); bigSubPanel.setPreferredSize(new Dimension(3 * CELL_WIDTH, 2 * CELL_HEIGHT)); bigSubPanel.setBorder(BorderFactory.createLineBorder(Color.black)); bigSubPanel.setBackground(Color.LIGHT_GRAY); return bigSubPanel; } public static JPanel createSmallPanel() { JPanel smallSubPanel = new JPanel(); smallSubPanel.setPreferredSize(new Dimension(2 * CELL_WIDTH, CELL_HEIGHT)); smallSubPanel.setBorder(BorderFactory.createLineBorder(Color.black)); smallSubPanel.setBackground(Color.LIGHT_GRAY); return smallSubPanel; } public static JPanel createCellPanel() { JPanel cellSubPanel = new JPanel(); cellSubPanel.setPreferredSize(new Dimension(CELL_WIDTH, CELL_HEIGHT)); cellSubPanel.setBackground(Color.LIGHT_GRAY); return cellSubPanel; } private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("MigLayoutDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); // main panel where the sub-panels are placed in JPanel mainPanel = new JPanel(); MigLayout mg = new MigLayout("debug, gap 0 0"); mainPanel.setLayout(mg); mainPanel.add(createBigPanel(), "cell 0 0 3 2"); // [col row [span x [span y]]] mainPanel.add(createBigPanel(), "cell 3 0 3 2"); mainPanel.add(createSmallPanel(), "cell 6 0 2 1, align left top"); mainPanel.add(createSmallPanel(), "cell 6 1 2 1, align left top"); mainPanel.add(…
tagged with: miglayout
has title: MigLayout unexpected layout with absolute cell coordinates and spanning
has answer: http://stackoverflow.com/a/25544145
accepted answer: http://stackoverflow.com/a/25544145
type: AnsweredQuestion
score: 0
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25425153
tagged with: layout-manager
possible better answer: http://stackoverflow.com/a/25425153
tagged with: swing

http://stackoverflow.com/comment/39885863
comment on: http://stackoverflow.com/a/25535150
type: Comment
type: AnswerComment
has text: LogManager property "java.util.logging.SimpleFormatter.format" is exactly the format I specified. Yet the static `java.util.logging.SimpleFormatter.format` is the default format String and not the one I specified.
score: 0

http://stackoverflow.com/a/25443850
answers question: http://stackoverflow.com/q/25443680
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25443680
has comment: http://stackoverflow.com/comment/39704209
has comment: http://stackoverflow.com/comment/39700726
has comment: http://stackoverflow.com/comment/39700809
type: Answer
has comment: http://stackoverflow.com/comment/39701240
has body: Try inserting some dummy values instead of below: ContentValues defaultAcc = mapAccountToStorable(defaultAccDataModel = new AccountListRecyclerAdapter.AccountDataModel( LBudgetUtils.getInt(mContext, "default_account_id"), LBudgetUtils .getString(mContext, "default_account_name"), mContext.getResources().getBoolean( R.bool.default_account_selected))); Instead of sending nullColumnHack as null send it as "". It will make sure that a row will be created in table even if values are null. db.insert(ACCOUNTS_TABLE_NAME, "", defaultAcc) Try below: db.beginTransaction(); db.execSQL(createAccTableCmd); db.execSQL(oneAndOnlyOneSelectedAccInsertTriggerCmd); db.execSQL(oneAndOnlyOneSelectedUpdateTriggerCmd); db.setTransactionSuccessful(); db.endTransaction(); db.beginTransaction(); addTableName(ACCOUNTS_TABLE_NAME); AccountListRecyclerAdapter.AccountDataModel defaultAccDataModel; ContentValues defaultAcc = mapAccountToStorable(defaultAccDataModel = new AccountListRecyclerAdapter.AccountDataModel(LBudgetUtils.getInt(mContext, "default_account_id"), LBudgetUtils.getString(mContext, "default_account_name"), mContext.getResources().getBoolean(R.bool.default_account_selected))); Log.d("debug", "-1 if error on insert: " + db.insert(ACCOUNTS_TABLE_NAME, null, defaultAcc)); db.setTransactionSuccessful(); db.endTransaction(); Log.d("debug", "Size: " + db.query(ACCOUNTS_TABLE_NAME, null, null, null, null, null, ACCOUNT_KEY_ID + " ASC").getCount());
has comment: http://stackoverflow.com/comment/39703380

http://stackoverflow.com/comment/39642972
comment on: http://stackoverflow.com/q/25392025
score: 0
has text: Hi I was able to overcome this issue by creating provider for runtime exception.I am using 1.1.17.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25465808
accepted answer of: http://stackoverflow.com/q/25465750
has comment: http://stackoverflow.com/comment/39749367
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25465750
downvote count: 0
has comment: http://stackoverflow.com/comment/39739803
has comment: http://stackoverflow.com/comment/39748451
upvote count: 1
has body: I'm not entirely sure what you are trying to do, but as for the assignment to f and g, both give the same result, since you assign to it (byte) e which fits within a byte variable. If you would assign without casting, you'll get a diferent result, since the value of e is too large to fit within a byte. As for the results of toBinaryString, they obviously don't show leading zeroes, which is why you see the same result for a byte variable and an int variable holding the same value. If you want to see all the bits, you'll have to print the leading zeroes yourself, and the number of leading zeroes depend on the type of the variable (so, for a byte variable, you'll have to add leading zeroes to reach a total of 8 bits, for int you'll have to reach 32 bits, etc...). If you want to see the leading zeroes, you can make you own version of toBinaryString. Looking at an implementation of Integer, I found that toBinaryString calls toUnsignedString : public static String toBinaryString(int i) { return toUnsignedString(i, 1); } private static String toUnsignedString(int i, int shift) { char[] buf = new char[32]; int charPos = 32; int radix = 1 &lt;&lt; shift; int mask = radix - 1; do { buf[--charPos] = digits[i &amp; mask]; i &gt;&gt;&gt;= shift; } while (i != 0); return new String(buf, charPos, (32 - charPos)); } As you can see, this method returns only part of the 32 chars that represent the binary value of the int. If you return new String(buf) instead, you'll get the full binary String with leading zeroes.
type: Answer
has comment: http://stackoverflow.com/comment/39740090
has comment: http://stackoverflow.com/comment/39739831

http://stackoverflow.com/a/25417562
score: 0
answers question: http://stackoverflow.com/q/25417349
type: Answer
has body: I want to note that I achieved the 'refresh' of the database by calling: context.getContentResolver().notifyChange(Table1Provider.CONTENT_URI, null); context.getContentResolver().notifyChange(Table2Provider.CONTENT_URI, null); But I'm still curious about whether this setup is ideal. I know there are a lot of opinions about how things should be setup, so any thoughts are welcome.

http://stackoverflow.com/comment/39837449
comment on: http://stackoverflow.com/q/25518115
type: Comment
type: QuestionComment
has text: @markspace , yes, I understand. actually we use Azure for our .net websites mostly, and java-base site is only solr server, we have no resource to create a virtual machine now.
score: 0

http://stackoverflow.com/comment/101167799
type: AnswerComment
comment on: http://stackoverflow.com/a/36572820
has text: This works, but makes data inside `config.properties` vulnerable. If you decompile your .apk you will find every parameter as plain text inside. Should be used only if this content is not under secrecy.
type: Comment
score: 0

bit
tag name: bit
tags question: http://stackoverflow.com/q/25545107
type: Tag

http://stackoverflow.com/a/25406487
has comment: http://stackoverflow.com/comment/39629605
answers question: http://stackoverflow.com/q/25406330
has comment: http://stackoverflow.com/comment/39629925
has comment: http://stackoverflow.com/comment/39629844
downvote count: 0
has comment: http://stackoverflow.com/comment/39629489
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39630366
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25406330
has body: Use an OnClickListener instead of an OnTouchListener. ImageView star=(ImageView)findViewById(R.id.favorite); star.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { star.setImageResource(android.R.drawable.star_big_on); } }); Your code should look like that. You'll need to make the ImageView clickable as well either in XML (android:clickable="true") or in code (star.setClickable(true);). Conversely, you could use an ImageButton and set the image as the ImageButton's background. This way you don't have to worry about setting the View to be clickable, as it is inherently clickable.

http://stackoverflow.com/q/25476762
has title: Create webservice with configurable endpoint via Spring
type: Question
answer count: 1
tagged with: web-services
tagged with: spring
linked to: http://stackoverflow.com/q/3569075
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25477168
accepted answer: http://stackoverflow.com/a/25477168
has body: I have an application that is trying to access a webservice using generated classes via wsdl2java. I would like to be able to configure it so that I can use a different endpoint based on the environment (TEST/PROD). I found the following answer to be exactly what I was looking for https://stackoverflow.com/a/3569291/346666 However, I would like to use Spring to inject an instance of the service into my service layer - is there a pure Spring approach to the above? Or, is there a better way to inject an instance of a webservice into a class and still be able to dynamically configure the endpoint?
tagged with: java

http://stackoverflow.com/q/25440502
answer count: 1
has comment: http://stackoverflow.com/comment/39695229
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/14299149
type: Question
has body: Issue Unable to get Spring to add a resource handler for static resources. Background Information I have a Spring MVC webapp running in a standalone Jetty instance. My webapp structure is webapp root/ resources/ css/ images/ js/ WEB-INF/ layouts/ tiles.xml page.jsp lib/ views/ home/ home.jsp tiles.xml web.xml I've extended the WebMvcConfigurerAdaptor to add a resource mapping such that urls like company.com/myservlet/resources/css/main.css will get resolved to the webapp root/resources/css folder. @Configuration @EnableWebMvc public class WebMvcConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); } } My little controller is this: @Controller public class SpringAppController { public SpringAppController() { } @RequestMapping(value = "/home", method = RequestMethod.GET) public ModelAndView handleRequestHome(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { return new ModelAndView("home"); } } My web.xml is simply this: <?xml version="1.0" encoding="UTF-8"?> contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation com.company org.springframework.web.context.ContextLoaderListener admin org.springframework.web.servlet.DispatcherServlet contextConfigLocation 1 admin / encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encodingFilter /* hiddenHttpMethodFilter org.springframework.web.filter.HiddenHttpMethodFilter hiddenHttpMethodFilter /* My JavaConfig for the webapp to instantiate some mvc resolvers is this: @Configuration public class MainConfig { @Bean public ViewResolver viewResolver() { UrlBasedViewResolver viewResolver = new UrlBasedViewResolver(); viewResolver.setViewClass(TilesView.class); return viewResolver; } @Bean public TilesConfigurer tilesConfigurer() { TilesCo…
has comment: http://stackoverflow.com/comment/39692801
has answer: http://stackoverflow.com/a/25467720
accepted answer: http://stackoverflow.com/a/25467720
has comment: http://stackoverflow.com/comment/39704411
tagged with: spring
tagged with: servlets
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
has title: Spring MVC not loading static resources from webapp
has comment: http://stackoverflow.com/comment/39695891
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/39792067
has text: I had no end of problems while testing your example and I kept breaking it. IMHO it doesn't work "extremely" well in these situations. I also prefer real time/immediate feedback/validation but that's just me...
comment on: http://stackoverflow.com/a/25478766
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25543692
favorite count: 0
upvote count: 17
type: Question
possible better answer: http://stackoverflow.com/a/28874069
linked to: http://stackoverflow.com/q/20007164
has answer: http://stackoverflow.com/a/28874069
accepted answer: http://stackoverflow.com/a/25543856
has title: Spring Restfull Jax-RS annotation support
downvote count: 0
has answer: http://stackoverflow.com/a/25543856
has answer: http://stackoverflow.com/a/25544467
has body: I have following class and web.xml files. Does spring framework supports jax-rs annotation such as @PATH, and @PUT, @Consumes...etc. In other word can I use @PATH instead of @RequestMapping Java: import org.springframework.stereotype.Controller; import javax.ws.rs.PUT; import javax.ws.rs.Path; @Controller @Path("/register") public class RegisterServices { @PUT @Path("/create") @Consumes(MediaType.APPLICATION_JSON) @Produces({"application/json"}) public Response create(@Context HttpServletRequest requestContex, @HeaderParam("Authorization") String authorization, String xMsisdn, String param) {} } web.xml org.springframework.web.context.ContextLoaderListener Jersey REST Service /rest/* Jersey REST Service org.springframework.web.servlet.DispatcherServlet 1
tagged with: spring
type: AnsweredQuestion
tagged with: rest
answer count: 3
tagged with: java
score: 17
tagged with: jax-rs

http://stackoverflow.com/comment/39870391
comment on: http://stackoverflow.com/q/25536328
score: 0
type: QuestionComment
type: Comment
has text: If we ignore the infinite loop, the question is: Why the entire program is inside the constructor? WTF. The constructor should be used to create the object, not to execute the program.

http://stackoverflow.com/q/25421665
tagged with: runtime-error
has body: I have this strange error I do not know how to resolve. I test my App deployed straight to my phone and it's working ok. But now testing downloading from Play Store the app crash as startup and the error is this one: java.lang.RuntimeException: Unable to instantiate application com.bookit.android.BookItApp: java.lang.ClassNotFoundException: com.bookit.android.BookItApp I have this class: package com.bookit.android; public class BookItApp extends Application {...} My manifest I think it's ok defining the App class: &lt; application android:name="BookItApp" Or Maybe should I define: android:name = "com.bookit.android.BookItApp" UPDATE: this is my proguard-project.txt I don't know if it's ok. -keep class * extends java.util.ListResourceBundle { protected Object[][] getContents(); } -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { public static final *** NULL; } -keepnames @com.google.android.gms.common.annotation.KeepName class * -keepclassmembernames class * { @com.google.android.gms.common.annotation.KeepName *; } -keepnames class * implements android.os.Parcelable { public static final ** CREATOR;
answer count: 2
upvote count: 3
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25421858
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39658056
score: 3
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25422048
has title: Android deployed App unable to instantiate application

http://stackoverflow.com/q/25396918
type: Question
has answer: http://stackoverflow.com/a/25397583
possible better answer: http://stackoverflow.com/a/25397583
upvote count: 9
has answer: http://stackoverflow.com/a/42909578
score: 9
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25397072
accepted answer: http://stackoverflow.com/a/25397072
answer count: 3
tagged with: java
tagged with: uri
has title: How to construct a Path from a jar:file URL?
tagged with: jar
has body: How do I construct a Path to a jar:file URL? Invoking Paths.get(new URI("jar:file:/C:/foo.jar!/bar.html")) throws FileSystemNotFoundException (notice the file system is missing, not the file itself). As far as I can tell, both files exist. Any ideas?
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/39808666
comment on: http://stackoverflow.com/a/25502984
has text: @challenger3 If you have a grid and delete the label in the middle, there will be a hole - do you mean that with your broken layout?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39800858
has text: Yes but the question (as I read it) is about integer performance, not general performance.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25498722
type: Comment

http://stackoverflow.com/q/25434630
has comment: http://stackoverflow.com/comment/39687404
tagged with: admob
type: Question
linked to: http://stackoverflow.com/q/23353173
has body: I was working with adMob, on my emulator with a test ads:adUnitId public class BalloonDefense extends Activity { Surface view; WakeLock WL; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //full screen requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //ad--------------------------------------------------------------------------CHANGE ME 1 (change advert unit id) AdView ad = new AdView(this); ad.setAdUnitId("ca-app-pub-4270508386283746/3070375087"); ad.setAdSize(AdSize.BANNER); RelativeLayout layout = new RelativeLayout(this); //layout view = new Surface(this, this); LayoutParams params1 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params1.addRule(RelativeLayout.ALIGN_PARENT_LEFT); ad.setLayoutParams(params1); layout.addView(view); layout.addView(ad); setContentView(layout); //ad`enter code here` AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .build(); **ad.loadAd(adRequest);**` If it add ad.loadAd(adRequest);, the application is closes? Why? Thanks!
tagged with: android-layout
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/39681833
has title: ad.loadAd google play services
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27726826
answer count: 1
tagged with: eclipse

http://stackoverflow.com/q/25425894
tagged with: private-key
has body: I've been trying to crack this for several days now and I don't seem to get it working. Basically I got a .private file which is the result of the following command: dnssec-keygen -C -a DSA -b 1024 -n HOST -T KEY Hostmame The file is in a certain format ( I removed the values for security reasons) Private-key-format: v1.2 Algorithm: 3 (DSA) Prime(p): $value Subprime(q): $value Base(g): $value Private_value(x): $value Public_value(y): $value So my question is does anybody knows how to read this file and get a PrivateKey object form it to sign a message to send towards the secured DNS Server ? I've tried several things already, but I don't seem to get the right decoding for the values... things tried : The readDSAPrivateKey method of this link on github: https://github.com/bitsai/courses/blob/master/Network%20Security/A3/Honoroff-Tsai/src/DNSSEC.java Also tried this one: ObjectInputStream keyIn = new ObjectInputStream(new FileInputStream(args[3])); PrivateKey privkey = (PrivateKey) keyIn.readObject(); keyIn.close(); Any help or point outs would be appreciated...
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
has title: dnssec-keygen outputfile with DSA private key
favorite count: 0
type: Question
tagged with: dnssec
tagged with: dsa
tagged with: network-security
accepted answer: http://stackoverflow.com/a/25484954
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25484954

http://stackoverflow.com/comment/39772113
type: QuestionComment
score: 0
has text: How to kill the older one? I am totally new to it. So unaware
comment on: http://stackoverflow.com/q/25483534
type: Comment

mockito
tags question: http://stackoverflow.com/q/25543250
tags question: http://stackoverflow.com/q/25510847
tags question: http://stackoverflow.com/q/25443858
type: Tag
tags question: http://stackoverflow.com/q/25491515
tags question: http://stackoverflow.com/q/25495912
tags question: http://stackoverflow.com/q/25439358
tags question: http://stackoverflow.com/q/25409362
tags question: http://stackoverflow.com/q/25447369
tags question: http://stackoverflow.com/q/25520477
tag name: mockito
tags question: http://stackoverflow.com/q/25490375
tags question: http://stackoverflow.com/q/25460368
tags question: http://stackoverflow.com/q/25453125

http://stackoverflow.com/a/25548858
answers question: http://stackoverflow.com/q/25548699
score: 1
downvote count: 0
upvote count: 1
has body: The first argument to JNI_CreateJavaVM should be a valid pointer to JavaVM*: JavaVM* jvm1; int reAt = JNI_CreateJavaVM(&amp;jvm1, ...); In your example, jvm1 is uninitialized. Consult the documentation for details.
type: Answer

http://stackoverflow.com/q/25550474
has body: So, I've discovered that this is a very common problem for new Java programmers. Yet today is the first time I've run into it, after eight months of programming in Java. This program has been working perfectly well for quite some time now. I made a minor tweak to the Swing layout last night and finally had a chance to give it a try this morning when I got that error. The tweak I made could un-made, but I am fairly certain it is unrelated to this error. The error tells me that it occurs at the line: private CheckTreeTableSelectionListener selectionListener = new CheckTreeTableSelectionListener(); which resides in the field list at the top of the class. Here's the interesting bit: CheckTreeTableSelectionListener is an inner class. It is not external nor being imported. Also, I did not touch that inner class last night, nor did I touch the field that creates a new instance of it. Now I understand (barely) that the NoClassDefFoundError message means that the class definition could be found at compile-time, but not at runtime. This does not really help. If it is an inner class, how can it not be found? It's right there, inside the class that instantiates it! Edit As requested, here is the stacktrace: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: info/chrismcgee/sky/Scheduling$CheckTreeTableSelectionListener at info.chrismcgee.sky.Scheduling.&lt;init&gt;(Scheduling.java:165) at info.chrismcgee.sky.Scheduling$2.run(Scheduling.java:204) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:714) at java.awt.EventDispatchThread…
has comment: http://stackoverflow.com/comment/39897379
has comment: http://stackoverflow.com/comment/39898086
has comment: http://stackoverflow.com/comment/39896642
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39897399
has comment: http://stackoverflow.com/comment/39896496
has comment: http://stackoverflow.com/comment/39895935
has comment: http://stackoverflow.com/comment/39897245
tagged with: java
has title: NoClassDefFoundError for inner class
has comment: http://stackoverflow.com/comment/39896155
tagged with: noclassdeffounderror
has comment: http://stackoverflow.com/comment/39896061
score: 2
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39896169
has comment: http://stackoverflow.com/comment/39896304
has comment: http://stackoverflow.com/comment/39897492
has comment: http://stackoverflow.com/comment/39897643
downvote count: 0
has comment: http://stackoverflow.com/comment/39896569
has comment: http://stackoverflow.com/comment/39896303
has comment: http://stackoverflow.com/comment/39897848
has comment: http://stackoverflow.com/comment/39896115
answer count: 1
has comment: http://stackoverflow.com/comment/39897447
has answer: http://stackoverflow.com/a/25551635
accepted answer: http://stackoverflow.com/a/25551635
has comment: http://stackoverflow.com/comment/39896546
tagged with: swing
has comment: http://stackoverflow.com/comment/39896158

http://stackoverflow.com/comment/63525474
type: AnswerComment
has text: Well not sure what you mean by node.setFocusTraversible(true) because setting it true will allow a node to have focus.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25467653

http://stackoverflow.com/q/25549413
has comment: http://stackoverflow.com/comment/39897681
tagged with: css-selectors
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39922165
has answer: http://stackoverflow.com/a/25562067
favorite count: 0
accepted answer: http://stackoverflow.com/a/25562067
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39922219
has comment: http://stackoverflow.com/comment/39897752
has title: jsoup css selector: escape question mark
tagged with: java
linked to: http://stackoverflow.com/q/17335386
has body: Given a tag with class containing question mark mark-text should be blue How do I select it with jsoup selector? I tried doc.select("h2.\\?class-text") doc.select("h2.?class-text") doc.select("h2[class=?class-text]") doc.select("h2[class=\\?class-text]") but none of these works. This one works doc.select("h2[class*=class-text]") but I want to select exact match. JSFiddle for this UPD: doc.select("h2[class~=\\?class-text]") worked. But is there solution without regex?
type: Question
upvote count: 2
tagged with: jsoup

http://stackoverflow.com/q/25461741
tagged with: android
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39732197
has comment: http://stackoverflow.com/comment/50675505
has comment: http://stackoverflow.com/comment/50675970
score: 2
answer count: 0
upvote count: 2
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/2619584
has title: libGDX project generator: Build Failed : Cannot find java system compiler
has body: while generating a project libGDX throws thid error: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':core:compileJava'. &gt; Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED my java and jdk version : java version "1.7.0_65" OpenJDK Runtime Environment (IcedTea 2.5.1) (7u65-2.5.1-4ubuntu1~0.14.04.1) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode) What should i do? plz HELP!!
favorite count: 0
type: Question
tagged with: linux
tagged with: libgdx
type: UnansweredQuestion

http://stackoverflow.com/comment/39802664
has text: Well, just replace your ImageAdapter constructor with my code above and add a MediaPlayer field to your ImageAdapter class. Then, before or after the line `imageView.setImageResource(GalImages[position]);` add: `if(position == getCount()-1) this.mp.stop();`
comment on: http://stackoverflow.com/a/25493170
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39656871
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25419731
type: Comment
has text: Yeah dont worry, I will check and if needed I will do it manually

jakarta-ee
tags question: http://stackoverflow.com/q/25498329
tags question: http://stackoverflow.com/q/25534559
tags question: http://stackoverflow.com/q/25476074
tags question: http://stackoverflow.com/q/25439927
tags question: http://stackoverflow.com/q/25399345
tags question: http://stackoverflow.com/q/25407289
tags question: http://stackoverflow.com/q/25506064
tags question: http://stackoverflow.com/q/25454300
tags question: http://stackoverflow.com/q/25502566
tags question: http://stackoverflow.com/q/25488277
tags question: http://stackoverflow.com/q/25434176
tags question: http://stackoverflow.com/q/25423461
tags question: http://stackoverflow.com/q/25400883
type: Tag
tags question: http://stackoverflow.com/q/25533343
tags question: http://stackoverflow.com/q/25522226
tags question: http://stackoverflow.com/q/25392025
tags question: http://stackoverflow.com/q/25519894
tags question: http://stackoverflow.com/q/25480229
tags question: http://stackoverflow.com/q/25412556
tags question: http://stackoverflow.com/q/25427484
tags question: http://stackoverflow.com/q/25403343
tags question: http://stackoverflow.com/q/25463510
tags question: http://stackoverflow.com/q/25499553
tags question: http://stackoverflow.com/q/25524121
tags question: http://stackoverflow.com/q/25479412
tags question: http://stackoverflow.com/q/25496748
tags question: http://stackoverflow.com/q/25534772
tags question: http://stackoverflow.com/q/25491646
tags question: http://stackoverflow.com/q/25403012
tags question: http://stackoverflow.com/q/25459252
tags question: http://stackoverflow.com/q/25447569
tags question: http://stackoverflow.com/q/25500735
tags question: http://stackoverflow.com/q/25433600
tags question: http://stackoverflow.com/q/25430395
tags question: http://stackoverflow.com/q/25390272
tags question: http://stackoverflow.com/q/25465771
tags question: http://stackoverflow.com/q/25426272
tags question: http://stackoverflow.com/q/25448443
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/25529523
tags question: http://stackoverflow.com/q/25465778
tags question: http://stackoverflow.com/q/25462002
tags question: http://stackoverflow.com/q/25448916
tags question: http://stackoverflow.com/q/25515171
tags question: http://stackoverflow.com/q/25487653
tags question: http://stackoverflow.com/q/25495128
tags question: http://stackoverflow.com/q/25422084
tags question: http://stackoverflow.com/q/25533616
tags question: http://stackoverflow.com/q/25398872
tags question: http://stackoverflow.com/q/25469052
tags question: http://stackoverflow.com/q/25488260
tags question: http://stackoverflow.com/q/25530394
tags question: http://stackoverflow.com/q/25426914

http://stackoverflow.com/q/25443038
has body: I have a text like this: ASD.123.av.234.X_975.dfgdfg and i wish to round it up to: .123.234. "\\.[0-9]+\\." this represents my current pattern to select the .number. but negative lookahead didnt work for me: "(?!^\\.[0-9]+\\.)" do you guys have any ideea how to achieve this?
has answer: http://stackoverflow.com/a/25443186
answer count: 4
has title: Regular expression to remove everything but a specific format
has answer: http://stackoverflow.com/a/25443130
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/25443194
has answer: http://stackoverflow.com/a/25443193
type: Question
type: UnansweredQuestion
tagged with: regex

http://stackoverflow.com/q/25525646
has answer: http://stackoverflow.com/a/25525736
tagged with: java
has comment: http://stackoverflow.com/comment/39850427
downvote count: 3
has body: what does it mean it's a array or it's a list type string List&lt;String&gt; list = new ArrayList&lt;String&gt;(); // why parenthesis List&lt;String&gt; removeList = new ArrayList&lt;String&gt;();//why parenthesis and this method so What is the deference between List and Collection and arrys // what mean this collection private void removeColors(Collection&lt;String&gt; collection1,Collection&lt;String&gt; collection2) { Iterator&lt;String&gt; iterator = collection1.iterator();//what does mean while(iterator.hasNext())//what does mean if(collection2.contains(iterator.next()))//what does mean iterator.remove();//what does mean }
tagged with: collections
accepted answer: http://stackoverflow.com/a/25526210
has comment: http://stackoverflow.com/comment/39850225
type: Question
has answer: http://stackoverflow.com/a/25525755
score: -3
linked to: http://stackoverflow.com/q/8028892
has comment: http://stackoverflow.com/comment/39850325
answer count: 4
has answer: http://stackoverflow.com/a/25525829
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25526210
tagged with: list
has title: API java List and Collection
possible better answer: http://stackoverflow.com/a/25525736
favorite count: 0
has comment: http://stackoverflow.com/comment/39850309
tagged with: api
upvote count: 0

http://stackoverflow.com/comment/39724631
type: Comment
comment on: http://stackoverflow.com/a/25457542
score: 0
has text: Thanks, I managed to sort it out now and you're right, thanks for the link especially though, its what I want when I'm try to learn something new!
type: AnswerComment

http://stackoverflow.com/a/25493747
has comment: http://stackoverflow.com/comment/39798816
has body: I agree with @nempoBu4 on Issues 1 and 2. I disagree with the answer to Issue 3. A received message can be removed from the inbox, so checking $Inbox doesn't help you distinguish between sent and received messages. Assuming you have the document open, the best approach is to check two items. Sent and received messages both have a PostedDate item, but only a received message has a DeliveredDate item. Incidentally, a draft message has neither PostedDate or DeliveredDate.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25479687

http://stackoverflow.com/a/25403100
type: Answer
downvote count: 0
has body: I think there is no other way to modify a javax.json.JsonObject. You should consider using jackson-databind.
upvote count: 1
answers question: http://stackoverflow.com/q/25402149
score: 1

http://stackoverflow.com/comment/39848520
score: 0
type: Comment
type: QuestionComment
has text: Oracle can show you: http://docs.oracle.com/javase/tutorial/essential/concurrency/ :)
comment on: http://stackoverflow.com/q/25524556

http://stackoverflow.com/a/25444581
has body: I don't think you can translate that xml to @Transactional. That annotation is to be placed on methods and/or classes and the usage is different. You need to think differently: for example, if you have a class with many get* methods then you place a @Transactional(readOnly=true) at class level and then for each method you don't want to be readOnly you place another @Transactional(readOnly=false). Also, you can place @Transactional on interfaces and if you can create interfaces common for many classes you can define the transactional behavior in one place: in the interface.
type: Answer
has comment: http://stackoverflow.com/comment/39731378
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25421540

http://stackoverflow.com/comment/39871053
type: Comment
has text: Layout is Free Design. Its the default setting in Netbeans
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25536615

http://stackoverflow.com/q/25484261
type: UnansweredQuestion
answer count: 1
tagged with: embedded-tomcat-7
tagged with: tomcat7
tagged with: war
type: Question
has title: Loading resources in Tomcat
score: 0
tagged with: java
tagged with: web-inf
has answer: http://stackoverflow.com/a/25484603
has body: I am trying a simple web application in tomcat 7. It has a javascript call in the index.html which loads a properties file. Using the below code to make a get call, var req = new XMLHttpRequest(); req.open("GET", "xyz.properties"); req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { } } } req.send(); Tried the following usecases, Kept the properties file directly inside the war file, i.e. outside WEB-INF - This works. Kept it under WEB-INF/classes - Did not work. Wrapped it in a jar and kept it under WEB-INF/lib - Did not work. Put the jar under Tomcat/lib - Did not work. As far as i understand, every resource/class request goes through the WebAppClassloader, which look at things in the following order, Jvm Boot Strap system loader web-inf/classes web-inf/lib shared/lib In my actual application i am using an embedded tomcat and the goal is to externalize(out side of the war) the property file via a jar. Hence the above tests to understand the basic resource loading for tomcat. Can someone throw some light around what's missing with the above tests. Typically if the get request goes through the class loader, shouldn't it be able to find the file in all cases.

http://stackoverflow.com/a/25549557
type: Answer
has body: Add the webupd8 ppa, and install from that - sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer Then java -version should show you using Oracle Java 8. If not, or if you want to use a different version - run update-java-alternatives with something like, sudo update-java-alternatives -s java-8-oracle or sudo update-java-alternatives -s java-7-oracle As appropriate.
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/39895072
downvote count: 0
has comment: http://stackoverflow.com/comment/39895012
answers question: http://stackoverflow.com/q/25549492

http://stackoverflow.com/comment/39837203
has text: I've attached an example that's closer to my actual code.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25517706

http://stackoverflow.com/comment/39741123
type: AnswerComment
has text: Two questions. I think this goes back to what I posted first. The keys on the user role set table doesn't correspond to the correct user_ID which is the primary key on users table. I need to make sure that they have a relationship. The right amount of entries are there in the user role set table but it seems that first user that I persist also is key for every user within that test. My second question is how would I label the columns for the user role set table? Its gets defaulted by JPA when the table gets created.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25464957

http://stackoverflow.com/comment/39755755
score: 0
has text: You mean the .properties file?
type: AnswerComment
comment on: http://stackoverflow.com/a/25474061
type: Comment

http://stackoverflow.com/q/25430596
upvote count: 2
type: UnansweredQuestion
tagged with: thread-synchronization
downvote count: 0
tagged with: event-bus
favorite count: 0
type: Question
tagged with: singleton
tagged with: java
has body: I am new to Java and pulling some hair out on the application I'm working on. Here is what I am trying to do. I have a client / server setup where I use QuickServer as the server. I got that up and running well. It sends and receives commands line by line with "\r"\n" so I have my client in a public class CommandHandler extends Thread { public void run() { while (connected) { //read and write if (command.equals("USERNAME")) { AsynchEventBusSingleton.$().postEvent(new TellParentToGiveUN()) } ... } } My GUI freezes if I do not extend Thread so I presume the CommandHandler needs its own thread. The problem however is the AsyncEventBusSingleton. public class AsyncEventBusSingleton { private EventBus ebEventBus = null; final static AsyncEventBusSingleton aebInstance = new AsyncEventBusSingleton(); public synchronized static AsyncEventBusSingleton $() { return aebInstance; } private AsyncEventBusSingleton() { ebEventBus = new AsyncEventBus(Executors.newCachedThreadPool()); } public void registerSubscriber(Object subscriber) { ebEventBus.register(subscriber); } public void unRegisterSubscriber(Object subscriber) { ebEventBus.unregister(subscriber); } public synchronized void postEvent(Object e) { ebEventBus.post(e); } } When I call this class inside CommandHandler thread none of my other classes on the main thread receive the events. If I remove the "synchronized" keyword some of the events are received/repeated/an error is generated. Everything seems to work fine if don't throw events from CommandHandler, but rather pass a reference of the class that instantiates the CommandHandler and have it call CommandHandler's methods: public class ServerConnectionHandler { private CommandHandler commandhandler; public void ConnectToServer() { commandhandler = new CommandHandler(this); } public void dispatchServerEvent() { commandhandler.sendResponse("MyUN"); } } public class CommandHandler extends Thread { private PrintWriter printWriter; private ServerConnectionHandler serverconnec…
has title: AsynchEventBus, Singleton, Threads, and Java
answer count: 0
score: 2

http://stackoverflow.com/comment/39735677
has text: It is showing error: The method setText(CharSequence) in the type TextView is not applicable for the arguments (double)
comment on: http://stackoverflow.com/a/25463053
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25431546
type: Question
has body: I'm creating chat program. At first, I send message to server from client and server should get message, but the message is not sent to the server until I shut down client. Here is my code: Client: private Socket Client; private Thread RunClient; private JButton Send; private int Port=8000; private String Host="localhost"; public void init() {//Here we connecting to server Send=new JButton(); Send.setFont(new Font("Times New Roman", Font.BOLD, 15)); Send.setLocation(575,Text.getHeight()+15);//395 Send.SetBorderColor(Color.cyan); Send.setForeground(Color.white); Send.setText("Send"); Send.setSize(30,70); Send.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SendButton_Click(e); } }); try { InetAddress address = InetAddress.getByName(Host); Client = new Socket(address, Port); System.out.println("Client started. Port: "+Port+"\n"); }catch(Exception e){ System.out.println("Error:"+e); } } public void SendButton_Click(ActionEvent e) {//Here we sending message to server String sendMessage = "hi"; try { sendMessageToServer(Client,sendMessage);//sending message to server } catch (IOException e1) { e1.printStackTrace(); } System.out.println("Message sent to the server : "+sendMessage); } } private void sendMessageToServer(Socket socket,String message) throws IOException { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); writer.write(message); writer.flush(); } Here is server: private int Port=8000; public void init() {//Here we starting server and starting thread try { serverSocket = new ServerSocket(Port); System.out.println("Server on. Port: "+Port+"\n"); } catch (IOException e1) { e1.printStackTrace(); } RunServer = new Thread() { public void run() { ServerLoop(); } }; RunServer.start(); } public void ServerLoop() {//here we should receive message.. while(true) { System.out.println("Server loop"); try { Socket clientSocket = serverSocket.accept(); InputStreamReader inputstreamreade…
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/25431931
type: AnsweredQuestion
upvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/25431931
downvote count: 1
has title: Send message to server java
has comment: http://stackoverflow.com/comment/39675987
has comment: http://stackoverflow.com/comment/39675943
has comment: http://stackoverflow.com/comment/39676037
has comment: http://stackoverflow.com/comment/39675937
has answer: http://stackoverflow.com/a/25431683
accepted answer: http://stackoverflow.com/a/25431683
favorite count: 0

http://stackoverflow.com/comment/39788902
type: AnswerComment
has text: You could also try java -cp "./WEB-INF/lib/*" -jar my_uncool.jar which should add all the jars including in subfolders.
comment on: http://stackoverflow.com/a/25491960
type: Comment
score: 0

http://stackoverflow.com/q/25545829
answer count: 2
tagged with: multithreading
downvote count: 0
has title: Java. Determine two method invocations have similar thread context
tagged with: stack-trace
upvote count: 1
has comment: http://stackoverflow.com/comment/39888900
favorite count: 0
score: 1
possible better answer: http://stackoverflow.com/a/25546217
type: Question
has answer: http://stackoverflow.com/a/25546217
tagged with: java
has body: I'm trying to implement a tricky thing and need some fresh ideas. The problem is: Imagine Component1, that is performing some action for each User in a collection. Just like for (User user : users) { doSomeStuff(user); } These actions have some common parts, that are time-consuming, so the goal is to perform them only once (they include some database queries and so on). Imagine one of this time consuming methods: public Object buildSomething(Object context) { // some business logic here } The idea was to store the result and share it for other users, like this public Object buildSomething(Object context) { if (sharedResource.contains('something') { return sharedResource.get('something'); } else { // some business logic here sharedResource.put('something', something) return something; } } The riddle is - how to implement this shared resource? Must say, this is a huge multi layer web application and we can't just change doSomeStuff method and add a context holder parameter there, or something similar. I analyzed the following variants: Session scope bean (the one that makes the buildSomething stuff) Problems: User can logout from application, login with another username/pass, he will still have same Http session and that means he will get the same bean with previous request state upd: Another problem of using session scope is spring based thread pool scheduler, that can invoke Component1 without any http session. ThreadLocal variable Problems: We are in a web application context, and when thread is returned to pool, it can be used for other user requests I tried to find a workaround for second problem and my question is: Is it possible to analyze stack trace elements and ensure, that two invocations of buildSomething method were caused by a single user request? Tx for attention
accepted answer: http://stackoverflow.com/a/30756406
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30756406

http://stackoverflow.com/q/25533726
answer count: 1
downvote count: 1
score: -1
has title: Search using Regex in Java
favorite count: 0
type: Question
has body: I have an array of strings (or ArrayList) something like: strMain = "S1R2G3M1D1N3"; The strMain consists of several alphabet followed by digits as suffix. Also I have a string something like: str1 = "S1,,--R2,,,,D3-N3"; I need to see if each S1, R2, D3 and N3 in str1 are part of the array of the string strMain. I could not figure out how to do this. I guess I need to split str1 such that I get only "letters followed by the digit" into an array. Then I could check the presence of these strings in strMain. Can anyone suggest the regex in-order to split? Is there any other way we could check the presence without splitting (instead use regex to search for the presence) Can you tell me the regex for splitting this?
has comment: http://stackoverflow.com/comment/39865239
accepted answer: http://stackoverflow.com/a/25533937
has comment: http://stackoverflow.com/comment/39865580
tagged with: regex
linked to: http://stackoverflow.com/q/24656131
tagged with: replace
type: AnsweredQuestion
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25533937

http://stackoverflow.com/q/25402763
tagged with: java
answer count: 1
has title: SWT ScrolledComposite Hand Tool: Scroll Proportional To Mouse Movement
favorite count: 0
type: Question
tagged with: swt
has body: I would like to implement a "hand tool" with which the user can scroll/move something with the mouse. This feature is known from various programs such as Gimp. If the user presses the left mouse button, the tool should be activated. If the mouse is now moved, the underlying object should also be moved - proportional to the mouse movement. Hence, if the user presses the mouse and moves it by e.g. 10px, the underlying object should also be moved by 10px. I thought that it should work with my code below, but it does not work properly. The movement of the underlying ScrolledComposite is too fast. The code below is ready-to-run, so you can directly play with it. import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseMoveListener; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class HandTool { public static boolean moveGraphActive = false; public static Point moveStartPos = new Point(0, 0); public static ScrolledComposite sc; public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); sc = new ScrolledComposite(shell, SWT.V_SCROLL); Text text = new Text(sc, SWT.MULTI | SWT.READ_ONLY); String multiLineText = ""; for (int i = 0; i &lt; 30; i++) { multiLineText += "Hello World SWT " + i + System.lineSeparator(); } text.setText(multiLineText); text.setEnabled(false); text.pack(); sc.setContent(text); sc.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { moveGraphActive = e.button == 1; if (moveGraphActive) { moveStartPos.x = e.x; moveStartPos.y = e.y; } } @Override public void mouseUp(final MouseEvent e) { moveGraphActive = false; } }); sc.addMouseMoveListener(…
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25403049
accepted answer: http://stackoverflow.com/a/25403049
score: 1
upvote count: 1

http://stackoverflow.com/a/25517948
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25517451
upvote count: 1
has comment: http://stackoverflow.com/comment/39837263
downvote count: 0
type: Answer
has body: To store a function of type () =&gt; Unit in your actions map you should declare the the type to be HashMap[String, () =&gt; Unit]. Looking at your code, it looks like readf has a return value of Unit so: actions += "check_cup" -&gt; readf("coffee", 1, doTest) is actually trying to put a mapping of "check_cup" -&gt; Unit into the map. This is most likely not what you want. You probably want: def readf(valueName: String, sufficient: Int, f:() =&gt; Unit): () =&gt; Unit = if (values(valueName) &gt; sufficient) f else () =&gt; Unit
has comment: http://stackoverflow.com/comment/39837591
accepted answer of: http://stackoverflow.com/q/25517451
score: 1

http://stackoverflow.com/q/25463081
type: Question
tagged with: parse-platform
tagged with: android-fragments
has body: While trying to retrieve information from Parse such as string, number, and image, I have received the following error: In particular, I am receiving error from ParseImageView, where the strings and numbers are well retrieved. The logcat message 08-23 13:25:28.269: E/AndroidRuntime(1377): FATAL EXCEPTION: main 08-23 13:25:28.269: E/AndroidRuntime(1377): Process: com.dooba.beta, PID: 1377 08-23 13:25:28.269: E/AndroidRuntime(1377): java.lang.NullPointerException 08-23 13:25:28.269: E/AndroidRuntime(1377): at com.dooba.beta.Fragment1$1$1.done(Fragment1.java:184) 08-23 13:25:28.269: E/AndroidRuntime(1377): at com.parse.ParseImageView$1.done(ParseImageView.java:157) 08-23 13:25:28.269: E/AndroidRuntime(1377): at com.parse.GetDataCallback.internalDone(GetDataCallback.java:20) 08-23 13:25:28.269: E/AndroidRuntime(1377): at com.parse.GetDataCallback.internalDone(GetDataCallback.java:1) 08-23 13:25:28.269: E/AndroidRuntime(1377): at com.parse.Parse$6$1.run(Parse.java:888) 08-23 13:25:28.269: E/AndroidRuntime(1377): at android.os.Handler.handleCallback(Handler.java:733) 08-23 13:25:28.269: E/AndroidRuntime(1377): at android.os.Handler.dispatchMessage(Handler.java:95) 08-23 13:25:28.269: E/AndroidRuntime(1377): at android.os.Looper.loop(Looper.java:136) The XML layout <?xml version="1.0" encoding="utf-8"?> <com.parse.ParseImageView android:id="@+id/profilePictureresult" android:layout_width="132dp" android:layout_height="120dp" android:layout_below="@+id/userlistheadline" android:layout_centerHorizontal="true" android:layout_marginTop="17dp" android:alpha="1" android:background="@drawable/border_image" android:cropToPadding="true" android:padding="3dp" android:scaleType="centerCrop" /> <ImageView android:id="@+id/imageView2" android:layout_width="70dp" android:layout_height="50dp" android:layout_alignParentRight="true" android:layout_alignTop="@+id/profilePictureresult" android:layout_marginTop="16dp" android:alpha="0.7" android:src="@drawable/left_right" /> <ImageView androi…
tagged with: android
has comment: http://stackoverflow.com/comment/39734660
has title: NullPointerException - ParseImageView
score: 0
type: UnansweredQuestion
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25463244
tagged with: android-activity

http://stackoverflow.com/q/25465750
accepted answer: http://stackoverflow.com/a/25465808
has answer: http://stackoverflow.com/a/25465808
type: AnsweredQuestion
score: 0
has title: Memory allocation for byte value upon shifting
tagged with: memory-management
tagged with: java
answer count: 1
has body: I wrote a small demo for myself for better understanding of shifting a byte values. So I've byte 'd' with value 127: class Demo { public static void main (String args[]) { byte d = 127; // 8-bit is equal to 0 111 1111 and what I try to do is to shift it in a value of 2 to the left: int e = d &lt;&lt; 2; /* 32-bit shifted value is equal to 0 000 0000 0000 0000 0000 0001 1111 1100 0 * 2^0 + 0 * 2^1 + 1 * 2^2 + 1 * 2^3 + 1 * 2^4 + 1 * 2^5 + 1 * 2^6 + 1 * 2^7 + 1 * 2^8 = 0 * 1 + 0 * 2 + 1 * 4 + 1 * 8 + 1 * 16 + 1 * 32 + 1 * 64 + 1 * 128 + 1 * 256 = 0 + 0 + 4 + 8 + 16 + 32 + 64 + 128 + 256 = 508 */ Please let me know if my logic in comments is correct, cause it's first time for me of doing such a things. So the real question is about memory allocation once I try to cast 'e' back to byte: byte f = (byte)(e); /* [] indicates 8-bit at 32-bit shifted value: 0 000 0000 0000 0000 0000 0001 [1111 1100] 0 * 2^0 + 0 * 2^1 + 1 * 2^2 + 1 * 2^3 + 1 * 2^4 + 1 * 2^5 + 1 * 2^6 - 1 * 2^7 = 0 * 1 + 0 * 2 + 1 * 4 + 1 * 8 + 1 * 16 + 1 * 32 + 1 * 64 - 1 * 128 = 0 + 0 + 4 + 8 + 16 + 32 + 64 - 128 = -4 */ int g = (byte)(e); } } both byte 'f' and int 'g' works perfect but the book I'm reading now advice me to use int with a similar conditions without any explanations so the real thing I worry about is 'memory allocation'. Does it really matter which type to use or once byte value is shifted and the memory got expended to 32-bit it's impossible to reduce it back to 8-bit? Additionally I've a strange question. How can I check the real 'bitness' of any value? Let's say when I execute something like this: byte a = 10; System.out.println(Integer.toBinaryString(a)); int b = 10; System.out.println(Integer.toBinaryString(b)); The result is '1010' in both cases. But if I get it right byte 'a' use 8 bits of memory and int 'b' use 32. But for: byte c = 5 &lt;&lt; 1; System.out.println(Integer.toBinaryString(c)); Result is '1010' too but now it use 32 bits of memory while byte and short values are promote…
type: Question
tagged with: binary
linked to: http://stackoverflow.com/q/2370288

http://stackoverflow.com/q/25548227
answer count: 1
has answer: http://stackoverflow.com/a/25548337
type: Question
type: UnansweredQuestion
has body: I would like to create this kind of table in MS Excel by using Apache POI: ---------------------------------------------------------------------------- |first_text |last_text | no_text | ---------------------------------------------------------------------------- |col_1|col_2|col_3|col_4|col_5|col_6|col_7|col_8|col_9|col_10|col_11|col_12| |--------------------------------------------------------------------------- | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | ---------------------------------------------------------------------------- I have some problems to combine the areas "first_text" and "last_text" together in the Row. The rest of the table is complete. How can I create this kind the table overview?
has title: How to merge cells in the same row by using Apache POI?
score: 0
tagged with: apache-poi
tagged with: java

http://stackoverflow.com/comment/39809709
type: Comment
has text: I believe your confusion comes from you thinking that a model is singular (i.e. an application has just one complex model that models everything). In Swing (and in many other frameworks) components in the view have their own little models and controls. A table has it's own model in the sense that it holds the data, retrieves it and does all operations with it, while the table just shows it. As such, in the context of the table itself, it *is* MVC. Even though the table "model" is useless outside the table and wouldn't even be considered one.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25502552

http://stackoverflow.com/a/25451448
downvote count: 0
has body: You can try with Pattern and Matcher as well. Pattern p = Pattern.compile("\\d+"); Matcher m = p.matcher("asd0085 sa223 9349x"); while (m.find()) { System.out.println(m.group()); }
type: Answer
answers question: http://stackoverflow.com/q/25451331
score: 2
upvote count: 2

http://stackoverflow.com/comment/39752946
type: Comment
comment on: http://stackoverflow.com/a/25472363
type: AnswerComment
score: 0
has text: In what sense get a card. Draw the top card from the deck? Get some particular card? You need to be more specific with your questions...

http://stackoverflow.com/q/25521784
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25523414
tagged with: spring
has answer: http://stackoverflow.com/a/25523151
tagged with: spring-mvc
score: 0
has body: I am trying to send a complex object to ajax controller for spring mvc search engine, with 3 variables: the current page, items per page and the search parameters. The problem is that with the declaration of the controller method does not take me the params variable as a Map. As I can send the structure to collect on the controller 3 variables separately? Error: Required Map parameter 'params' is not present var dataToSend = { 'page': 1, 'itemsPerPage': 10, 'params': { 'codItem': "10", 'nameItem': "foo" } }; $.ajax({ url: form.attr("action"), type: 'POST', data: JSON.stringify(dataToSend), dataType: 'json', cache: false }).success(function(data) { callback(data); }); public @ResponseBody HashMap&lt;String, Object&gt; search(@RequestParam(value="params") Map&lt;String, String&gt; params, @RequestParam(value = "page") int page, @RequestParam(value = "itemsPerPage") int itemsPerPage){ };
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25522049
has answer: http://stackoverflow.com/a/27684127
has answer: http://stackoverflow.com/a/25524584
type: Question
tagged with: ajax
has title: Send complex json object to Spring MVC controller

minimax
type: Tag
tag name: minimax
tags question: http://stackoverflow.com/q/25528497

http://stackoverflow.com/comment/40093860
type: Comment
has text: @Vaibhav - If the reference is of type B then it can hold only class B object or any class inherited Class B and in the later case reference of type A can hold both Class A and B object. You can go through java inheritance if you want more clarification.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25469687

http://stackoverflow.com/comment/39784272
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25489664
has text: http://stackoverflow.com/questions/12909332/how-to-logout-of-an-application-where-i-used-oauth2-to-login-with-google

http://stackoverflow.com/q/25520980
linked to: http://stackoverflow.com/q/6268157
downvote count: 0
has comment: http://stackoverflow.com/comment/39842396
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39842452
tagged with: java
has body: package polymorphism; /* * @author Rahul Tripathi */ public class OverLoadingTest { /** * @param args * @return */ static void display(String s){ System.out.println("Print String"); } static void display(Object s){ System.out.println("Print Object"); } public static void main(String[] args) { // TODO Auto-generated method stub OverLoadingTest.display(null); } } Output: Print String IN above program when overload same method display(String s ) and display(Object o) ,when pass null in method from main method why display(String s ) is called only. Why not called display(Object o)?
has answer: http://stackoverflow.com/a/25521008
has comment: http://stackoverflow.com/comment/39842391
favorite count: 0
type: Question
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/39842381
has answer: http://stackoverflow.com/a/25521542
linked to: http://stackoverflow.com/q/377203
has answer: http://stackoverflow.com/a/45113670
has comment: http://stackoverflow.com/comment/39842273
has answer: http://stackoverflow.com/a/25520996
answer count: 4
has title: when overload same method display(String s ) and display(Object o) ,when pass null in method from main method why display(String s ) is called?

http://stackoverflow.com/a/25393679
has comment: http://stackoverflow.com/comment/39608845
type: Answer
has body: Top level elements with anonymous complex types get @XmlRootElement annotations generated on them. Top level elements with a named complex type have @XmlElementDecl annotations on the generated ObjectFactory. Teacher should not have been generated with an @XmlRootElement unless some sort of binding customization is used. For More Information I have writtent more about this on my blog: http://blog.bdoughan.com/2012/07/jaxb-and-root-elements.html
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25393252
upvote count: 1

http://stackoverflow.com/comment/39617376
has text: then my result would be searchTerm = [flu virus, ebola] i need searchTerm = [flu virus, AND, ebola]
type: Comment
comment on: http://stackoverflow.com/a/25400176
score: 0
type: AnswerComment

conditional-statements
tags question: http://stackoverflow.com/q/25539141
tag name: conditional-statements
type: Tag

http://stackoverflow.com/comment/39672093
type: Comment
type: QuestionComment
has text: @Loop: yes, the outmost vertical LinearLayout contains several controls and Horizontal LinearLayouts, similar to the above one.
score: 0
comment on: http://stackoverflow.com/q/25428877

http://stackoverflow.com/comment/39841228
comment on: http://stackoverflow.com/q/25519736
type: Comment
type: QuestionComment
has text: Do not provide clarifications in comments. Instead, edit your question to make it clearer.
score: 0

ftp
tags question: http://stackoverflow.com/q/25485195
tag name: ftp
tags question: http://stackoverflow.com/q/25400155
tags question: http://stackoverflow.com/q/25440939
type: Tag
tags question: http://stackoverflow.com/q/25460289
tags question: http://stackoverflow.com/q/25509366
tags question: http://stackoverflow.com/q/25424782

http://stackoverflow.com/comment/39610898
type: Comment
has text: I am not passing any values via the run configurations. I am just executing the main() method of the Service show above. There I am passing the server as a parameter.
score: 0
comment on: http://stackoverflow.com/q/25396459
type: QuestionComment

macos
tags question: http://stackoverflow.com/q/25493529
tags question: http://stackoverflow.com/q/25545149
tags question: http://stackoverflow.com/q/25471945
tags question: http://stackoverflow.com/q/25392752
tags question: http://stackoverflow.com/q/25445981
tags question: http://stackoverflow.com/q/25397227
tags question: http://stackoverflow.com/q/25548143
tags question: http://stackoverflow.com/q/25518331
type: Tag
tags question: http://stackoverflow.com/q/25516563
tags question: http://stackoverflow.com/q/25392303
tags question: http://stackoverflow.com/q/25437688
tags question: http://stackoverflow.com/q/25514571
tags question: http://stackoverflow.com/q/25493913
tag name: macos
tags question: http://stackoverflow.com/q/25479516
tags question: http://stackoverflow.com/q/25544849
tags question: http://stackoverflow.com/q/25445048
tags question: http://stackoverflow.com/q/25532779
tags question: http://stackoverflow.com/q/25490744
tags question: http://stackoverflow.com/q/25415331
tags question: http://stackoverflow.com/q/25412824

http://stackoverflow.com/comment/39802612
comment on: http://stackoverflow.com/q/25499239
has text: I means, the image should be enlarge from center point of the image, instead translate right or bottom.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/109405468
has text: @Boann, can the implementation of `synchronized` in println be relied on to exist?
comment on: http://stackoverflow.com/a/25425131
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25525072
linked to: http://stackoverflow.com/q/20856
linked to: http://stackoverflow.com/q/10506181
linked to: http://stackoverflow.com/q/17619698
upvote count: 1
has comment: http://stackoverflow.com/comment/39849981
has comment: http://stackoverflow.com/comment/39850359
has comment: http://stackoverflow.com/comment/39849888
has title: Best way to add record in reference table if not found
tagged with: sql
score: 1
tagged with: java
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25525452
has comment: http://stackoverflow.com/comment/39849919
favorite count: 0
type: Question
has body: I'm trying to implement a simple tag system in my app. When users want to tag an object, they can use existing tags and/or create new tags at the same time. I have a table 'tag' which just stores the unique tag string value as a PK. In 'object_tag' I have a FK reference to this column. In a request from the client there can be multiple tags for one object. On the server I will loop through all the tags and store them in 'object_tag'. If the tag doesn't exist in the 'tag' table, it should be inserted first. What is the most efficient way to do this? I could just check if the tag exists before each insert, but I want to minimize the database I/O.
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/334183

http://stackoverflow.com/comment/39859092
comment on: http://stackoverflow.com/a/25529574
type: Comment
has text: @JohnRuddell You didn't show any limitation of this syntax. You could show some references. I really would like to know it.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25436658
favorite count: 0
has comment: http://stackoverflow.com/comment/49550392
tagged with: security
has title: Configure x-frame-options response headers Spring Security 3.1
score: 1
tagged with: java
type: Question
answer count: 0
type: UnansweredQuestion
has body: I'm trying to configure the x-frame-options response header with Spring-Security 3.1 in order to avoid ClickJacking attacks. I found that I can do it throught the XML configuration file, but it seems that it only applies to Spring Securit 3.2. Is there another way to do it with the version that I'm using?
downvote count: 0
tagged with: clickjacking
upvote count: 1
tagged with: spring
tagged with: spring-security

http://stackoverflow.com/a/44417983
type: Answer
score: 0
has body: In my case I had to put it in the bin folder of my project even the fact that my classpath is set to the src folder. I have no idea why, but it's worth a try.
answers question: http://stackoverflow.com/q/25487116
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/77889882

hash
tags question: http://stackoverflow.com/q/25493095
type: Tag
tags question: http://stackoverflow.com/q/25436538
tags question: http://stackoverflow.com/q/25539351
tags question: http://stackoverflow.com/q/25390201
tag name: hash
tags question: http://stackoverflow.com/q/25533497
tags question: http://stackoverflow.com/q/25469115

http://stackoverflow.com/a/25449563
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25449130
has body: This should work , (Add a slash before LoginControlerdo) Pseudo Mot De Passe

http://stackoverflow.com/comment/39887089
comment on: http://stackoverflow.com/q/25541571
type: QuestionComment
score: 0
has text: @EJP How can I solve this issue,
type: Comment

http://stackoverflow.com/comment/39636626
type: Comment
comment on: http://stackoverflow.com/a/25406685
type: AnswerComment
has text: So that's what "Every comma seperated value will increment the T value" meant... edited to add a recursive processString to handle this...
score: 0

http://stackoverflow.com/q/25537307
downvote count: 0
has body: So I have an image saved as Blob. I look it up and crop it with the help of the ImagesService. But how can I save my newly generated com.google.appengine.api.images.Image as a Blob again? I found some examples using com.google.appengine.api.files.FileService, but the interface is deprecated. ImagesService imagesService = ImagesServiceFactory.getImagesService(); Image oldImage = ImagesServiceFactory.makeImageFromBlob(new BlobKey(myBlobKey)); Transform crop = ImagesServiceFactory.makeCrop(0, 0, 0.5, 0.5); Image newImage = imagesService.applyTransform(crop, oldImage); What is the best (not deprecated) way to store it now?
upvote count: 1
has answer: http://stackoverflow.com/a/25539288
has title: App Engine - How to save a Blob?
tagged with: blobstore
score: 1
tagged with: java
answer count: 1
favorite count: 0
type: Question
tagged with: blob
type: UnansweredQuestion
tagged with: google-app-engine

http://stackoverflow.com/q/25495063
score: 2
downvote count: 0
tagged with: rabbitmq
has comment: http://stackoverflow.com/comment/40984188
answer count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25500751
tagged with: java
has body: Is it possible to dynamically add users and virtual hosts to RabbitMQ using Java? I'm hoping to have the same functionality as rabbitmqctl add_vhost and rabbitmqctl add_user. My RabbitMQ server is running on the same computer as my java code, but just executing them via Runtime.getRuntime().exec(command); doesn't seem to be working as intended.
has answer: http://stackoverflow.com/a/25500751
has title: Adding users / virtual hosts to RabbitMQ from Java
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/q/25423148
downvote count: 0
has title: dynamically injecting property into spring
has comment: http://stackoverflow.com/comment/39660101
favorite count: 0
has answer: http://stackoverflow.com/a/25425946
has answer: http://stackoverflow.com/a/25426332
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39665671
tagged with: dependency-injection
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25423333
accepted answer: http://stackoverflow.com/a/25425946
has comment: http://stackoverflow.com/comment/39663455
has comment: http://stackoverflow.com/comment/39661464
tagged with: spring
possible better answer: http://stackoverflow.com/a/35565489
has comment: http://stackoverflow.com/comment/39667198
answer count: 4
has comment: http://stackoverflow.com/comment/39660793
type: Question
has answer: http://stackoverflow.com/a/35565489
has body: I have a spring config xml file which creates multiple beans and autowires one into others Eg &lt;bean id="a" class="com.xyz.A"&gt; &lt;property name="prop1" value="?" /&gt; &lt;/bean&gt; &lt;bean id="b" class="com.xyz.B"&gt; &lt;property name="prop2" ref="a" /&gt; &lt;/bean&gt; My creates application context by reading the above spring file. But the value of prop1 of A is dynamically known at run time.How do i inject this property dynamically?By dynamic i mean when the application starts.For example some properties come as command line inputs to the application. And this property should then be set as property of beans I had given this example to simplify the problem.In real my dynamic parameter is database server url and i want to create connection pool dynamically
score: 5
has comment: http://stackoverflow.com/comment/39660725
has comment: http://stackoverflow.com/comment/39661269

http://stackoverflow.com/q/25504114
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39810814
accepted answer: http://stackoverflow.com/a/25512091
has title: How to get phone or tablet Screen Size and as per screen Activity Class call
has answer: http://stackoverflow.com/a/25512091
score: 0
answer count: 1
upvote count: 1
downvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9279111
tagged with: android-layout
has comment: http://stackoverflow.com/comment/39810791
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39811238
has body: in my application tablet and phone size are different, in phone i used listview for display data and , in tablet i used gridview for display data, so both code and design are different so its possible when apps start at first get screen display size as per display size on class call , if this app install in phone then phone class call and if install in tablet then tablet class call .. for phone i make activity and layout and for tablet i make different activity and layout. in i phone its possible ,screen resolution bound fetch and then class call so its possible in android. please help me. Thanks
has comment: http://stackoverflow.com/comment/39812036

http://stackoverflow.com/comment/39834127
type: QuestionComment
comment on: http://stackoverflow.com/q/25516235
score: 0
has text: The while loop is fine. MY table is not recreating every time the please function is called. It keeps adding and adding
type: Comment

http://stackoverflow.com/comment/39861782
has text: All you did was add a byte as a placeholder when a null existed and then place a byte before a valid entry to indicate a value exists. Handling it this is way not more proper than how you were doing it before, or better than my approach, which removed the need for extra bytes by simply initializing values, or the approach provided by @kcoppock which was just to write the null values and check for null when retrieved.
type: Comment
comment on: http://stackoverflow.com/a/25517812
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39792144
comment on: http://stackoverflow.com/q/25492905
has text: What results you expected for `Object.class` or `Long.class` and why do you think your method should give you such results?
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/25397552
answer count: 1
accepted answer: http://stackoverflow.com/a/25397701
has answer: http://stackoverflow.com/a/25397701
type: AnsweredQuestion
score: 0
has body: I'm trying to find an element by Xpath w.r.t other element's xpath. In the below HTML Structure: ------>node 1 ---> element is visible ------>node 2 text node1 ------>node 3 text node2 </div The code that i've written to find node1, textnode1 and textnode2 is: WebElement templateElement = driver.findElement(By.xpath("//*[@id='frmKonyLib_pxwgmctProj']/ul/li[1]/ul/li[1]/table/tbody/tr/td[1]/img")); WebElement formElement = templateElement.findElement(By.xpath("//a[text()='text node1']")); WebElement widgetElement = formElement.findElement(By.xpath("/ancestor::table[1]/following-sibling::ul//a[text()='text node2']")); In the above code formElement is found, but an exception is thrown for widgetElement. Please help me in figuring out the error and code suggestions for the logic. Below is the exception thrown: 'Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268) at org.openqa.selenium.remote.RemoteWebElement.findElement(RemoteWebElement.java:171) at org.openqa.selenium.remote.RemoteWebElement.findElementByXPath(RemoteWebElement.java:244) at org.openqa.selenium.By$ByXPath.findElement(By.java:344) at org.openqa.selenium.remote.RemoteWebElement.findElement(RemoteWebElement.java:167) at com.kony.vizAutomation.px.utils.PXUtils.selectWidgetByID(PXUtils.java:195) at com.kony.seleniume…
has title: Find an element by xpath w.r.t to other element
tagged with: java
tagged with: selenium
type: Question
tagged with: xpath

http://stackoverflow.com/comment/39630536
comment on: http://stackoverflow.com/q/25407260
type: QuestionComment
has text: *multiple implementations, some of which are protected* what do you mean. A class has `public` or `default` visibility.
type: Comment
score: 0

http://stackoverflow.com/q/25443680
has comment: http://stackoverflow.com/comment/39698330
accepted answer: http://stackoverflow.com/a/25443850
type: Question
has answer: http://stackoverflow.com/a/25443850
has comment: http://stackoverflow.com/comment/39700548
has body: So I've got this problem which is really annoying me. I override the onCreate method of my class extending SQLiteOpenHelper: @Override public void onCreate(SQLiteDatabase db) { super.onCreate(db); final String createAccTableCmd = ("CREATE TABLE IF NOT EXISTS " + ACCOUNTS_TABLE_NAME + " ( " + ACCOUNT_KEY_ID + " INTEGER PRIMARY KEY ASC AUTOINCREMENT, " + ACCOUNT_KEY_NAME + " TEXT UNIQUE ON CONFLICT IGNORE NOT NULL ON CONFLICT IGNORE, " + ACCOUNT_KEY_SELECTED + " INTEGER NOT NULL ON CONFLICT IGNORE, " + //THIS IS IN MILLISECONDS "CHECK (" + ACCOUNT_KEY_SELECTED + " = 0 OR " + ACCOUNT_KEY_SELECTED + " = 1) ON CONFLICT IGNORE" + " ) "); final String oneAndOnlyOneSelectedAccInsertTriggerCmd = "CREATE TRIGGER " + ONE_AND_ONLY_ONE_SELECTED_TRIGGER_INSERT_NAME + " " + "AFTER INSERT ON " + ACCOUNTS_TABLE_NAME + " " + "FOR EACH ROW " + "BEGIN " + "DELETE FROM " + ACCOUNTS_TABLE_NAME + " WHERE " + ACCOUNT_KEY_ID + " = NEW." + ACCOUNT_KEY_ID + "; " + "END"; final String oneAndOnlyOneSelectedUpdateTriggerCmd = "CREATE TRIGGER " + ONE_AND_ONLY_ONE_SELECTED_TRIGGER_UPDATE_NAME + " " + "AFTER UPDATE ON " + ACCOUNTS_TABLE_NAME + " " + "FOR EACH ROW " + "WHEN (SELECT(SUM(" + ACCOUNT_KEY_ID + ")) &lt;&gt; 1) " + "BEGIN " + "UPDATE " + ACCOUNTS_TABLE_NAME + " SET " + ACCOUNT_KEY_SELECTED + " = 0; " + "UPDATE " + ACCOUNTS_TABLE_NAME + " SET " + ACCOUNT_KEY_SELECTED + " = 1 WHERE " + ACCOUNT_KEY_ID + " = NEW." + ACCOUNT_KEY_ID + "; " + "END"; synchronized (DB_LOCK) { db.beginTransaction(); db.execSQL(createAccTableCmd); db.execSQL(oneAndOnlyOneSelectedAccInsertTriggerCmd); db.execSQL(oneAndOnlyOneSelectedUpdateTriggerCmd); addTableName(ACCOUNTS_TABLE_NAME); ContentValues cv = new ContentValues(); cv.put(ACCOUNT_KEY_ID, 0); cv.put(ACCOUNT_KEY_NAME, "name"); cv.put(ACCOUNT_KEY_SELECTED, 0); Log.d("debug", "-1 if error on insert: " + db.insert(ACCOUNTS_TABLE_NAME, "", cv)); Log.d("debug", "Size: " + db.query(ACCOUNTS_TABLE_NAME, null, null, null, null, null, ACCOUNT_KEY_ID + " ASC").getCount…
has title: onCreate is called as expected. But tables are not created
type: AnsweredQuestion
score: 0
tagged with: android
tagged with: java
tagged with: sqlite
answer count: 1

http://stackoverflow.com/q/25408290
tagged with: java
has comment: http://stackoverflow.com/comment/39632632
answer count: 1
has comment: http://stackoverflow.com/comment/39633191
favorite count: 0
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/39657811
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/39643462
has title: Regex for non commented method call in java code
has comment: http://stackoverflow.com/comment/39633275
tagged with: regex
has answer: http://stackoverflow.com/a/25408653
upvote count: 0
has body: I need a regular expression to match a method call in my java code where the method call is not surrounded by any of the java comment types. Actually, my requirement is to find all the java files where this method is called in a non-commented code. For e.g., getMessage is the method call, and provided the following code as input.. the RegEx should match only line #12. // Systme.out.println (obj1.getMessage()); //line 1 /* Systme.out.println (obj.getMessage());*/ //line 2 /* public void test() { //line 3 Systme.out.println (obj2.getMessage()); //line 4 } //line 5 */ //line 6 /**public void test () { //line 7 * Systme.out.println (obj3.getMessage()); //line 8 *} //line 9 */ //line 10 public void test() { //line 11 Systme.out.println (obj5.getMessage());//line 12 } I first tried to match the negative cases i.e., method call within comments and then try to negate the expression. For that, i used.. (?=(//|/*|*)).*getMessage.* which would still not cover the method call at line #4. But even before that.. when I used negative look around of above using (?!(//|/*|*)).*getMessage.*, it even started matching all the method calls. Then, I understood that am missing the concept of Atomic grouping and tried to explore it a bit but could not get much. It would be appreciated much if you could help me in solving this. Thanks in advance, PS : I only need the RegEx not the java code as I need to supply only the expression as input to the system.
has comment: http://stackoverflow.com/comment/39632999

http://stackoverflow.com/a/57909607
has body: Here is my simple code with detected time complexity of O(1) in Codility. public int solution(int X, int Y, int D) { int dev = (Y - X) % D; if (X == Y) return 0; else if (dev == 0) return (Y - X) / D; else return ((Y - X) / D) + 1; }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25455903

http://stackoverflow.com/comment/39809767
score: 0
has text: Are you using an XA driver for your JDBC connection? You should. That will make taking the message off the queue and writing to the database a single unit of work.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25502939

http://stackoverflow.com/q/25510648
tagged with: java
has body: I am having some encoding issues, and am trying to implement this code...but need to use org.glassfish.jersey instead and the class structure seems very different. https://github.com/tinkerpop/rexster/blob/master/rexster-server/src/main/java/com/tinkerpop/rexster/filter/HeaderResponseFilter.java Any advice appreciated, but I cant even find ContainerResponseFilter in the jersey package structure I have dependencies on, and the other dependencies seem to be in import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ContainerResponse; not the spi package in the example. My pom looks like this: javax.ws.rs javax.ws.rs-api 2.0 org.glassfish.jersey.containers jersey-container-servlet ${jersey.version} org.glassfish.jersey.core jersey-server ${jersey.version} org.glassfish.jersey.media jersey-media-moxy ${jersey.version} org.glassfish.jersey.ext jersey-bean-validation ${jersey.version} org.glassfish.jersey.ext jersey-spring3 ${jersey.version} Thanks i
type: UnansweredQuestion
tagged with: jersey
score: 0
has answer: http://stackoverflow.com/a/25511038
has title: How to implement Jersey ContainerRequest example using org.glassfish.jersey
answer count: 1
type: Question

http://stackoverflow.com/comment/39904865
type: Comment
comment on: http://stackoverflow.com/a/25539323
score: 0
type: AnswerComment
has text: this.project.refreshLocal(IResource.DEPTH_INFINITE, monitor); fixed the issue. Just a refresh on the IFile(s) was not working correctly.

runtime
tags question: http://stackoverflow.com/q/25493569
tags question: http://stackoverflow.com/q/25391806
tags question: http://stackoverflow.com/q/25530774
type: Tag
tag name: runtime

http://stackoverflow.com/a/25543201
downvote count: 0
has comment: http://stackoverflow.com/comment/39883059
score: 1
has comment: http://stackoverflow.com/comment/39882864
upvote count: 1
has comment: http://stackoverflow.com/comment/39883162
type: Answer
has body: When creating the tempFile try using the fileDir you already created to get sure it exists. File tempFile = new File(fileDir, DATABASE_NAME); Before you create a new file you should check if it already exists by calling its exits() method. And then instead of opening it again you should actually keep on using it. Or at least close it before opening again. if(!tempFile.exists()) tempFile.createNewFile(); InputStream is = SplashActivity.this.getAssets().open( DATABASE_NAME); FileOutputStream os = new FileOutputStream(tempFile); Create you FileOutPutStream using the tempFile or close tempFile to get sure your file is not locked.
accepted answer of: http://stackoverflow.com/q/25542291
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25542291

http://stackoverflow.com/q/25491356
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39787489
tagged with: java
has comment: http://stackoverflow.com/comment/39787798
has comment: http://stackoverflow.com/comment/39787781
accepted answer: http://stackoverflow.com/a/25492004
possible better answer: http://stackoverflow.com/a/25492166
has comment: http://stackoverflow.com/comment/39788039
has comment: http://stackoverflow.com/comment/39787542
has comment: http://stackoverflow.com/comment/39787443
has answer: http://stackoverflow.com/a/25492166
type: Question
has comment: http://stackoverflow.com/comment/39787918
has title: Arranging incoming data into a table with certain conditions
has body: I have a sample text file that is basically a java program. My task was to write a program that could read each and every line of the text file and determine whether it is an assignment statement. And if it is an assignment statement then i need to print out the variable names used in that assignment statement. This is the desired output I need: ASSIGNMENT STATEMENT LEFT RIGHT data=5; data one=data; one data x=5.6; x test =(x+5.4)+one/x test x.one,x age=3.5; age number = 0.2*(age-10); number age x=x+num; x x,num The point where I am stuck is the part where I have extract x, one, x and from the 5th row. And also how to prevent the digits from being printed. like in data =5 how do i only print data and skip the 5? Can someone help?
tagged with: string-formatting
has comment: http://stackoverflow.com/comment/39787964
has answer: http://stackoverflow.com/a/25492004
has comment: http://stackoverflow.com/comment/39788013
type: AnsweredQuestion

http://stackoverflow.com/comment/39740374
type: AnswerComment
has text: Yes, i can PING the server, and i can PING the client computer.
comment on: http://stackoverflow.com/a/25462664
score: 0
type: Comment

http://stackoverflow.com/q/25431715
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25431786
answer count: 3
linked to: http://stackoverflow.com/q/2624410
score: 1
tagged with: java
downvote count: 1
has body: I met this code: int a = 1; int k = ++a + a++ + + 1; System.out.println(k); I think that the compiler will give an error but the result is 5? What is the pourpose of the last '+'(plus) sign? Is it positive sign that marks that 1 is not negative or? And why Java allow this as a valid statement?
has comment: http://stackoverflow.com/comment/39676674
has answer: http://stackoverflow.com/a/25431796
has comment: http://stackoverflow.com/comment/39676283
accepted answer: http://stackoverflow.com/a/25431796
favorite count: 0
type: Question
has title: What is the role of this plus sign in this Java code?
has comment: http://stackoverflow.com/comment/39676400
linked to: http://stackoverflow.com/q/2371118
has answer: http://stackoverflow.com/a/25431789
has comment: http://stackoverflow.com/comment/39676329
has comment: http://stackoverflow.com/comment/39676463
possible better answer: http://stackoverflow.com/a/25431786
has comment: http://stackoverflow.com/comment/39676302
has comment: http://stackoverflow.com/comment/39676272

http://stackoverflow.com/a/25486313
upvote count: 3
has comment: http://stackoverflow.com/comment/39798914
accepted answer of: http://stackoverflow.com/q/25485260
has comment: http://stackoverflow.com/comment/39778390
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25485260
has comment: http://stackoverflow.com/comment/39879004
has comment: http://stackoverflow.com/comment/39802808
has body: You can change your while loop like this: int lineNumber = 1; while (fileInput.hasNextLine()) { String line = fileInput.nextLine(); String[] data = line.split(" "); try { sum+= Double.valueOf(data[0]); } catch (Exception ex) { output2.println("Error at line "+lineNumber+ " - "+line); } lineNumber++; } output.println("Total: "+sum); Here you can go through each line of the mixed.txt and check if it starts with a double or not. If it is double you can just add it to sum or else you can add the String to errorlog.txt. Finaly you can add the sum to result.txt
has comment: http://stackoverflow.com/comment/39802624
has comment: http://stackoverflow.com/comment/39783176
score: 3
has comment: http://stackoverflow.com/comment/39802706
has comment: http://stackoverflow.com/comment/39802332
has comment: http://stackoverflow.com/comment/39877621
has comment: http://stackoverflow.com/comment/39841781
type: Answer
has comment: http://stackoverflow.com/comment/39802434

http://stackoverflow.com/comment/39727897
comment on: http://stackoverflow.com/a/25459320
type: Comment
type: AnswerComment
score: 0
has text: And in if block, do the task that you want

http://stackoverflow.com/q/25471217
downvote count: 0
has answer: http://stackoverflow.com/a/78824382
has comment: http://stackoverflow.com/comment/39755849
has body: I have installed IntelliJ IDEA and upgraded a web project to run with Tomcat. It works fine but after some time I have discovered that I'm not able to debug some code I add to the end of class. Because when I set a breakpoint in this code it marks as invalid. If I hover the invalid mark the warning message appears Warning: No executable code found at line xxx in class yyy. The screenshot of the source code in editor when web application is running in debug mode: Does anybody know why IntelliJ Idea can't find executable code there and how to set a valid breakpoint like the first one in the code that compiles and running?
favorite count: 0
type: Question
tagged with: debugging
tagged with: breakpoints
tagged with: java
has title: IntelliJ IDEA invalid breakpoint
has comment: http://stackoverflow.com/comment/39758835
has comment: http://stackoverflow.com/comment/39764834
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/39906049
upvote count: 2
has answer: http://stackoverflow.com/a/29004772
type: UnansweredQuestion
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/39755933
has comment: http://stackoverflow.com/comment/39750116

http://stackoverflow.com/a/25444248
answers question: http://stackoverflow.com/q/25432598
upvote count: 4
has body: setup: Called once at the beginning of the task. You can put custom initialization here. cleanup: Called once at the end of the task. You can put resource releasing here.
downvote count: 0
type: Answer
score: 4

http://stackoverflow.com/q/25502718
has body: I am trying to build my selenium + testng test project using maven 3.0.4. I run the command 'mvn verify' which runs the testng tests, but after that maven hangs,I do not get a build success / failure confirmation message. What am I doing wrong ? Following is the output of my maven command Running TestSuite: Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 48.653 sec - in TestSuite This is where my maven hangs Following is my pom.xml 4.0.0 com.global.search.tool gst.acceptance jar 1.0-SNAPSHOT gst.acceptance http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.7 1.7 org.apache.maven.plugins maven-failsafe-plugin 2.17 maven-failsafe-plugin 2.17 ${basedir}/testng.xml false integration-test verify junit junit 4.11 org.seleniumhq.selenium selenium-firefox-driver 2.40.0 org.seleniumhq.selenium selenium-server 2.40.0 org.seleniumhq.selenium selenium-java 2.40.0 org.testng testng 6.8 org.seleniumhq.selenium selenium-chrome-driver 2.40.0 org.seleniumhq.selenium selenium-ie-driver 2.40.0 org.apache.commons commons-math3 3.1 org.slf4j slf4j-api 1.7.2 org.slf4j slf4j-log4j12 1.7.2 org.apache.poi poi 3.9 org.apache.poi poi-ooxml 3.9 javax.mail mail 1.4.5 com.github.goldin mail-maven-plugin 0.2.5 xml-apis xml-apis 1.4.01
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39813724
has comment: http://stackoverflow.com/comment/39809777
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/39845560
answer count: 0
type: UnansweredQuestion
downvote count: 0
has title: Maven build hangs after running testng tests
tagged with: maven
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/25395443
has title: Read all classes decorated with a particular annotation at runtime
answer count: 2
tagged with: reflection
score: 1
has comment: http://stackoverflow.com/comment/39609239
tagged with: java
downvote count: 0
tagged with: annotations
upvote count: 1
possible better answer: http://stackoverflow.com/a/25395650
favorite count: 0
tagged with: cdi
type: Question
has comment: http://stackoverflow.com/comment/39609155
has comment: http://stackoverflow.com/comment/39609396
has answer: http://stackoverflow.com/a/25395650
has body: I am required to read all classes(interfaces) decorated with a particular annotation (say @HttpSecurity) at runtime. After scanning through, I wish to read and parse the fields(enum fields) of class decorated with annotations. For eg. @HttpSecurity public interface MyHttpSecurityConfig { public enum secure { @Path(pathGroup = "/*", pathName = "") @Authc @Form(errorPage = "/error.html", loginPage = "/login.html", restoreOriginalRequest = "") @Authz @AllowedRoles(roles = { "roleA", "roleB" }) @AllowedGroups(groups = { "groupA" }) @AllowedRealms(realms = { "realmA" }) @Expressions(expressions = { "#{identity.isLoggedIn()}" }) Admin } } There might be one or more classes/interfaces decorated with @HttpSecurity. My first requirement is to fetch all such classes and second requirement is to build up HttpSecurityBuilder by reading the annotations and their values decorated on enum field(s). The second requirement is fine and can be done away using reflections. But, my problem is the first requirement. I want to achieve first requirement with JavaSE core i.e., without using any external dependency like google reflections. It might be assumed,if necessary, that we have the package name in which classes are to be scanned. Here is what I did usiNG cdi
accepted answer: http://stackoverflow.com/a/25430809
has comment: http://stackoverflow.com/comment/39609280
has answer: http://stackoverflow.com/a/25430809
type: AnsweredQuestion

http://stackoverflow.com/q/25443577
tagged with: hadoop2
has answer: http://stackoverflow.com/a/25447015
tagged with: oryx
score: 2
has title: Unable to start Oryx with Hadoop
tagged with: snappy
upvote count: 2
tagged with: java
has body: I am trying to run Oryx with Hadoop 2.4. Hadoop starts successfully with warning: WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable. Oryx also starts successfully. But when I ingest data into it, following exception is thrown : 2014-08-22 14:35:05,835 ERROR [IPC Server handler 3 on 37788] org.apache.hadoop.mapred.TaskAttemptListenerImpl: Task: attempt_1408697508855_0002_m_000000_0 - exited : org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z 2014-08-22 14:35:05,835 INFO [IPC Server handler 3 on 37788] org.apache.hadoop.mapred.TaskAttemptListenerImpl: Diagnostics report from attempt_1408697508855_0002_m_000000_0: Error: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z 2014-08-22 14:35:05,837 INFO [AsyncDispatcher event handler] org.apache.hadoop.mapreduce.v2.app.job.impl.TaskAttemptImpl: Diagnostics report from attempt_1408697508855_0002_m_000000_0: Error: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z 2014-08-22 14:35:05,840 INFO [AsyncDispatcher event handler] org.apache.hadoop.mapreduce.v2.app.job.impl.TaskAttemptImpl: attempt_1408697508855_0002_m_000000_0 TaskAttempt Transitioned from RUNNING to FAIL_CONTAINER_CLEANUP Has anyone faced such kind of issue earlier? Any kind of help will be appreciable!
answer count: 1
downvote count: 0
favorite count: 0
type: Question
tagged with: hadoop
type: UnansweredQuestion

http://stackoverflow.com/comment/39889116
has text: @Duncan No, because I have some additional things in target as well, and I want also them to be deleted. If I call mvn clean from the command line, it deletes everything properly. This is what I try to do from m2e as well.
comment on: http://stackoverflow.com/q/25546496
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25480529
type: Question
linked to: http://stackoverflow.com/q/3040597
type: UnansweredQuestion
has title: execute query in java not return results but in mysql workbench still return results
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39767877
has comment: http://stackoverflow.com/comment/39767792
score: 0
has body: This query: SELECT r.report_id, r.user_id, u.user_name, u.user_mail, d.department_name, r.report_comment, r.report_target_date, r.report_create_date, r.report_revised_date, r.report_root_id, report_revised_id FROM report r JOIN user u ON u.user_id = r.user_id JOIN department d ON u.department_id = d.department_id JOIN authority a ON r.user_id = a.user_src_id AND a.user_dest_id = 131 WHERE r.report_target_date BETWEEN '2014-07-23 23:59:00' AND '2014-08-22 00:00:00' AND r.report_comment LIKE '%事務%' In mysql workbench this query has return value but when using it in java it's not returning anything: Statement stmt = connection.createStatement(); ResultSet rs = null; rs = stmt.executeQuery(query); In mysql workbench this query has return value but rs return is empty.
tagged with: java
has comment: http://stackoverflow.com/comment/39768051
has comment: http://stackoverflow.com/comment/39767043
answer count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39767008
has comment: http://stackoverflow.com/comment/39767034
tagged with: mysql
has answer: http://stackoverflow.com/a/25480625

http://stackoverflow.com/comment/39786913
type: Comment
score: 1
has text: Basically, you're creating the instance yourself. Spring is absolutely not involved. Show us what you are trying to do so we can better help you.
type: QuestionComment
comment on: http://stackoverflow.com/q/25491057

http://stackoverflow.com/q/25526139
has comment: http://stackoverflow.com/comment/39921800
type: AnsweredQuestion
has title: How can I go to previous activity with the fragment the activity was showing
score: 0
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25602785
answer count: 1
has comment: http://stackoverflow.com/comment/39851273
has answer: http://stackoverflow.com/a/25602785
type: Question
has body: I have two activities, Activity A and Activity B. Now Activity A has 3 Fragments one of which launches activity B. When I press the action bar button it returns to activity A but shows the default Fragment. Am using navUtils.navigateupFromSameTask to go back to previous Activity. How can I have the latest Fragment the user used show instead of the default one that shows up when user launches app the first time? For example when app launches it shows Fragment one. when user goes to Fragment 2 and launches activity B from it I want to go back to the previous activity showing fragment 2 @Override public boolean onOptionsItemSelected(MenuItem item){ switch(item.getItemId()){ case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } in the onCreate method I have if (savedInstanceState == null) { fragmentManager = getFragmentManager(); fragment = new RadioSound(); selectItem(0); } then selectItem: private void selectItem(int position) { // update the main content by replacing fragments activeFrag = position; if(position == 0){ fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); } else if(position == 1){ if(conv == null) conv = new Conversations(); fragmentManager.beginTransaction().replace(R.id.content_frame, conv).commit(); } else{ fragmentManager.beginTransaction().replace(R.id.content_frame, (new Preferences())).commit(); } // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(fragments[position]); mDrawerLayout.closeDrawer(mDrawerList); }
has comment: http://stackoverflow.com/comment/39994820

http://stackoverflow.com/comment/39724648
type: QuestionComment
comment on: http://stackoverflow.com/q/25430232
score: 0
has text: The delete operation works for me. Few thoughts: - Not sure how your code works. Aren't you missing a .build() on your builder to actually get a uri? - Are you 100% sure you're data is at that "model" path? Maybe do a getDataItems() to check the path of your items and verify you don't have a bug there.
type: Comment

http://stackoverflow.com/comment/39889588
type: Comment
type: QuestionComment
has text: And, also I would like to know why the @Component is unnecessary for the beans? Will the spring be able to bind the bean with the request?
comment on: http://stackoverflow.com/q/25546092
score: 0

http://stackoverflow.com/comment/39646439
type: Comment
score: 0
type: AnswerComment
has text: Rakesh, overriding a method doesn't change the class structure, it changes the behavior of the class. If mammal overrides a method on animal, mammal is still an animal, it just behaves differently.
comment on: http://stackoverflow.com/a/25412953

http://stackoverflow.com/q/25391494
has title: Java JAXB: XML to Java object conversion
tagged with: java
downvote count: 0
tagged with: jaxb
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
upvote count: 2
has body: Testdata.xml Ammu book1 book2 book3 Unni book1 book2 book4 A call to an external service returns data in the above XML format, I am trying to design to convert this structure to a POJO so as to convert the XML to POJO using JAXB Problem: Current output: books is returned as empty. Why? com.example.Users@45db05b2[ users=[com.example.User@2e530cf2[ name=Ammu books=[] ], com.example.User@4e76fba0[ name=Unni books=[] ]] ] Book.java import javax.xml.bind.annotation.XmlElement; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; public class Book { private String name; @XmlElement(name = "Book") public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); } } User.java import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @XmlRootElement(name = "User") public class User { private String name; private List books = new ArrayList (); @XmlElement(name = "Book", type = Book.class) public List getBooks() { return books; } public void setBooks(List books) { this.books = books; } @XmlElement(name="Name") public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); } } Users.java @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "Users") public class Users { @XmlElement(name = "User", type = User.class) private List users = new ArrayList (); public List getUsers() { return users; } public void setUsers(List users) { this.users = users; } @Override public String toString() { return ReflectionT…
has answer: http://stackoverflow.com/a/25391761
accepted answer: http://stackoverflow.com/a/25391761
has comment: http://stackoverflow.com/comment/39601437
score: 2
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25391627
possible better answer: http://stackoverflow.com/a/25391627

http://stackoverflow.com/q/25442461
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39697339
tagged with: serialization
has comment: http://stackoverflow.com/comment/39810178
has comment: http://stackoverflow.com/comment/39695752
has title: java serialization practice
has comment: http://stackoverflow.com/comment/39696192
tagged with: java
has body: I am reading across different methods/tools to serialize objects and I'm looking for an up-to-date suggestion for my application (as I can find a lot of similar question+answers from 2012, 2010, ...). I need to write some java objects to disk. I would love to save disk space as these objects may contain a lot of data and I would love to do it rather fast. So far it has been done with java standard serialization but the implementation is probably not very good (no explicit serialID set, ...). I read about the kryo library but I'm a bit afraid of using 3rd party libraries as I don't know how well they are maintained/ how common is their usage. Or shall I just improve the use of the serializable interface and if yes, is there any good documentation on proper implementation?
tagged with: kryo
type: Question
score: 0
has comment: http://stackoverflow.com/comment/39742884
has comment: http://stackoverflow.com/comment/39766309
has answer: http://stackoverflow.com/a/25442581
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39701065
upvote count: 1
has comment: http://stackoverflow.com/comment/39699222

http://stackoverflow.com/comment/39737191
comment on: http://stackoverflow.com/a/25464485
type: Comment
score: 0
type: AnswerComment
has text: @djechlin that's fine, if user2864740 thinks this answer is not useful I'm okay with his downvote :)

http://stackoverflow.com/comment/39749812
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25470879
score: 0
has text: That's not entirely true - you can if you have not assigned it before.

http://stackoverflow.com/comment/39759694
type: AnswerComment
comment on: http://stackoverflow.com/a/25475795
has text: @KipBodey See edit. Although I am still not sure why you need the outside for loop, as removing it will make sure that unless the user chooses a valid input he will never exit the while loop. Thus giving you the desired effect.
type: Comment
score: 0

android-fragments
tags question: http://stackoverflow.com/q/25479970
tags question: http://stackoverflow.com/q/25475747
tags question: http://stackoverflow.com/q/25410788
tags question: http://stackoverflow.com/q/25413142
tags question: http://stackoverflow.com/q/25487991
tags question: http://stackoverflow.com/q/25469761
tags question: http://stackoverflow.com/q/25470081
tags question: http://stackoverflow.com/q/25461871
tags question: http://stackoverflow.com/q/25426296
tags question: http://stackoverflow.com/q/25471433
tags question: http://stackoverflow.com/q/25463081
tags question: http://stackoverflow.com/q/25528769
tags question: http://stackoverflow.com/q/25536466
type: Tag
tags question: http://stackoverflow.com/q/25393545
tags question: http://stackoverflow.com/q/25479784
tags question: http://stackoverflow.com/q/25405953
tags question: http://stackoverflow.com/q/25416293
tags question: http://stackoverflow.com/q/25426830
tags question: http://stackoverflow.com/q/25503674
tags question: http://stackoverflow.com/q/25493307
tags question: http://stackoverflow.com/q/25438824
tags question: http://stackoverflow.com/q/25408437
tags question: http://stackoverflow.com/q/25448664
tags question: http://stackoverflow.com/q/25455101
tags question: http://stackoverflow.com/q/25435531
tags question: http://stackoverflow.com/q/25469029
tags question: http://stackoverflow.com/q/25466921
tags question: http://stackoverflow.com/q/25393873
tags question: http://stackoverflow.com/q/25479679
tags question: http://stackoverflow.com/q/25526107
tags question: http://stackoverflow.com/q/25444678
tags question: http://stackoverflow.com/q/25434593
tags question: http://stackoverflow.com/q/25499207
tags question: http://stackoverflow.com/q/25409963
tags question: http://stackoverflow.com/q/25471660
tags question: http://stackoverflow.com/q/25462210
tag name: android-fragments
tags question: http://stackoverflow.com/q/25486775
tags question: http://stackoverflow.com/q/25405463
tags question: http://stackoverflow.com/q/25533008
tags question: http://stackoverflow.com/q/25400559
tags question: http://stackoverflow.com/q/25454028

http://stackoverflow.com/comment/39724437
comment on: http://stackoverflow.com/q/25457534
score: 2
type: Comment
type: QuestionComment
has text: Yes, they are called `SharedPreferences`, save to a DB, or save to a file

http://stackoverflow.com/comment/39751193
type: QuestionComment
comment on: http://stackoverflow.com/q/25471759
score: 0
has text: @SergeBallesta - not working. I get an exception that tell bean about 2 bean definitions. I guess it loads them both. It could be useful in case where I'd like to add more beans of my own, but not in this case
type: Comment

http://stackoverflow.com/q/25476712
has body: I have the following POJO's: public class Prices implements Serializable{ private static final long serialVersionUID = 1L; @Expose private Integer idPrice; @Expose private String date; @Expose private Double price; @Expose private OrderLine orderLine; public Prices(){} // getters and setters } public class OrderLine implements Serializable { private static final long serialVersionUID = 1L; @Expose private Integer idOrderLine; @Expose private Articles art; @Expose private Integer q; private List&lt;Prices&gt; prices; public OrderLine(){} // getters and setters } I'm trying to parse a price object to JSON by using the following method: Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); String response = gson.toJson(price); ... but somehow GSON doesn't parse the OrderLine contained in the Price object. If i do: System.out.println("Price: " + response); I get the following answer: Price: {"idPrice":1,"date":"2014-08-24","price":37.0,"orderLine":{}} I'm using Hibernate too but I don't think it is the problem because if I do: System.out.println(price); ... then I get the whole object data. What am I doing wrong ? Update: This is how i initialize my price variable. (must say i'm new to Hibernate and Gson) public static String getPrice(Integer idPrice) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); String hql = "from Prices p where p.idPrice = :idPrice"; Prices price = (Prices) session.createQuery(hql) .setParameter("idPrice", idPrice) .uniqueResult(); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); String response = gson.toJson(price); // i have added the following code just to see what results i was getting System.out.println(price); &lt;--- this shows all the object's data System.out.println(response); &lt;-- this shows Price: {"idPrice":1,"date":"2014-08- 24","price":37.0,"orderLine":{}} tx.commit(); session.flush(); session.close(); return respo…
has comment: http://stackoverflow.com/comment/39761191
type: Question
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has title: Gson doesn't parse an exposed field
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39761093
score: 0
answer count: 0
tagged with: gson
has comment: http://stackoverflow.com/comment/39760427
has comment: http://stackoverflow.com/comment/39761695

storage
tag name: storage
tags question: http://stackoverflow.com/q/25540158
type: Tag

http://stackoverflow.com/q/25399310
type: Question
has comment: http://stackoverflow.com/comment/39617138
has comment: http://stackoverflow.com/comment/39625247
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: nio
has comment: http://stackoverflow.com/comment/39615856
has comment: http://stackoverflow.com/comment/39615884
has answer: http://stackoverflow.com/a/25399512
downvote count: 0
has comment: http://stackoverflow.com/comment/39615749
upvote count: 1
has comment: http://stackoverflow.com/comment/39615832
answer count: 1
tagged with: file
has comment: http://stackoverflow.com/comment/39615976
has body: If I manually open .txt file and then executed code to check if file is open or not. It always says file is not opened. But same code works as expected for any MS Office(.doc, .xls, .ppt). Here is the code snippet: File file = new File("F:\\abc.txt"); FileChannel channel = null; FileLock lock = null; try { channel = new RandomAccessFile(file, "rw").getChannel(); // Get an exclusive lock on the whole file try { lock = channel.tryLock(); if (lock != null) { System.out.println("Lock acquired on file: " + file.getAbsolutePath()); lock.release(); System.out.println("Lock released from closed file."); System.out.println("Closing the channel of closed file."); } channel.close(); } catch (OverlappingFileLockException | IOException e) { // File is open by someone else } } catch (FileNotFoundException e1) { // File is open by someone else } Each time, .txt file acquires lock even though same file is opened (which is not same behavior for MS Office files ). Is there any other way to test whether file is opened/used by other process ?
has comment: http://stackoverflow.com/comment/39617428
favorite count: 0
has title: tryLock functionlaity not working for .txt files

http://stackoverflow.com/comment/39731513
type: Comment
type: AnswerComment
has text: I think one can simply do `if (!(node instanceof Comment))` as Comment extends Node
comment on: http://stackoverflow.com/a/25461222
score: 1

http://stackoverflow.com/comment/40984188
type: QuestionComment
has text: What command were you trying to run? What results or error messages did it yield?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25495063

http://stackoverflow.com/comment/39626198
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25403911
score: 0
has text: It was jre8 and i switched back to jre7 but still getting error. `Launching Tomcat v7.0 Server at localhost (2) has encountered a problem. Several Ports(8005, 8080, 8009) required by Tomcat v7.0 Server at localhost (2) are already in use`. But my Apache Tomcat Service is already stopped.

http://stackoverflow.com/comment/39683850
type: Comment
type: QuestionComment
has text: Please take a bit of time to go through a Java book for beginners, or follow Oracle tutorials at http://docs.oracle.com/javase/tutorial/ , with particular attention to http://docs.oracle.com/javase/tutorial/java/index.html
comment on: http://stackoverflow.com/q/25435535
score: 1

compiler-errors
tags question: http://stackoverflow.com/q/25477057
tag name: compiler-errors
tags question: http://stackoverflow.com/q/25458729
tags question: http://stackoverflow.com/q/25473049
tags question: http://stackoverflow.com/q/25466682
type: Tag

http://stackoverflow.com/a/25773950
has body: Just try to run your Java class using Run function with Robot Framework like this: CommonResource.robot: # This file is located in "robot" folder *** Settings *** Documentation CommonResource file with KWs Library OperatingSystem *** Variables *** ${SRC_PATH} ../../src/ *** Keywords *** Compile Class [Arguments] ${class_name} ${path}=${SRC_PATH} Run javac ${path}${class_name}.java Run Java Class [Arguments] ${class_name} ${path}=${SRC_PATH} Compile Class ${path} ${class_name} ${output}= Run java -cp ${path} ${class_name} Log ${output} WARN Test.java: /** * This file is located in "src" folder */ public class Test { public static void main(String[] args) { System.out.println("Hello World!"); } } TestCase.robot: # This file is located in "robot/Tests" folder *** Settings *** Documentation Running Java class with RF Resource ../CommonResource.robot *** Testcases *** TestOne Run Java Class Test
upvote count: 2
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/51989717
type: Answer
has comment: http://stackoverflow.com/comment/40993959
answers question: http://stackoverflow.com/q/25521179
has comment: http://stackoverflow.com/comment/40993523
has comment: http://stackoverflow.com/comment/40993872

http://stackoverflow.com/a/25402733
score: 0
answers question: http://stackoverflow.com/q/25402594
has body: Try to add @JsonIgnore on the getter method if you have it, and add @JsonProperty(name = "data") on the byte[] data property as a setter method: @JsonProperty(name = "data") private byte[] getData() { // get data return data; }
type: Answer

http://stackoverflow.com/q/25404056
type: Question
has answer: http://stackoverflow.com/a/25404378
has comment: http://stackoverflow.com/comment/39624794
has body: Auto resize 1 column, leaving another to take the rest of the available space. Using JTable in a JScrollPane. I've been looking around for this for a while, and I can't seem to find an example that does this. I've got a JTable in a ScrollPane, with 2 columns, and many rows. The first column only shows a small amount of data which is usually the same length, while the in the second, the length can vary quite a bit. I'd like to resize the first column to fit the data, and then allow the second column to use up the rest of the space. I don't want it equally distributed across the panel. I've seen examples of setting one column to Auto Resize, but what will that do with the second column? Any help would be appreciated! Thanks. Steve
tagged with: jtable
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25404378
tagged with: jscrollpane
tagged with: java
has title: Auto resize 1 column, leaving another to take the rest of the available space. Using JTable in a JScrollPane
answer count: 1
tagged with: jtableheader
tagged with: swing

http://stackoverflow.com/comment/39724701
type: Comment
has text: Unfortunately, I am not seeing the issue in the code provided. However, in most of my experience, anytime I received a StackOverFlow error was from getter method calling itself. However, I'm sure the issue can be elsewhere if that is not the case.
type: QuestionComment
comment on: http://stackoverflow.com/q/25453977
score: 1

http://stackoverflow.com/comment/39803878
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25467576
type: Comment
has text: @user198923 Fine. Good luck!

http://stackoverflow.com/comment/68316602
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26739909
has text: That folder does not contain it. [macbook_tcs ] ---> [/Users/timsiwula/]$ cd ~/.IntelliJIdea15/ [macbook_tcs ] ---> [/Users/timsiwula/.IntelliJIdea15/]$ ls -la total 0 drwxr-xr-x 3 timsiwula staff 102 Jun 12 10:57 . drwxr-xr-x+ 105 timsiwula staff 3570 Nov 6 23:47 .. drwxr-xr-x 3 timsiwula staff 102 Oct 7 22:37 restart [macbook_tcs ] ---> [/Users/timsiwula/.IntelliJIdea15/]$
type: AnswerComment

password-protection
tags question: http://stackoverflow.com/q/25504137
tag name: password-protection
type: Tag

http://stackoverflow.com/q/25517141
has answer: http://stackoverflow.com/a/25517178
has title: Why is this an error?
has answer: http://stackoverflow.com/a/25517166
score: 0
answer count: 2
tagged with: syntax
type: UnansweredQuestion
tagged with: java
has body: I get an error on this line "System.out.println((num1/dem1)(num2/dem2)); " The error says: Multiple markers at this line - The left-hand side of an assignment must be a variable - Syntax error on token ")", AssignmentOperator expected after this token package project; import java.util.Scanner; public class summerproject { public static void main(String[] args) { Scanner in = new Scanner( System.in ); { //INPUT NUMBERS System.out.println("Enter Numerator 1. "); int num1 = in.nextInt(); System.out.println("Enter Denominator 1. "); int dem1 = in.nextInt(); System.out.println("Enter Numerator 2. "); int num2 = in.nextInt(); System.out.println("Enter Denominator 2. "); int den2 = in.nextInt(); } System.out.println("Press 1 to multiply"); int mult = in.nextInt(); if (mult == 1) { System.out.println((num1/dem1)(num2/dem2)); } }//ARGS BRACKET }//END BRACKET
has comment: http://stackoverflow.com/comment/39835760
type: Question

http://stackoverflow.com/comment/39744239
has text: @Avinash Raj, even if i add the `\\.` instead of `.` the result is the same : it stays processing without any result when i remove the `.txt` OR just the `txt` and leave the period ( . )
score: 0
comment on: http://stackoverflow.com/q/25468220
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25504364
answers question: http://stackoverflow.com/q/25504164
has comment: http://stackoverflow.com/comment/39811056
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39811126
has body: You are mixing AWT and SWT. The setForeground method of an SWT table needs a org.eclipse.swt.graphics.Color reference. Call it like this: Display display = table.getDisplay(); // or whatever can get you the display reference table.setForeground(display.getSystemColor(SWT.COLOR_BLUE));
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25504164
upvote count: 1
has comment: http://stackoverflow.com/comment/39811166
has comment: http://stackoverflow.com/comment/39810983

http://stackoverflow.com/a/25535977
type: Answer
has comment: http://stackoverflow.com/comment/39907082
answers question: http://stackoverflow.com/q/25506056
has body: In short, you don't pass all of your data from one Activity to another. You should just pass a restaurant ID to a new Activity, and it uses that ID to pull data of the restaurant. You should consider your restaurant list as (part of) Model in an MVC architecture. It should be separated from your Activities (which are Controller). Model is your data expert, it keeps your data in memory, files or a database, and it lives beyound the life-cycle of any particular Activity. You don't pass the Model from one Activity to another. After an Activity is created, it grabs the Model (if the Model is a Singleton) or the Model is injected into that Activity (Dependency Injection, my prefer framework is Dagger). The Activity then can ask for any particular data from the Model and render its View. It can also observe for any further changes within the Model and update its view accordlingly.
has comment: http://stackoverflow.com/comment/39898157
has comment: http://stackoverflow.com/comment/39898136
has comment: http://stackoverflow.com/comment/39907138
score: 0

http://stackoverflow.com/q/25394365
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/39608134
tagged with: arrays
has comment: http://stackoverflow.com/comment/39606987
has comment: http://stackoverflow.com/comment/39607212
has answer: http://stackoverflow.com/a/25424411
accepted answer: http://stackoverflow.com/a/25424411
has title: OutOfMemoryError error while doing "File to byte[]" in Java for a large file?
has comment: http://stackoverflow.com/comment/39607298
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39607135
score: 1
tagged with: java
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/39607356
tagged with: file
has comment: http://stackoverflow.com/comment/39608036
has comment: http://stackoverflow.com/comment/39607021
favorite count: 0
type: Question
upvote count: 2
has body: I have tried various kinds of codes to convert a large CSV file (~300 MB) to byte[] but each time it fails giving Java Heap Space error as shown below: 184898 [jobLauncherTaskExecutor-1] DEBUG org.springframework.batch.core.step.tasklet.TaskletStep - Rollback for Error: java.lang.OutOfMemoryError: Java heap space 185000 [jobLauncherTaskExecutor-1] DEBUG org.springframework.transaction.support.TransactionTemplate - Initiating transaction rollback on application exception java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2367) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130) at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415) at java.lang.StringBuffer.append(StringBuffer.java:237) at org.apache.log4j.helpers.PatternParser$LiteralPatternConverter.format(PatternParser.java:419) at org.apache.log4j.PatternLayout.format(PatternLayout.java:506) at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:310) at org.apache.log4j.WriterAppender.append(WriterAppender.java:162) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66) at org.apache.log4j.Category.callAppenders(Category.java:206) at org.apache.log4j.Category.forcedLog(Category.java:391) at org.apache.log4j.Category.log(Category.java:856) at org.slf4j.impl.Log4jLoggerAdapter.log(Log4jLoggerAdapter.java:601) at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:133) at org.apache.http.impl.conn.Wire.wire(Wire.java:77) at org.apache.http.impl.conn.Wire.output(Wire.java:107) at org.apache.http.impl.conn.LoggingSessionOutputBuffer.write(LoggingSessionOutputBuffer.java:76) at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:119) at org.apache.http…

http://stackoverflow.com/q/25399272
answer count: 0
upvote count: 1
tagged with: jndi
type: UnansweredQuestion
downvote count: 0
has title: Java Jndi connection gets full before max connection limit
favorite count: 0
score: 1
tagged with: java
has body: I have five applications connected to each other, In this I have set max connection limit for each application 50 in context.xml file. like this, &lt;Resource name="jdbc/pcrmnet" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://url:5432/mydb" username="test" password="test123" maxActive="50" maxIdle="10" maxWait="-1"/&gt; &lt;Resource name="jdbc/accountmsnet" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://url:5432/mydb" username="test" password="test123" maxActive="50" maxIdle="10" maxWait="-1"/&gt; &lt;Resource name="jdbc/society123net" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://url:5432/mydb" username="test" password="test123" maxActive="50" maxIdle="10" maxWait="-1"/&gt; &lt;Resource name="jdbc/hdpcrmnet" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://url:5432/mydb" username="test" password="test123" maxActive="50" maxIdle="10" maxWait="-1"/&gt; &lt;Resource name="jdbc/facilitybookingnet" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://url/mydb" username="test" password="test123" maxActive="50" maxIdle="10" maxWait="-1"/&gt; but if connection 50 is full in one application, server doesnt allow us to create connection object in remaining 4 application.. whats missing please help.
type: Question

http://stackoverflow.com/q/25403840
has answer: http://stackoverflow.com/a/25414557
has title: Transforming Streaming XSLT Without a Custom Content Handler
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39632244
answer count: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39626418
has answer: http://stackoverflow.com/a/25691302
accepted answer: http://stackoverflow.com/a/25691302
tagged with: streaming
downvote count: 0
possible better answer: http://stackoverflow.com/a/25414557
has body: Take a look at this website: http://xmpp.wordpress.com:8008/firehose.xml?type=text/plain It constantly streams data. You can transform this content using the newest version of XSLT (v3), with a command like this: &lt;xsl:stream href="http://xmpp.wordpress.com:8008/firehose.xml?type=text/plain"&gt; If I want to write some Java code to initiate the transformation (using Saxon, which has implemented xsl:stream), I can do this: // XSL TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(new StreamSource(new FileInputStream(xslFile))); // XML StreamSource xmlSource = new StreamSource(new FileInputStream(xmlFile)); // Output MyCustomContentHandler handler = new MyCustomContentHandler(); PrintStream outputPrintStream = new PrintStream(new BufferedOutputStream(new FileOutputStream(outputFile)), true); handler.setPrintStream(outputPrintStream); Result result = new SAXResult(handler); // Transform transformer.transform(xmlSource, result); This works. If you let it run for a bit, then open the output file, you’ll see data in it. If you re-open it a bit later, you’ll see even more data. The key to this is the custom content handler that processes the various SAX events. But suppose that I don’t really want a custom content handler. Suppose I just want to keep the output of the XSLT as is. I can modify my code like this: // XSL TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(new StreamSource(new FileInputStream(xslFile))); // XML StreamSource xmlSource = new StreamSource(new FileInputStream(xmlFile)); // Output TransformerHandler transformerHandler = ((SAXTransformerFactory) SAXTransformerFactory.newInstance()).newTransformerHandler(); transformerHandler.setResult(new StreamResult(new PrintWriter(new FileOutputStream(outputFile, true), true))); // or this… //transformerHandler.setResult(new StreamResult(new FileOut…
tagged with: xslt
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39632194
tagged with: saxon

http://stackoverflow.com/comment/39644539
type: QuestionComment
comment on: http://stackoverflow.com/q/25414129
type: Comment
score: 0
has text: Yes, you'd need to assign a layout manager, which would update the components of the container according to its requirements. What do you mean *"when they are saved"*? An object is a self contained entity, so yes, once applied, those values will be maintained by the object itself and all references to the same object (or memory location) will have the same information, as it's the same data ...

http://stackoverflow.com/a/25444316
score: 2
answers question: http://stackoverflow.com/q/25442322
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25442322
has body: Override the isOptimizedDrawingEnabled method of the parent panel and have it return false: @Override public boolean isOptimizedDrawingEnabled() { return false; } This is necessary if a component's children overlap, otherwise Swing will not paint them correctly.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39673439
comment on: http://stackoverflow.com/a/25429167
score: 0
type: AnswerComment
has text: *"A question that requests thread design opinions.."* ..is closable even on that basis. This is a *Question and Answer* site, not a *Discussion and Opinion* site.
type: Comment

http://stackoverflow.com/comment/39727911
type: Comment
type: AnswerComment
has text: You could look at `org.eclipse.compare.contentmergeviewer.TextMergeViewer`
comment on: http://stackoverflow.com/a/25454140
score: 0

http://stackoverflow.com/comment/39705700
type: Comment
type: QuestionComment
score: 1
has text: Why? What does the function _do_? Are you trying to do filtering or validation? Just seems weird, your explanation. If you want to end the typing and process the field data, a more common approach would be to use an ActionListener and let the Enter key begin the process. Please elaborate a little more, so this doesn't become an [xy problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem)
comment on: http://stackoverflow.com/q/25447485

http://stackoverflow.com/comment/39830452
comment on: http://stackoverflow.com/q/25466319
has text: I think nothing is wrong with your definition of function `vite()` in first attempt , it look to me that something is wrong in java calling or jni calling , you can simply do the first part as `cv::resize(img2,img2,img1.size()); out=img1+img2;`
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25522783
has title: equals() method and == are equal or not equal?
has answer: http://stackoverflow.com/a/25522855
answer count: 3
has comment: http://stackoverflow.com/comment/39845627
has body: I know that Object.equals() compares the value of object in heap memory. and == compares the references. But when I am running my code I am getting both as equal. public class test3 { public static void main(String args[]){ test2 ts = new test2(); test2 tss = new test2(); if(ts.a == tss.a){ System.out.println("they are equal"); }else System.out.println("they are unequal.."); if(ts.a.equals(tss.a)){ System.out.println("equal"); }else System.out.println("not equal.."); } } public class test2 { String a= "soumya"; }
score: 0
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/25523497
has comment: http://stackoverflow.com/comment/39845571
has answer: http://stackoverflow.com/a/25523002
has comment: http://stackoverflow.com/comment/39845513
linked to: http://stackoverflow.com/q/3131136
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39845339
has comment: http://stackoverflow.com/comment/39845443
has comment: http://stackoverflow.com/comment/39845328
upvote count: 2
has comment: http://stackoverflow.com/comment/39845375
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2486191

http://stackoverflow.com/comment/39691939
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25426187
type: Comment
has text: Getting same error for this file also test_mono_16000Hz_16bit_PCM.wav which has 16khz 16bit mono PCM format

http://stackoverflow.com/a/25427742
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25427669
type: Answer
has body: You cannot create arrays of parameterized types. Your best choice is to use List instead of array. Also while creating references you should prefer interface over actual class. List&lt;List&lt;Map&lt;String, String&gt;&gt;&gt; list = new ArrayList&lt;List&lt;Map&lt;String, String&gt;&gt;&gt;; list.add(menuItems1); list.add(menuItems2); list.add(menuItems3); list.add(menuItems4); list.add(menuItems5); list.add(menuItems6);

http://stackoverflow.com/comment/39654768
type: Comment
type: QuestionComment
has text: http://techlovejump.in/android-push-notification-using-google-cloud-messaging-gcm-php-google-play-service-library/
comment on: http://stackoverflow.com/q/25420295
score: 0

http://stackoverflow.com/q/25456696
has comment: http://stackoverflow.com/comment/39723005
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/39723531
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39723252
favorite count: 0
tagged with: android-asynctask
has body: I would like to save some data to SharedPreferences inside of an AsyncTask, I have google it and followed some of the other answer on here but I can't seem to get it to work correctly. public class NtmLoadingTask extends AsyncTask&lt;Void, Void, Void&gt; { ArrayList&lt;String&gt; arr_dataNtmTitles = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; arr_dataNtmDates = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; arr_dataNtmContents = new ArrayList&lt;String&gt;(); public NtmLoadingTask(Context applicationContext) { } @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected Void doInBackground(Void... params) { Document docNTM; try { Connection.Response response = Jsoup.connect("http://omitted") .timeout(10000) .ignoreHttpErrors(true) .execute(); int statusCode = response.statusCode(); if (statusCode == 200) { docNTM = Jsoup.connect("http://omitted").timeout(10000).get(); Elements tableRows; tableRows = docNTM.select("table[title= TABLE]"); //Get the Notices to Mariners Amount Element ntmNumber = tableRows.select("td:eq(0)").last(); String ntmAmt = ntmNumber.text(); //In-case Data does not exist... if (tableRows != null) {//Exists... //Convert Ntm Number to int for Gathering the Ntm List int ntmInt = Integer.parseInt(ntmAmt); for (int i = 0; i &lt; ntmInt; i++) { //Get Ntm Titles Elements titles = tableRows.select("td:eq(1)"); String ntmTitle = titles.get(i).text() + "\n"; arr_dataNtmTitles.add(ntmTitle); //Get Ntm Dates Elements dates = tableRows.select("td:eq(2)"); String ntmDates = dates.get(i).text() + "\n"; arr_dataNtmDates.add(ntmDates); //Get Ntm Content Elements contents = tableRows.select("td:eq(3)"); String ntmContent = contents.get(i).text() + "\n"; arr_dataNtmContents.add(ntmContent); *****THIS IS WHERE I WOULD LIKE TO SAVE THE DATA SO AS ONCE THIS TASK HAS COMPLETED I CAN USE IT IN ANOTHER ACTIVITY********************** }; } else { System.out.println("No Data : " + statusCode ); } } else { System.out.println("Re…
type: Question
has comment: http://stackoverflow.com/comment/39723557
tagged with: android
has comment: http://stackoverflow.com/comment/39723018
accepted answer: http://stackoverflow.com/a/25494606
linked to: http://stackoverflow.com/q/6186123
has comment: http://stackoverflow.com/comment/39723511
has answer: http://stackoverflow.com/a/25494606
score: -1
has title: Saving Data to SharedPreferences inside "doInBackground"
has comment: http://stackoverflow.com/comment/39723237

http://stackoverflow.com/comment/39774645
type: Comment
type: AnswerComment
score: 1
has text: @yunfan Yes but a HashMap is not just one object. It is many objects with many references. Any number of these might be `null` or invalid.
comment on: http://stackoverflow.com/a/25474158

http://stackoverflow.com/comment/40237056
type: Comment
type: AnswerComment
score: 1
has text: There is a demo called SynchronizedNotifications in the SDK samples that shows exactly how to implement this.
comment on: http://stackoverflow.com/a/25548109

http://stackoverflow.com/a/25480685
upvote count: 1
has body: Overriding is resolved at run-time and hence, it will always look after the object which is of B class in your case. A a = new B(); Hence, once you override the test() method and run the main method, B's method will be called otherwise A's method will be called.
answers question: http://stackoverflow.com/q/25480617
score: 1
downvote count: 0
type: Answer

class
tags question: http://stackoverflow.com/q/25478659
tags question: http://stackoverflow.com/q/25534391
tags question: http://stackoverflow.com/q/25407292
tags question: http://stackoverflow.com/q/25501754
tags question: http://stackoverflow.com/q/25407310
tags question: http://stackoverflow.com/q/25464700
type: Tag
tags question: http://stackoverflow.com/q/25492905
tags question: http://stackoverflow.com/q/25539598
tags question: http://stackoverflow.com/q/25468867
tags question: http://stackoverflow.com/q/25424081
tags question: http://stackoverflow.com/q/25506629
tags question: http://stackoverflow.com/q/25473976
tags question: http://stackoverflow.com/q/25481928
tags question: http://stackoverflow.com/q/25537932
tag name: class
tags question: http://stackoverflow.com/q/25428768
tags question: http://stackoverflow.com/q/25540698
tags question: http://stackoverflow.com/q/25458497
tags question: http://stackoverflow.com/q/25413285
tags question: http://stackoverflow.com/q/25518605
tags question: http://stackoverflow.com/q/25412903
tags question: http://stackoverflow.com/q/25473569
tags question: http://stackoverflow.com/q/25473846
tags question: http://stackoverflow.com/q/25501956
tags question: http://stackoverflow.com/q/25530075
tags question: http://stackoverflow.com/q/25442070

http://stackoverflow.com/comment/39819928
has text: You could make the constructor private and provide static factory methods, which would catch the exceptions and throw runtime exceptions if they ever happen to actually be thrown.
score: 8
comment on: http://stackoverflow.com/q/25508873
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25419923
accepted answer of: http://stackoverflow.com/q/25413027
type: Answer
answers question: http://stackoverflow.com/q/25413027
has body: The saml servlet processes URLs /saml/web/* and therefore skips your /redirect controller. You will need to change the saml servlet mapping in web.xml to: saml /* Please note that this will break the metadata administration UI in the sample application. You would need to replace the current security for admin UI with: <security:http pattern="/metadata/**" access-denied-page="/metadata/login"> <security:form-login login-processing-url="/metadata/login_check" login-page="/metadata/login" default-target-url="/metadata"/> <security:intercept-url pattern="/metadata/login" access="IS_AUTHENTICATED_ANONYMOUSLY"/> <security:intercept-url pattern="/metadata/**" access="ROLE_ADMIN"/> <security:custom-filter before="FIRST" ref="metadataGeneratorFilter"/> </security:http> Then remove all /saml/web prefixes in JSPs and change adminLogin.jsp to use /metadata/login_check in the loginForm.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25461594
score: 1
has comment: http://stackoverflow.com/comment/39731892
tagged with: oop
has comment: http://stackoverflow.com/comment/39731830
tagged with: java
has comment: http://stackoverflow.com/comment/123106760
has answer: http://stackoverflow.com/a/25461624
favorite count: 0
type: Question
has title: User Defined Interface vs Built In Interface
has body: Based on its understanding, in Java, interface is a group of related methods with empty body. Each class that implement interface, should provide the implementation, of each method found in the interface. But there are some built in interface, that its method, has its implementation already, and ready to be used. For example: Interface Enumeration. It has 2 methods, that are ready to be used, such as hasMoreElements() and nextElement(). Refer to the link below: http://www.tutorialspoint.com/java/java_enumeration_interface.htm Based on the interface understanding, interface consist only method with empty body, but why Interface Enumeration, can consist method with implementation ... Please kindly explain ...
has comment: http://stackoverflow.com/comment/39731931
type: UnansweredQuestion
tagged with: interface
answer count: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39766789
score: 0
type: Comment
type: QuestionComment
has text: impli en explicit waits sometimes do go to quick, just as sleep sometimes aswell. It's a known issue of selenium , putting the timer higher is just for debugging
comment on: http://stackoverflow.com/q/25445423

maven
tags question: http://stackoverflow.com/q/25496250
tags question: http://stackoverflow.com/q/25437542
tags question: http://stackoverflow.com/q/25502718
tags question: http://stackoverflow.com/q/25468704
tags question: http://stackoverflow.com/q/25430303
tags question: http://stackoverflow.com/q/25539285
tags question: http://stackoverflow.com/q/25484180
tags question: http://stackoverflow.com/q/25441626
tags question: http://stackoverflow.com/q/25398703
tags question: http://stackoverflow.com/q/25499590
tags question: http://stackoverflow.com/q/25432810
tags question: http://stackoverflow.com/q/25540950
tags question: http://stackoverflow.com/q/25453342
tags question: http://stackoverflow.com/q/25402241
tags question: http://stackoverflow.com/q/25508845
tags question: http://stackoverflow.com/q/25395255
tags question: http://stackoverflow.com/q/25391118
tags question: http://stackoverflow.com/q/25534505
type: Tag
tags question: http://stackoverflow.com/q/25546496
tags question: http://stackoverflow.com/q/25494507
tags question: http://stackoverflow.com/q/25509493
tags question: http://stackoverflow.com/q/25488672
tags question: http://stackoverflow.com/q/25460716
tags question: http://stackoverflow.com/q/25492071
tags question: http://stackoverflow.com/q/25462667
tags question: http://stackoverflow.com/q/25509870
tags question: http://stackoverflow.com/q/25513530
tags question: http://stackoverflow.com/q/25515024
tags question: http://stackoverflow.com/q/25444185
tags question: http://stackoverflow.com/q/25413023
tags question: http://stackoverflow.com/q/25436753
tags question: http://stackoverflow.com/q/25501962
tags question: http://stackoverflow.com/q/25428317
tags question: http://stackoverflow.com/q/25397717
tags question: http://stackoverflow.com/q/25509763
tags question: http://stackoverflow.com/q/25400502
tags question: http://stackoverflow.com/q/25490505
tags question: http://stackoverflow.com/q/25541170
tags question: http://stackoverflow.com/q/25400327
tags question: http://stackoverflow.com/q/25412769
tags question: http://stackoverflow.com/q/25467233
tags question: http://stackoverflow.com/q/25483859
tags question: http://stackoverflow.com/q/25444325
tags question: http://stackoverflow.com/q/25442947
tags question: http://stackoverflow.com/q/25469144
tags question: http://stackoverflow.com/q/25412063
tags question: http://stackoverflow.com/q/25405894
tags question: http://stackoverflow.com/q/25405170
tags question: http://stackoverflow.com/q/25419398
tags question: http://stackoverflow.com/q/25525581
tags question: http://stackoverflow.com/q/25419131
tags question: http://stackoverflow.com/q/25453502
tags question: http://stackoverflow.com/q/25471638
tags question: http://stackoverflow.com/q/25428347
tags question: http://stackoverflow.com/q/25507445
tags question: http://stackoverflow.com/q/25445056
tags question: http://stackoverflow.com/q/25431757
tags question: http://stackoverflow.com/q/25467105
tags question: http://stackoverflow.com/q/25494878
tags question: http://stackoverflow.com/q/25424889
tags question: http://stackoverflow.com/q/25449748
tags question: http://stackoverflow.com/q/25525001
tags question: http://stackoverflow.com/q/25442052
tags question: http://stackoverflow.com/q/25504930
tags question: http://stackoverflow.com/q/25470505
tags question: http://stackoverflow.com/q/25482562
tags question: http://stackoverflow.com/q/25454374
tags question: http://stackoverflow.com/q/25423354
tags question: http://stackoverflow.com/q/25413184
tags question: http://stackoverflow.com/q/25461298
tags question: http://stackoverflow.com/q/25494338
tags question: http://stackoverflow.com/q/25488498
tags question: http://stackoverflow.com/q/25393298
tags question: http://stackoverflow.com/q/25420745
tags question: http://stackoverflow.com/q/25527760
tags question: http://stackoverflow.com/q/25499579
tags question: http://stackoverflow.com/q/25528475
tags question: http://stackoverflow.com/q/25541427
tags question: http://stackoverflow.com/q/25483586

http://stackoverflow.com/a/25488524
answers question: http://stackoverflow.com/q/25486486
has body: I have found the solution. using commmand line runner after the build step. And then using xcopy. This is already answered in stackoverflow Becareful in specifying source and destination to xcopy. In my case, I had spaces in the path location which cause troubles. Finally the answer was to just simply enclose the paths in quotes.
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25486486

http://stackoverflow.com/comment/39796246
type: AnswerComment
comment on: http://stackoverflow.com/a/25495854
score: 0
has text: I want to use them in place of the variables I had in my original code for the variable names of the strings I'm inputting into the array.
type: Comment

http://stackoverflow.com/a/25501573
has body: There are few things you have to change: ResultSet are by-default forward only, since your accessing column Stk_prdid multiple time , it does not returns any value. public ArrayList getAllStockDetails() { ... Statement stmt = dcon.con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); .... while (rs.next()) { HashMap&lt;String, String&gt; stkMap = new HashMap&lt;String, String&gt;();//&lt;-- move here stkList.add(stkMap); ... } .... } In jsp: ... &lt;c:forEach var="row" items="${stkList}"&gt; ... &lt;td&gt;${row.prdStk}&lt;/td&gt; ... ...
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25501441
answers question: http://stackoverflow.com/q/25501441
upvote count: 2
type: Answer

http://stackoverflow.com/comment/39833228
comment on: http://stackoverflow.com/q/25515707
has text: Are you wanting to calculate the percentage gain/loss from transactions? For example, in your second example, n units are bought at $30 total, and n units are sold at $39, so a gain of 30% -
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25439022
has title: Java OutOfMemoryError even with Correct Structuring?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39689704
has comment: http://stackoverflow.com/comment/39689734
has comment: http://stackoverflow.com/comment/39689722
has comment: http://stackoverflow.com/comment/39689694
has comment: http://stackoverflow.com/comment/39689751
has comment: http://stackoverflow.com/comment/39689689
downvote count: 1
has comment: http://stackoverflow.com/comment/39689766
has comment: http://stackoverflow.com/comment/39689695
has body: I am working with 2D int arrays in Java, that are square and can have ~30000 elements in a row and column, which means there are 30000^2*4 bytes in the array, which is less than 5GB (and I have much more than 5GB of memory available). My basic structure of the program is this: public class A { public static void main(String[] args) { Graph g = ...; // read from file System.out.println(B.computeSomethingBig(g)); } } public class B { public static computeSomethingBig(Graph g) { int numVertices = g.numVertices(); System.out.println(numVertices); // ~30000 maximum int[][] array = new int[numVertices][numVertices]; // ... other computations } } Now, in Eclipse, I am running main in class A with these arguments: -Xms5g -Xmx10g I have numVertices print out a value around 30000, and setting the minimum heap size (-Xms) seems more than necessary. However, I get: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
has comment: http://stackoverflow.com/comment/39689742
has comment: http://stackoverflow.com/comment/39689776
score: 3
tagged with: heap-memory
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/39692231
has comment: http://stackoverflow.com/comment/39689701
tagged with: java
has answer: http://stackoverflow.com/a/25447367
tagged with: eclipse
favorite count: 0
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/39689854
has answer: http://stackoverflow.com/a/25439078
answer count: 2

http://stackoverflow.com/q/25420741
has comment: http://stackoverflow.com/comment/39766048
score: 0
tagged with: crm
tagged with: java
has title: query page(web services in crmod) java code reading from excel !! skip value not found
type: Question
tagged with: search
has comment: http://stackoverflow.com/comment/39660283
has comment: http://stackoverflow.com/comment/39669147
has body: I have written a code in java for web services of crm on demand. The code reads the 1st column (id) from excel and queries it in the crm and inserts the values accordingly. If the 'id' is found it inserts the other values, but when the 'id' is not found in the crm the code is terminated with error message. I want the code to query for a record and if found insert the other values, but if the record is not found it should skip that record and query for the next id without it being terminated in between. Please help... and also how to skip cells with no value(null)??
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25479591
answer count: 1
tagged with: web-services
has comment: http://stackoverflow.com/comment/39655682
tagged with: excel

http://stackoverflow.com/q/25481330
has comment: http://stackoverflow.com/comment/39768547
has answer: http://stackoverflow.com/a/26559787
has answer: http://stackoverflow.com/a/75377295
accepted answer: http://stackoverflow.com/a/25481489
has body: I am very new to hibernate so I am practicing by seeing video tutorial. The link I am following is, https://www.youtube.com/watch?v=FFMOZY4z6bE&list=PL4AFF701184976B25&index=5 It is simple java project in eclipse. Here I use mysql Data base. Here is my Hibernate.cfg.xml file, com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/hibernatedb root root 1 org.hibernate.dialect.MYSQLDialect org.hibernate.cache.NoCacheProvider true create <mapping class="com.***.dto.UserDetails"/> I am getting this kind of error , SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.MYSQLDialect at org.hibernate.dialect.resolver.DialectFactory.constructDialect(DialectFactory.java:159) at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:99) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:117) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870) at com.aurodisplay.hibernate.HibernateTest.main(HibernateTest.java:17) Caused by: java.lang.ClassNotFoundException: org.hibernate.dialect.MYSQLDialect at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.hibernate.util.ReflectHelper.classForName(Refle…
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39768376
has comment: http://stackoverflow.com/comment/39768410
has answer: http://stackoverflow.com/a/25481489
has comment: http://stackoverflow.com/comment/39768500
answer count: 5
has comment: http://stackoverflow.com/comment/39768411
has comment: http://stackoverflow.com/comment/39768595
possible better answer: http://stackoverflow.com/a/26559787
downvote count: 0
has comment: http://stackoverflow.com/comment/39768475
has comment: http://stackoverflow.com/comment/39768463
has title: How to resolve "Dialect class not found: org.hibernate.dialect.MYSQLDialect" Exception?
has answer: http://stackoverflow.com/a/78882002
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/39768444
has comment: http://stackoverflow.com/comment/39768532
has comment: http://stackoverflow.com/comment/39768622
has comment: http://stackoverflow.com/comment/39768539
upvote count: 3
has answer: http://stackoverflow.com/a/77556376
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39768687
tagged with: mysql

http://stackoverflow.com/comment/39612935
type: Comment
comment on: http://stackoverflow.com/a/25397461
score: 0
type: AnswerComment
has text: this code was auto generated when I first created this layout, adding that code in question.

http://stackoverflow.com/q/25534680
has body: I have a servlet that queries a database and returns the results as XML. I set the variable in the servlet using session.setAttribute("xml", xmlString); How can I retrieve that attribute using XPath if that's even possible. I need to get it, parse it, and write the values to the webpage. I'm pretty new to XPath.
type: Question
has answer: http://stackoverflow.com/a/25535919
tagged with: servlets
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
score: 0
type: UnansweredQuestion
tagged with: java
has title: Get a session variable in xpath?
answer count: 1

http://stackoverflow.com/comment/39870183
score: 0
comment on: http://stackoverflow.com/a/25535974
type: Comment
type: AnswerComment
has text: Well, to say they work "exactly like primitives" is, I think, a bit of an oversimplification. You can declare a variable to be either a primitive _or_ a reference type. You can create a new reference type (by writing a new class), but you can't create a new primitive. Primitives also don't support methods; you can't say `int a = 3; a.plus(3);`

http://stackoverflow.com/comment/39639753
comment on: http://stackoverflow.com/a/25411862
score: 0
type: Comment
has text: @Bishal "loaded" means what I wrote in the last sentence.
type: AnswerComment

http://stackoverflow.com/a/25446188
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25446052
score: 2
has body: intent.putExtra("data", bitmap) intent.putExtra("your_string", strName); You can recieve bitmap from another activity like this Intent intent = getIntent(); Bitmap bitmap = (Bitmap) intent.getParcelableExtra("data"); It costs a lot of memory and is also slow. If you want to pass it inbetween activities, you can store it in a file. That's more efficient.
upvote count: 2

http://stackoverflow.com/q/25515294
has answer: http://stackoverflow.com/a/25536297
score: 3
tagged with: pmd
tagged with: findbugs
tagged with: spring
has body: We have applications that use the Spring framework's NamedParameterJdbcTemplate to execute various JDBC statements. Most of the methods in this class are overloaded. For example, one version of update() accepts a Map, where the keys are bind variable names, values are variable substitutions. Another version accepts a SqlParameterSource, which allows column type information to be supplied as well. I would like to write a rule that flags use of the Map version, because supplying type information is important for Oracle DBs if one wants to avoid problems under heavy load. Some of the code I need to check is written like this: ---- class 1 ---- public abstract class BaseDao { @Autowired NamedParameterJdbcTemplate namedParamJdbcTemplate; ... } ---- class 2 ---- public class ThingDao extends BaseDao { public int updateTheThing(final Integer thingId, final Integer someVal) { final Map&lt;String, Object&gt; sqlParameters = new HashMap&lt;String, Object&gt;(); sqlParameters.put(":thingIdVar", thingId); sqlParameters.put(":otherVar", someVal); final String query = "UPDATE THINGTABLE SET SOME_FIELD=:otherVar WHERE THING_ID=:thingIdVar"; return namedParamJdbcTemplate.update(query, sqlParameters); } The code in class 2 should cause a violation as it uses a Map, not a SqlParameterSource. Checking for update(...) methods will likely result in false positives as that's a fairly common method name. I only care about the ones in the specific Spring class. Note that the namedParamJdbcTemplate object is declared in a base class, it is not in the class with the violation. Also note, it could be called "namedParameterJdbcTemplate" or "template" or anything else the developer wants. Now, my questions. Is it possible to use PMD to detect violations like this? Or do I need FindBugs since it analyzes bytecode? If possible with PMD, is it possible using XPath rules or only Java? Can someone please point me at an example of how I would do something like this, preferably with PMD? Findbugs or S…
has title: Use PMD to check someObject.methodCall when someObject exists in base class
tagged with: sonarqube
type: AnsweredQuestion
upvote count: 3
tagged with: java
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25536297
favorite count: 0
type: Question

http://stackoverflow.com/a/25519223
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25519133
score: 3
has body: Try and keep you logic simple. While the user hasn't enter 6 numbers, loop Ask the user for a value Check to see if it's a duplicate If it is, ask the user to re-enter the value If it's not (a duplicate) increment the counter to the next element... For example... public static int[] userLottoInput() { int[] userNums = new int[6]; Scanner keyboard = new Scanner(System.in); int i = 0; // Keep looping until we fill the array, but // allow the control to fall somewhere else while (i &lt; userNums.length) { System.out.printf("Enter Lottery number %d: ", i + 1); userNums[i] = keyboard.nextInt(); // Check for duplicates boolean duplicate = false; // We only need to check up to i - 1, as all the // other values are defaulted to 0 // We also don't need to check for the last number entered ;) for (int k = 0; k &lt; i; k++) { // Check for duplicated if (userNums[k] == userNums[i]) { System.out.println("No duplicates allowed, please try again"); duplicate = true; // Break out of the loop as we don't need to check any more.. break; } } // If no duplicates where found, update i to the next position if (!duplicate) { i++; } } return userNums; } With this, there is only one point at which you prompt the user. Everything else is used to control the element position (i) to meet your requirements. Now, I'm sure that there are other ways to do this and this is just a simple example ;)
answers question: http://stackoverflow.com/q/25519133
type: Answer
upvote count: 3

http://stackoverflow.com/comment/39683099
score: 0
type: Comment
has text: found out whats wrong. the ballPong was giving a null value in the Player2Pong class. any idea on how to fix that ?
comment on: http://stackoverflow.com/a/25435215
type: AnswerComment

http://stackoverflow.com/comment/39759284
has text: i cant make declare intValue = 1 outside of loop since it is defined inside the loop, it says cant be resolved to a variable.
comment on: http://stackoverflow.com/a/25475795
score: 1
type: Comment
type: AnswerComment

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/25525690
type: Tag

http://stackoverflow.com/comment/39719518
type: QuestionComment
comment on: http://stackoverflow.com/q/25454954
score: 0
type: Comment
has text: @DmitryGinzburg Except if it doesn't use file IO to read the file, but the ClassLoader's getResource().

http://stackoverflow.com/comment/39766323
type: Comment
type: QuestionComment
has text: yes (I'm sure there isn't required to remove editor)"XxxCellEditor" has, knows row & column coordinates inside JTable, those value for row & column aren't constants, are accessible, settable, scallable
score: 0
comment on: http://stackoverflow.com/q/25480011

http://stackoverflow.com/comment/39864259
has text: I have to object. Who says that the resource **can** be deleted? `remove` makes this fact explicit. If it is missing then the client can act accordingly instead of trying and getting an error. Or imagine `rel=payment`. Can you pay John by POSTing to it or retrieve information about his payment by GETting it?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25513854
score: 6

http://stackoverflow.com/comment/42265915
comment on: http://stackoverflow.com/q/25448871
score: 0
type: Comment
type: QuestionComment
has text: Try replacing socket.connect socket.send and socket.disconnect methods, for this socket.emit("text", text) in case you are expecting a "text" event on the server side.

http://stackoverflow.com/q/25502941
favorite count: 0
type: Question
tagged with: java
has body: I want to convert byte data in Java to byte in C. a is int and b is byte; and I have code in Java like this: b[0x00] = (byte) ((a&gt;&gt; 8) &amp; 0xFF); how can I convert above statement in C?
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
has title: I want to convert byte data in Java to C
score: -3
has comment: http://stackoverflow.com/comment/39808369
has answer: http://stackoverflow.com/a/25503082
upvote count: 0
downvote count: 3
has comment: http://stackoverflow.com/comment/39808437
answer count: 1

http://stackoverflow.com/q/25473649
has comment: http://stackoverflow.com/comment/39754115
score: -7
has comment: http://stackoverflow.com/comment/39754105
upvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/25473927
has body: I am in confusion regarding creating object of Local Class. I am not able to find out how to create Object Of local class.Please help me with this. Thanks
tagged with: java
has answer: http://stackoverflow.com/a/25473664
downvote count: 7
favorite count: 0
type: Question
type: UnansweredQuestion
has title: Can we create object Of Local class
has answer: http://stackoverflow.com/a/25473698

http://stackoverflow.com/comment/39635084
has text: This answer is incorrect. `this` is not a valid parameter, since `this` is a `View` while a `ViewGroup` is expected. So where am I supposed to get this `ViewGroup` from?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25405213
type: Comment

http://stackoverflow.com/comment/39787873
has text: Of course it's possible. What needs to be mocked and injected is someDao.
comment on: http://stackoverflow.com/a/25491300
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25492697
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25492604
downvote count: 0
upvote count: 1
has body: onListItemClick comes from ListActivity define the onItemClickListener as its own variable and reference that instead.

http://stackoverflow.com/comment/39662954
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25414080
has text: @markbernard No, I agree, I didn't see setOpaque mentioned, so that scared me ;)

http://stackoverflow.com/q/25447910
tagged with: java
has comment: http://stackoverflow.com/comment/39705811
has comment: http://stackoverflow.com/comment/39705597
upvote count: 7
linked to: http://stackoverflow.com/q/6825982
downvote count: 1
has comment: http://stackoverflow.com/comment/39705489
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25448017
score: 6
has answer: http://stackoverflow.com/a/25448017
has comment: http://stackoverflow.com/comment/39705454
possible better answer: http://stackoverflow.com/a/25447981
has answer: http://stackoverflow.com/a/25447981
answer count: 4
has answer: http://stackoverflow.com/a/25448357
has title: How can I create an instance of class without invoking constructor of this class?
has comment: http://stackoverflow.com/comment/39705608
type: AnsweredQuestion
has body: There are some cases when we can create an instance without invoking a constructor of instance class. Any ideas what are these cases (Non Reflection API)?
has comment: http://stackoverflow.com/comment/39705510
has answer: http://stackoverflow.com/a/25448023
has comment: http://stackoverflow.com/comment/39705490

http://stackoverflow.com/comment/39701295
has text: Try to annotate the method `postJson` with `@BodyParser.Of(BodyParser.FormUrlEncoded.class)`
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25444637

http://stackoverflow.com/comment/39804937
type: Comment
has text: Have you tested your code with an array like this? `{8,2,0,5,-3,6,0,9}` ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25500254

http://stackoverflow.com/q/25517282
accepted answer: http://stackoverflow.com/a/25517362
has comment: http://stackoverflow.com/comment/39836082
has comment: http://stackoverflow.com/comment/39836139
linked to: http://stackoverflow.com/q/4166966
has comment: http://stackoverflow.com/comment/39836123
score: -1
has comment: http://stackoverflow.com/comment/39836148
has comment: http://stackoverflow.com/comment/39836066
has comment: http://stackoverflow.com/comment/39836280
tagged with: character
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/39836091
has comment: http://stackoverflow.com/comment/39836235
has body: my code is never closing my Scanner input stream. It let's me type in stuff in the console but does not close it with enter. public Stack&lt;String&gt; einlesen(){ Scanner sc = new Scanner(System.in); Stack&lt;String&gt; st = new Stack&lt;&gt;(); //String zeichen; System.out.println("Bitte geben Sie einen Text ein: "); while (sc.hasNext()) { st.push(sc.next()); } //sc.close(); return st; } Edit: How can I achieve, that I can type text in the console and when I hit the Enter key, it jumps back from console to my code? Like the readline() function. Edit2: Ok since it doesn't seem to be possible that easy with the scanner class. I will try it with the DataInputStream Class. I will try something like: first write some text in console, write that whole thing into a variable and then go through every single character in that variable. Thanks for your help though.
upvote count: 0
tagged with: stack
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25517362
has comment: http://stackoverflow.com/comment/39836219
has comment: http://stackoverflow.com/comment/39836048
has comment: http://stackoverflow.com/comment/39836099
downvote count: 1
has comment: http://stackoverflow.com/comment/39836067
favorite count: 0
tagged with: console
type: Question
has comment: http://stackoverflow.com/comment/39836230
has comment: http://stackoverflow.com/comment/39836058
type: AnsweredQuestion
has title: JAVA Scanner should read from console every single character and save it in a Stack
has comment: http://stackoverflow.com/comment/39836031
has comment: http://stackoverflow.com/comment/39836090
has comment: http://stackoverflow.com/comment/39836097

http://stackoverflow.com/q/25519018
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/39886703
has body: I am zipping a .csv file as follows: fileInputStream = new FileInputStream(csvFile); final ZipEntry zipEntry = new ZipEntry(csvFile.getname()); zipOutputStream.putNextEntry(zipEntry); final byte[] buffer = new byte[4 * 1024]; int size = fileInputStream.read(buffer); while (size != -1) { zipOutputStream.write(buffer, 0, size); size = fileInputStream.read(buffer); } The filename also contains japanese/chinese characters On extracting with winzip/ 7-zip the extracted .csv file name is not garbled but when default windows extracter is used the filename is garbled.
tagged with: outlook
tagged with: unzip
tagged with: http://stackoverflow.com/tag/csv
has title: Japanese filename is getting garbled while extracting
has comment: http://stackoverflow.com/comment/39839023
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27539703
score: 0
has comment: http://stackoverflow.com/comment/39839434
has comment: http://stackoverflow.com/comment/39913992
has answer: http://stackoverflow.com/a/27539703
tagged with: zipstream
tagged with: java

http://stackoverflow.com/comment/39848429
comment on: http://stackoverflow.com/q/25521046
type: Comment
type: QuestionComment
has text: The Executors have a lot of possibilites to set Limits, too, by the way. You could use a bounded Queue to block the Producer if the Queue is getting too big ... just to begin with.
score: 0

http://stackoverflow.com/a/25573225
type: Answer
answers question: http://stackoverflow.com/q/25538923
upvote count: 1
type: AcceptedAnswer
has body: I found a solution by using the below code. By tapping in a certain position I could able to pick an image. HashMap&lt;String, Integer&gt; tapObject = new HashMap&lt;String, Integer&gt;(); tapObject.put("x", 100); // in pixels from left tapObject.put("y", 300); // in pixels from top driver.executeScript("mobile: tap", tapObject);
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25538923
score: 1

http://stackoverflow.com/q/25504928
tagged with: java
answer count: 1
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25505006
tagged with: path
tagged with: servlet-3.0
has title: how to write java servelt relative file path
has body: i am using SERVLET and i am reading from XML files i want to read the XML files using relative or dynamic paths , i tried the "./directoryName" and the "fileName" but non of these worked my path now loooks like this : public static final String DEFAULT_INFO_FILES_PATH = "D:/dev/workspace/QwiltSim/src/ps/exalt/qwilt/ui/sim/DevicesInfo.xml"; i want it to be some thing like : public static final String DEFAULT_INFO_FILES_PATH = SomeFolderName+"DevicesInfo.xml" can any one help me please ?
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/39812019

http://stackoverflow.com/a/25533937
has body: This regex could work: [A-Z][0-9] Example code: String strMain = "S1R2G3M1D1N3"; String str = "S1,,--R2,,,,D3-N3"; Pattern pattern = Pattern.compile( "[A-Z][0-9]" ); Matcher matcher = pattern.matcher( str ); while ( matcher.find() ) { if ( strMain.contains( matcher.group() ) ) { System.out.println( matcher.group() ); } } gives this output S1 R2 N3 EDIT In response to your comment... Sometimes digit may not be present. What is the expression? Ex: str="S,,--R2,,,,-N3" shall print "SR2N3". Also sometimes I may have to include single dot or double dots or single quotes or two single quotes Ex: str="S.,,--R2..,,,D3-N3',N3''" shall print S., R2.., N3', N3'' . Here only alphabet is must and digit, single dot, two dots, single quote or two single quotes are all optional. String strMain = "S1R2G3M1D1N3"; String str = "S.,,--R2...o,,,D3-N3',N3''"; Pattern pattern = Pattern.compile( "([A-Z][0-9]?)(?:\\.{1,2}|'{1,2})?" ); Matcher matcher = pattern.matcher( str ); while ( matcher.find() ) { if ( strMain.contains( matcher.group( 1 ) ) ) { System.out.println( matcher.group( 0 ) ); } } gives this output: S. R2.. N3' N3'' [A-Z] is one capital letter. [0-9] is one number. X? is X, one or zero times. so then... [0-9]? is one number, one or zero times. Parenthesis create a capturing group, meaning we can later grab what was matched between the parenthesis... ([A-Z][0-9]?) is going to capture one capital letter and the optional one number. Then to match the dots and single quotes... X{Y,Z} means match X, between Y and Z times, so... X{1,2} means match X, between 1 and 2 times. X|Y means to match either X or Y. I surround this in parenthesis, otherwise the whole expression will be OR'ed. \\. means to match a period. You can't just use . because that has a special meaning, which is any one character. Therefore you must escape it with \, which itself also has to be escaped for the java compiler by using another one. (\\.{1,2}|'{1,2}) means to match one or two periods, OR one or two single …
has comment: http://stackoverflow.com/comment/40345011
accepted answer of: http://stackoverflow.com/q/25533726
has comment: http://stackoverflow.com/comment/39876722
upvote count: 2
answers question: http://stackoverflow.com/q/25533726
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39959931
has comment: http://stackoverflow.com/comment/39915238
score: 2
has comment: http://stackoverflow.com/comment/39905972
has comment: http://stackoverflow.com/comment/39948994
downvote count: 0
type: Answer

http://stackoverflow.com/a/25469696
has body: Your codes look right. It could be that your if/else if statement didn't account for the other sub-classes of Record. Try replace if(records[i] instanceof TXTRecord) { // ..... } else if(records[i] instanceof ARecord) { // .... } with String rdata = records[i].rdataToString();
score: 2
answers question: http://stackoverflow.com/q/25469334
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39747138
has comment: http://stackoverflow.com/comment/39747037
has comment: http://stackoverflow.com/comment/46111123
type: Answer
has comment: http://stackoverflow.com/comment/39749727

http://stackoverflow.com/comment/39824157
type: QuestionComment
has text: No you missed nothing. This can not work. Put the loop in a thread.
comment on: http://stackoverflow.com/q/25511025
score: 0
type: Comment

http://stackoverflow.com/a/25429100
has comment: http://stackoverflow.com/comment/39672838
type: Answer
has comment: http://stackoverflow.com/comment/39684937
accepted answer of: http://stackoverflow.com/q/25428780
score: 0
answers question: http://stackoverflow.com/q/25428780
type: AcceptedAnswer
has body: Firstly the for loop surrounding the first, second, and third parsing for loops: are only looping once, so it is unnecessary. Secondly why find the average, it has no relevance to the specific marks. The second parsing loop looks good (aside from only looping once), but why find the highest mark, if you are trying to find the lowest mark? Also you aren't scanning all rows, only one row; meaning you are only receiving the data from the first subject, rendering the program unable to find the lowest mark out of all the classes. . . You could do something like this: String[][] resultCard = new String[][]{ { " ", "A", "B", "C", "D", "E"}, { "Maths", "78", "98","55","81","65" }, { "Physics", "55", "65", "88", "80", "64"}, { "Java", "73", "66", "69", "79", "79"}, { "C#", "74", "78", "45", "73", "85"}, { "Ethics", "80", "90", "60", "70", "80"} }; int lowest = Integer.parseInt(resultCard[1][1]), tempInt; for(int row = 1; row &lt;= resultCard.length; row++) for(int s = 1; s &lt; resultCard[0].length; s++) { tempInt = Integer.parseInt(resultCard[row][s]); if(lowest &gt; tempInt) lowest = tempInt; } System.out.println("The Lowest Mark Out of All Classes Is: " + lowest); Or You Could Do This For Lowest Per Class: for(int row = 1; row &lt;= resultCard.length; row++) { lowest = resultCard[row][1]; for(int s = 1; s &lt; resultCard[0].length; s++) { tempInt = Integer.parseInt(resultCard[row][s]); if(lowest &gt; tempInt) lowest = tempInt; } System.out.println("The Lowest Mark For " + resultCard[row][0] + " Is: " + lowest); } Hope this helps :) EDIT: static String[][] resultCard; int average(int collumn) { if(collumn &gt; resultCard.length) return 0; int average; for(int i = 1; i &lt; resultCard[collumn].length; i++) average += Integer.parseInt(resultCard[collumn][i]); return average / resultCard[collumn].length; } You could do the same for the other mark editing, as well. You could call them like this: import java.util.Scanner; import java.util.InputMismatchException; //. . . Scanner…

http://stackoverflow.com/comment/39811415
comment on: http://stackoverflow.com/q/25504595
has text: I think since this is runs in a singe thread there won't be any difference.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39670365
has text: Obviously the message is completely wrong, as per https://github.com/datanucleus/datanucleus-api-jdo/blob/master/src/main/java/org/datanucleus/api/jdo/JDOPersistenceManagerFactory.java#L193 so suggest you turn your attention to what software is throwing that exception
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25414210
score: 0

http://stackoverflow.com/comment/39668718
score: 1
type: Comment
has text: he wanted `<name>(space)`
type: AnswerComment
comment on: http://stackoverflow.com/a/25427921

http://stackoverflow.com/comment/39789220
score: 0
has text: @ControlAltDel I have flagged your comment as spam, because it is incorrect.
comment on: http://stackoverflow.com/a/25492328
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25501753
possible better answer: http://stackoverflow.com/a/25501958
accepted answer: http://stackoverflow.com/a/25501994
downvote count: 1
has comment: http://stackoverflow.com/comment/39806453
has answer: http://stackoverflow.com/a/25502057
has comment: http://stackoverflow.com/comment/39806184
tagged with: character
has comment: http://stackoverflow.com/comment/39807263
has title: Java String remove all non numeric characters and word like var123
has answer: http://stackoverflow.com/a/25502353
linked to: http://stackoverflow.com/q/17516049
has answer: http://stackoverflow.com/a/25503029
upvote count: 1
tagged with: string
has body: I have a String: String s = "12 text var2 14 8v 1"; I need to get only numbers from this string like: 12 14 1. But I don't need words like: var2 and 8v.c I tried this: str = str.replaceAll("[^\\d.]", "");`
favorite count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39807623
score: 0
answer count: 5
has answer: http://stackoverflow.com/a/25501958
tagged with: java
has answer: http://stackoverflow.com/a/25501994
has comment: http://stackoverflow.com/comment/40326125

http://stackoverflow.com/comment/39617469
type: QuestionComment
score: 4
type: Comment
has text: Do the asserts create errors or are they just "ignored"?
comment on: http://stackoverflow.com/q/25400250

http://stackoverflow.com/q/25462995
answer count: 3
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25463048
downvote count: 0
upvote count: 1
tagged with: android-activity
tagged with: eclipse
favorite count: 0
type: Question
has body: The code below is the source code for the third and fourth activity.The third activity receives a user input and performs a mathematical operation on it. Then both the original and processed values are send to the fourth activity where it needs to be displayed. I am not quite familiar with the use of intents. Can somebody check my code? It's not working. Third Activity public class Third extends Activity { double x=0, val1=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.third); final EditText et; final Button b; et = (EditText) findViewById(R.id.editText1); b = (Button) findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Third.this, Fourth.class); intent.putExtra("thetext", et.getText().toString()); startActivity(intent); x=Double.parseDouble(et.getText().toString()); val1=(x*.04); Intent in1 = new Intent(Third.this, Fourth.class); in1.putExtra("thevalue1",val1); startActivity(in1); } }); } } Fourth Activity: public class Fourth extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.fourth); TextView tv = (TextView) findViewById(R.id.textView1); tv.setText(getIntent().getExtras().getString("thetext")); TextView wt1=(TextView) findViewById(R.id.textView12); wt1.setText(getIntent().getExtras().getDouble("thevalue1")); } }
has title: How to use intents to send a user input data from one activity to another
has comment: http://stackoverflow.com/comment/39734386
tagged with: android
linked to: http://stackoverflow.com/q/25598696
has answer: http://stackoverflow.com/a/25463052
tagged with: android-intent
accepted answer: http://stackoverflow.com/a/25463053
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25463053
possible better answer: http://stackoverflow.com/a/25463048

http://stackoverflow.com/a/25489341
has body: How try with adding Content-Disposition header and setContentType() response.setHeader("Content-Disposition", "attachment; filename=\""+ fileName + "\""); String mimeType = new MimetypesFileTypeMap().getContentType(fileName); response.setContentType(mimetype);
downvote count: 1
type: Answer
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/25488996

http://stackoverflow.com/comment/39838553
type: QuestionComment
score: 0
has text: you mean `edi.getText().toString()`
comment on: http://stackoverflow.com/q/25518842
type: Comment

http://stackoverflow.com/a/25462298
answers question: http://stackoverflow.com/q/25462210
has comment: http://stackoverflow.com/comment/39733467
type: Answer
has comment: http://stackoverflow.com/comment/39733792
score: 0
has body: You have to use ParseImageView like this in layout file &lt;com.parse.ParseImageView android:id="@+id/profilePictureresult" android:layout_width="132dp" android:layout_height="120dp" android:layout_below="@+id/userlistheadline" android:layout_centerHorizontal="true" android:layout_marginTop="7dp" android:layout_marginBottom="9dp" android:padding="3dp" android:scaleType="centerCrop" android:cropToPadding="true" android:background="@drawable/border_image" android:alpha="1" /&gt;
has comment: http://stackoverflow.com/comment/39733863

http://stackoverflow.com/comment/39698356
has text: you might just create a class `Pair` which has two fields and return a list of it.
comment on: http://stackoverflow.com/q/25443983
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39779565
score: 4
type: QuestionComment
has text: Am I wrong or do I miss something. I think A,C and D won't compile. Or is it just "Pseudo"-Java?
comment on: http://stackoverflow.com/q/25487209
type: Comment

http://stackoverflow.com/comment/39689831
comment on: http://stackoverflow.com/a/25439078
has text: Also consider a one-dimensional array instead. There is some overhead involved in a two-dimensional array (as opposed to manually mapping coordinated into a one-dimensional array). At these sizes, this may matter.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25524074
answer count: 1
has body: When i press a button in my swt program, a new composite should be drawn. But the composite only displays if i resize the window. I have a composite (compLoad) in my gui which is assigned a new composite compHELP comHelp_ = new compHELP(compLoad, SWT.RESIZE); i have tried redraw() but nothing happens
type: Question
has answer: http://stackoverflow.com/a/25524296
accepted answer: http://stackoverflow.com/a/25524296
tagged with: composite
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39847735
tagged with: paint
has title: How can i repaint a composite in Java (SWT)?
tagged with: java
tagged with: swt

http://stackoverflow.com/q/25527592
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39853921
has answer: http://stackoverflow.com/a/25528734
tagged with: windows
tagged with: java
has body: We have: System.getenv() for getting the system variables (red arrow), but I can't figure how to get user variables (blue arrow)?
type: AnsweredQuestion
score: 0
has title: Groovy/Java getting user variables on Windows machine
tagged with: groovy
tagged with: environment-variables
upvote count: 1
accepted answer: http://stackoverflow.com/a/25528734
answer count: 1

http://stackoverflow.com/q/25448341
type: Question
answer count: 0
type: UnansweredQuestion
has body: I am trying to write PreAuthenticatedProcessingFilter which is testing few RequestHeader fields and according to that either continue the processing or returns the error. My filter code is: public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { int status = doAuthenticate((HttpServletRequest) request, (HttpServletResponse) response); if (status != HttpServletResponse.SC_OK) { ((HttpServletResponse) response).setStatus(status); ((HttpServletResponse) response).addHeader("TestHeader", Integer.toString(status)); } else { chain.doFilter(request, response); } } Using this code I can send any statuses started from 200 or 300 but if I set the status to one of the values 400 - 5XX the response is sent with 200 OK. My xml filter definition is: &lt;security:port-mappings&gt; &lt;security:port-mapping http="#{webProperties.httpPort}" https="#{webProperties.httpsPort}"/&gt; &lt;/security:port-mappings&gt; &lt;security:custom-filter position="PRE_AUTH_FILTER" ref="myFilter" /&gt; &lt;/security:http&gt; I haven't done much with Spring before, just few simple servlets. What am I missing here?
has title: Spring 3, PreAuthenticatedProcessingFilter can't return 401
tagged with: servlet-filters
tagged with: spring
tagged with: spring-security
tagged with: spring-mvc
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39706389
has comment: http://stackoverflow.com/comment/39709980

http://stackoverflow.com/comment/39799724
comment on: http://stackoverflow.com/q/25498067
score: 0
type: Comment
type: QuestionComment
has text: Can you add your Jave code snap? Also here clientid and groupid is Intger while you are saying all are String ?

http://stackoverflow.com/q/25423936
has answer: http://stackoverflow.com/a/25448116
favorite count: 0
type: Question
tagged with: mongodb
has title: MongoDB retrieving data from inner classes. Using mongo template
upvote count: 2
accepted answer: http://stackoverflow.com/a/25448116
has body: I just need a help to figure out how to fetch data from inner classes or list of classes using monogo db template and spring. for example if i have a class having data class user: String id; String userName; String firstName; String lastName; ArrayList&lt;Search&gt; search; class Search: String key; ArrayList&lt;XYZ&gt; XYZ; class XYZ; String id; String name; String data; Now my problem is how to fetch data from XYZ class as its an inner class of User and search, what might be the query to fetch these data. Thanks in advance.
tagged with: spring
type: AnsweredQuestion
score: 2
tagged with: java
answer count: 1
downvote count: 0

http://stackoverflow.com/q/25412532
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10968536
has title: Assigning a map key is not saved in database using Hibernate
tagged with: java
tagged with: hibernate
answer count: 1
has body: I am trying to do a simple example using java.util.Map in Hibernate by creating a Customer entity with a Map of Order entities. Here are my Java classes: Customer.java: @Entity public class Customer { @Id @GeneratedValue private Integer id; @OneToMany(mappedBy = "customer") @MapKey(name = "orderNumber") private Map&lt;String, Order&gt; orders = new HashMap&lt;String, Order&gt;();; } Order.java @Entity @Table(name="TB_ORDER") public class Order { @Id @GeneratedValue private Integer id; private String orderNumber; @ManyToOne private Customer customer; } Now I have created a program to save a customer and Orders: public class AppTest { public static void main(String[] args) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); saveCustomer(session); HibernateUtil.getSessionFactory().close(); } private static void saveCustomer(Session session) { session.getTransaction().begin(); Customer customer = new Customer(); Order order = new Order(); order.setCustomer(customer); //order.setOrderNumber("100"); Map&lt;String, Order&gt; map = new HashMap(); map.put("100", order); customer.setOrders(map); session.save(customer); session.save(order); session.getTransaction().commit(); } } As per my mapping, the key of Map represents the orderNumber property of my Order class. So when I created a map with key as "100" and trying save using Hibernate then the field is set as empty in my database for TB_ORDER table. But if I try to use order.setOrderNumber("100") then the value is getting saved to database. Please tell me where I am doing mistake?
type: Question
accepted answer: http://stackoverflow.com/a/25414769
has answer: http://stackoverflow.com/a/25414769
score: 0
linked to: http://stackoverflow.com/q/12552714

mbeans
tags question: http://stackoverflow.com/q/25419354
tags question: http://stackoverflow.com/q/25399520
type: Tag
tag name: mbeans

http://stackoverflow.com/comment/39844833
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25522309
type: QuestionComment
has text: What is the error on that fail?

http://stackoverflow.com/comment/39655572
comment on: http://stackoverflow.com/a/25401334
type: AnswerComment
score: 0
type: Comment
has text: Thank you! That has fixed the problem and everything is working as it should.

http://stackoverflow.com/comment/39661157
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25423743
has text: @bigdestroyer well, that's certainly the case. but if you have to write such codes every day you realize how hard it is :D.
score: 0

http://stackoverflow.com/comment/39600973
type: QuestionComment
has text: I have tried the run as java application in eclipse - says could not find or laod main class (this happened after I ran clean on the project via eclipse)
comment on: http://stackoverflow.com/q/25390711
score: 0
type: Comment

http://stackoverflow.com/comment/39738298
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25465028
score: 0
has text: Your question is not clear or it is absent. Please be very clear about what you want to ask.

http://stackoverflow.com/q/25506256
has body: Im trying to create DBF file in FoxPro spec, but idk how to insert date. I dont know how to convert java Date to this: FoxPro's field is 2 32bit integers: one stores the date, the other stores the time, stored in reverse byte order. The date integer stores the number of days from 1/1/4712BC. The time integer stores the number of milliseconds from 00:00:00. Its easy to get days and milliseconds with JodaTime: DateTime start = new DateTime(-4713, 1, 1, 0, 0, 0, 0); DateTime end = new DateTime(2014, 1, 1, 0, 0, 0, 0); Days days = Days.daysBetween(start, end); long millis = end.getMillisOfDay(); but how to convert this info to needed format? For input a date I just use: SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyyMMdd"); simpledateformat.format(date); and its work fine, but when I try use datetime with "yyyyMMddHHmmss" I see very bad result, like 17.08.33409 12:34:20 (only month is correct).
tagged with: java
tagged with: jodatime
tagged with: foxpro
score: 1
answer count: 1
downvote count: 0
upvote count: 1
has title: Convert java Date to dbf FoxPro datetime format
accepted answer: http://stackoverflow.com/a/25507289
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25507289
type: AnsweredQuestion
tagged with: dbf

http://stackoverflow.com/comment/39849706
type: Comment
has text: Are you 110% sure "192.168.43.198" is the actual and reachable adress of your host device? And Client device is on the same network? Do you have some Kind of Ping-App to check that?
type: QuestionComment
comment on: http://stackoverflow.com/q/25523976
score: 0

http://stackoverflow.com/a/25528118
score: 0
has comment: http://stackoverflow.com/comment/39855290
has comment: http://stackoverflow.com/comment/39854971
answers question: http://stackoverflow.com/q/25527977
type: Answer
has comment: http://stackoverflow.com/comment/39856006
type: AcceptedAnswer
has body: try { Scanner scanner = new Scanner(new File("myFile.txt")); long[] values = new long[100]; int i = 0; while (scanner.hasNextLong()) { values[i] = scanner.nextLong(); i++; } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }
accepted answer of: http://stackoverflow.com/q/25527977

http://stackoverflow.com/a/25518263
has body: Yes. It is very simple. If you have a view called EXAMPLE_VIEW, you just need to do: @Entity @Table(name = "EXAMPLE_VIEW") public class Example implements Serializable { } The columns inside the Example class you map exactly like you map a table. For Hibernate, a view is like a table
has comment: http://stackoverflow.com/comment/39837840
has comment: http://stackoverflow.com/comment/39855961
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39838069
answers question: http://stackoverflow.com/q/25518139
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25518139

http://stackoverflow.com/comment/39934893
type: AnswerComment
comment on: http://stackoverflow.com/a/25459083
score: 0
type: Comment
has text: "SearchRequestBuilder" has this method "addSuggestion" that takes "SuggestionBuilder" object. I was hoping it should work but it didn't work.

http://stackoverflow.com/q/25429981
has answer: http://stackoverflow.com/a/25430336
possible better answer: http://stackoverflow.com/a/25430336
type: Question
upvote count: 2
score: 2
tagged with: pop3
tagged with: jakarta-mail
has title: Javamail get all emails form a specific sender
downvote count: 0
has answer: http://stackoverflow.com/a/73699639
has body: In java I need to get all emails from a specific sender. There are couple of ways to do that as shown here: http://www.codejava.net/java-ee/javamail/using-javamail-for-searching-e-mail-messages But I need to have the process to be done on gmail side. It is not fine for me to read all emails and then decide which one I should proceed. Also in http://alvinalexander.com/java/javamail-multiple-search-terms-pop3-mailbox-yahoo you can search message body which it is great, but what about the sender (FROM part)? How can I filter it? Also reading all emails each time is not good for our bandwidth (Of course we can mark the last read email and read just all new emails somehow like using UIDFolder) Thanks
accepted answer: http://stackoverflow.com/a/25430161
favorite count: 0
type: AnsweredQuestion
answer count: 3
tagged with: java
tagged with: imap
has answer: http://stackoverflow.com/a/25430161

http://stackoverflow.com/q/25540068
has answer: http://stackoverflow.com/a/25540181
type: Question
tagged with: exception
has answer: http://stackoverflow.com/a/25540504
has answer: http://stackoverflow.com/a/25540258
tagged with: arrays
answer count: 4
has answer: http://stackoverflow.com/a/25540169
has title: Java - Error: NoSuchElementException: No Line Found
accepted answer: http://stackoverflow.com/a/25540169
type: AnsweredQuestion
score: 0
has body: I need to read strings from a file and store them in an array. However, my professor isn't allowing the class to use ArrayList. So I decided to run through the file once using hasNextLine() and counting how many lines there are then creating an array and making it equal to the amount of lines. Then I made a while loop that is checking whether i is &lt;= to the array, and giving the array[i] a value of fileInput.nextLine();. However, I seem to constantly get the error NoSuchElementException: No line found. Here is my code: public static void main(String[] args) throws FileNotFoundException { int count = 0; int i = 1; //Read strings from a file and store in array Scanner fileInput = new Scanner(new File("file.dat")); while(fileInput.hasNextLine()) { fileInput.nextLine(); count++; } String [] strArray = new String [count]; while (i &lt;= strArray.length) { /*Error Here*/ strArray[i] = fileInput.nextLine(); System.out.println(strArray[i]); i++; } } } Would anyone know of a solution to my error? P.S file.dat looks like this: FRESH MEAT EVERY SATURDAY AT TWELVE
tagged with: java
has comment: http://stackoverflow.com/comment/39877124
possible better answer: http://stackoverflow.com/a/25540181

http://stackoverflow.com/a/25396963
has comment: http://stackoverflow.com/comment/39611991
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25396091
has comment: http://stackoverflow.com/comment/39612582
accepted answer of: http://stackoverflow.com/q/25396091
type: Answer
has body: circWidth is 0...1 / 5 is a integer division, meaning that the trailing decimals are trimmed off, meaing it's equal to 0, so 0 * anything is 0... You could use something like (int)(CANVAS_WIDTH * (1 / 5f)) instead... You're adding the ActionListener for the colors combobox to the shapes combobox... JComboBox colors = new JComboBox(colorName); //colors combobox colors.setSelectedIndex(1); btnPanel.add(colors); shapes.addActionListener(new ActionListener(){ It would be better to place shapes.setSelectedIndex(1); and colors.setSelectedIndex(1); after the registration of the ActionListeners, this will allow them to trigger the ActionListeners and prime the initial values... The if statements in the paintComponent method could be changed to something more like... switch (colorsCond) { case 1: g.setColor(Color.RED); break; case 2: g.setColor(Color.BLUE); break; case 3: g.setColor(Color.GREEN); break; } switch (shapesCond) { case 1: g.fillRect(x1, y1, rectWidth, rectHeight); break; case 2: g.fillOval(x2, y2, circWidth, circHeight); break; } Which would reduce the code clutter and repeation and make it easier what is suppose to be happening... At the end of your actionPerformed methods, you need to call repaint And just for comparison... import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.Ellipse2D; import javax.swing.DefaultListCellRenderer; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class DrawShapes { public static void main(String[] args) { new DrawShapes(); } public DrawShapes() { EventQueue.invokeLater(new Runnable() { @Override public…
has comment: http://stackoverflow.com/comment/39612613
has comment: http://stackoverflow.com/comment/39612284
score: 3

http://stackoverflow.com/comment/39874969
comment on: http://stackoverflow.com/q/25538716
has text: I should probably say that several tasks could potentially be scheduled at 5pm. I guess I could create a separate thread that holds a queue of runnables and runs each one at 5 pm, but I'm hoping it'll be easier than that.
score: 0
type: Comment
type: QuestionComment

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/25509245
tags question: http://stackoverflow.com/q/25495550
tags question: http://stackoverflow.com/q/25477444
tags question: http://stackoverflow.com/q/25466205
tags question: http://stackoverflow.com/q/25492337
tags question: http://stackoverflow.com/q/25476178
tags question: http://stackoverflow.com/q/25477956
tags question: http://stackoverflow.com/q/25458887
tags question: http://stackoverflow.com/q/25545895
tags question: http://stackoverflow.com/q/25517486
tags question: http://stackoverflow.com/q/25432005

http://stackoverflow.com/comment/39690080
has text: Again this is for learning OOP design not picking the latest technology.
comment on: http://stackoverflow.com/q/25439154
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39787824
type: AnswerComment
has text: I bet your `rezultat` is null, that's why you get exception and your app crashes.
comment on: http://stackoverflow.com/a/25491081
type: Comment
score: 0

http://stackoverflow.com/a/25417254
accepted answer of: http://stackoverflow.com/q/25417221
type: AcceptedAnswer
has body: Since HTTP 400 is invalid sintax, you need to verify your parameter "stringUrl", because the problem is over there. If you could post the code that generates this variable, it would be helpful. And have a look too if you have permissions on your bucket to download de file or use OAuth: https://developers.google.com/console/help/new/#generatingoauth2 Edit: Ok, It seems you are not using OAuth to authenticate for download, so you need to let the file with open permission, have a look at the example: But i recommend using OAuth 2.0
answers question: http://stackoverflow.com/q/25417221
type: Answer
score: 0

http://stackoverflow.com/comment/39688118
type: QuestionComment
comment on: http://stackoverflow.com/q/25438073
type: Comment
has text: You haven't exactly asked a question. Are your wanting to know if there's a way to determine the JRE version during execution and then use certain features based on that?
score: 2

state
tag name: state
type: Tag
tags question: http://stackoverflow.com/q/25481394

http://stackoverflow.com/comment/39823807
type: Comment
type: QuestionComment
score: 0
has text: You say it takes "long". Just how long is that? (Are we talking milliseconds or hours here ...?)
comment on: http://stackoverflow.com/q/25510808

http://stackoverflow.com/comment/39885761
comment on: http://stackoverflow.com/a/25541857
has text: @TheLostMind: this is a simplifying illustration. Actually, verification does *not* happen within the `ClassLoader` and therefore is completely independent from the particular `ClassLoader` implementation. There are even other ways to add a class to a JVM, e.g. Instrumentation, but the byte code will be verified in these cases as well. Also, the arrow from “Class Loader” to “Just in Time Compiler” makes no sense as a `ClassLoader` does not interact with the JIT Compiler in any way. Rather, you can consider verifier and the JIT being an integral part of the JVM for more than fifteen years now.
type: AnswerComment
score: 6
type: Comment

http://stackoverflow.com/q/25411319
downvote count: 0
has answer: http://stackoverflow.com/a/25411500
accepted answer: http://stackoverflow.com/a/25411500
answer count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39638875
tagged with: algorithm
has title: Breaking up paragraphs into String tokens
has comment: http://stackoverflow.com/comment/39638973
tagged with: java
has body: I am able to break up paragraphs of text into substrings based upon nth given character limit. The conflict I have is that my algorithm is doing exactly this, and is breaking up words. This is where I am stuck. If the character limit occurs in the middle of a word, how can I back track to a space so that all my substrings have entire words? This is the algorithm I am using int arrayLength = 0; arrayLength = (int) Math.ceil(((mText.length() / (double) charLimit))); String[] result = new String[arrayLength]; int j = 0; int lastIndex = result.length - 1; for (int i = 0; i &lt; lastIndex; i++) { result[i] = mText.substring(j, j + charLimit); j += charLimit; } result[lastIndex] = mText.substring(j); I am setting the charLimit variable with any nth, integer value. And mText is string with a paragraph of text. Any suggestions on how I can improve this? Thank you in advance. I am receiving good responses, just so you know what I did to figure out of I landed on a space or not, I used this while loop. I just do not know how to correct from this point. while (!strTemp.substring(strTemp.length() - 1).equalsIgnoreCase(" ")) { // somehow refine string before added to array }
has comment: http://stackoverflow.com/comment/39638746
tagged with: substring
score: 2
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39639201

http://stackoverflow.com/comment/39928865
has text: @clD I changed the entire question. I think it is more clear now.
comment on: http://stackoverflow.com/q/25529188
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26740511
downvote count: 0
upvote count: 1
has body: Your need has probably been taken care of by now but one option, for others who might stumble on this thread, is a tool called 'jvmtop' (link: https://code.google.com/p/jvmtop/). It works with the IBM J9 JVM (among others).
answers question: http://stackoverflow.com/q/25522797
type: Answer
score: 1

http://stackoverflow.com/q/25444266
linked to: http://stackoverflow.com/q/17973970
score: 1
tagged with: java
answer count: 1
has body: This time I have problem on putting DatePicker on my wicket Page. My code is follows: public class StateDB extends BasePage { private Date date = new Date(); public StateDB() { Form form = new Form("form"); DateTextField birthDate = new DateTextField("birthDate", new PropertyModel&lt;Date&gt;( this, "date"), new StyleDateConverter("S-", true)); PickDate datePicker = new PickDate(); datePicker.setShowOnFieldClick(true); datePicker.setAutoHide(true); birthDate.add(datePicker); form.add(birthDate); add(form); } } When I run it on server and link to this page I'm getting Exception: Last cause: org.apache.wicket.markup.head.HeaderItem WicketMessage: Can't instantiate page using constructor 'public kz.company.myPackage.controller.StateDB()'. Might be it doesn't exist, may be it is not visible (public). But as you can see constructor of my class is public public StateDB() { There is stacktrace Complete stack: org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public kz.company.myPackage.controller.StateDB()'. Might be it doesn't exist, may be it is not visible (public). at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:196) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:68) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47) at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:103) at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165) at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageReque…
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39706975
has comment: http://stackoverflow.com/comment/39700518
tagged with: constructor
type: UnansweredQuestion
downvote count: 0
tagged with: datepicker
tagged with: wicket
upvote count: 1
has title: WICKET: Can't instantiate page using constructor when using DatePicker
has answer: http://stackoverflow.com/a/25444510
has comment: http://stackoverflow.com/comment/39705753

http://stackoverflow.com/q/25441626
score: 1
tagged with: java
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25524515
upvote count: 1
tagged with: maven
has title: JMeter fails with ClassNotFoundException when run in Maven
favorite count: 0
has body: I have created a JMeter test file which runs some tests I've written in java When I run the file in JMeter itself they run fine and the test pass. Now I've configured maven to run the JMX file and when I run the verify goal it executes the JMX file. However now it fails with the following error message: JMeter.jmx.log: "jmeter.protocol.java.sampler.JUnitSampler: ClassNotFoundException:: com.mynamespace.tests.product.ProductTest" Jmeter.jtl: "Failed to create an instance of the com.mynamespace.tests.product.ProductTest, reasons may be missing both empty constructor and one String constructor or failure to instantiate constructor, check warning messages in jmeter log file" In order for JMeter to know the class I built a jar and copied it to Jmeter's lib directory. Do I need to do something similar when running the jmeter maven plugin? - surely it should be able to see the Class as the project is built when running the verify goal.. Added to pom.xml: com.lazerycode.jmeter jmeter-maven-plugin 1.9.1 jmeter-tests verify jmeter Jmeter.jmx: <?xml version="1.0" encoding="UTF-8"?> false false <collectionProp name="Arguments.arguments"/> continue false 1 1 1 1408690229000 1408690229000 false com.mynamespace.tests.product.ProductTest saveProduct Test successful 1000 Test failed 0001 An unexpected error occured 9999 false true true true com.mynamespace.tests.product.ProductTest getProduct Test successful 1000 Test failed 0001 An unexpected error occured 9999 false true true true
tagged with: jmeter-maven-plugin
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/25524515
tagged with: classnotfoundexception

http://stackoverflow.com/a/25444592
answers question: http://stackoverflow.com/q/25444239
has comment: http://stackoverflow.com/comment/39699401
upvote count: 0
has body: I am trying to read a text file which consists of a single number one the first line. I wonder if your file ends with a line separator? From the Javadoc: Since this method continues to search through the input looking for a line separator, it may buffer all of the input searching for the line to skip if no line separators are present. So if the file really only has the number, the Scanner might be confused by the absence of a newline character (or similar). Edit: I might have used the wrong Javadoc excerpt to support this thesis. The Javadoc also says: The position is set to the beginning of the next line. What if there is no next line? Maybe that's exactly what the Scanner is trying to tell you.
downvote count: 1
type: Answer
score: -1

http://stackoverflow.com/comment/98035369
score: 0
type: Comment
has text: what if i want the result in English no matter what i speak ? can you tell me please?
type: AnswerComment
comment on: http://stackoverflow.com/a/48181842

network-programming
tag name: network-programming
tags question: http://stackoverflow.com/q/25516557
tags question: http://stackoverflow.com/q/25528634
tags question: http://stackoverflow.com/q/25433122
tags question: http://stackoverflow.com/q/25476756
tags question: http://stackoverflow.com/q/25504094
tags question: http://stackoverflow.com/q/25532866
tags question: http://stackoverflow.com/q/25418946
tags question: http://stackoverflow.com/q/25432253
tags question: http://stackoverflow.com/q/25477428
tags question: http://stackoverflow.com/q/25455253
type: Tag
tags question: http://stackoverflow.com/q/25403343
tags question: http://stackoverflow.com/q/25522774
tags question: http://stackoverflow.com/q/25503000
tags question: http://stackoverflow.com/q/25469552

http://stackoverflow.com/q/25504596
has title: Issue with Sorting ArrayList using Collection
tagged with: java
accepted answer: http://stackoverflow.com/a/25504676
has answer: http://stackoverflow.com/a/25504761
tagged with: comparator
answer count: 4
has comment: http://stackoverflow.com/comment/39811452
possible better answer: http://stackoverflow.com/a/25504653
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25504653
has body: I am trying to sort VariantOptionData ArrayList using its one of parameter. here is my VariantOptionData public class VariantOptionData implements java.io.Serializable { private Collection&lt;VariantOptionQualifierData&gt; variantOptionQualifiers; private StockData stock; private NGCPSizeEnum cs2; } And I want to sort this list using cs2 parameter. I am doing like this .. List&lt;VariantOptionData&gt; allSizes = Converters.convertAll(style.getVariants(), getVariantOptionDataConverter()); Collections.sort(allSizes, new Comparator&lt;VariantOptionData&gt;() { @Override public int compare(final VariantOptionData s1, final VariantOptionData s2) { return Integer.parseInt(s1.getCs2().getCode()) &lt; Integer.parseInt(s1.getCs2().getCode()) ? s1.getCs2().getCode() : s2.getCs2().getCode(); } }); I know its wrong, but I am trying something like this but not able to understand how exactly Comparators are working. cs2 is a enum fields which having code as a increment value. I want to sort this list using Integer.parseInt(s1.getCs2().getCode()) increasing order. Please help
tagged with: sorting
tagged with: collections
tagged with: arraylist
has answer: http://stackoverflow.com/a/25504676
linked to: http://stackoverflow.com/q/5245093
has answer: http://stackoverflow.com/a/25504681
type: Question

http://stackoverflow.com/a/25437968
has comment: http://stackoverflow.com/comment/39689169
type: Answer
has body: remove() is supposed to remove the first element from the list, right? Why do you loop anything for that? Since your list is singly-linked (only pointing to next elements in the Node) all you need to do is: Store the first in a temporary variable (if it's != null) Then update first to be pointing to the 2nd item in the list (first.next if != null) Then return the temporary variable.
accepted answer of: http://stackoverflow.com/q/25437682
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25437682
type: AcceptedAnswer

http://stackoverflow.com/q/25546141
tagged with: arraylist
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39888298
has title: How to iterate, search and display a specific element in an ArrayList
possible better answer: http://stackoverflow.com/a/25546218
tagged with: java
accepted answer: http://stackoverflow.com/a/25546231
has body: I'm having a problem with a specific part of a program. What I want to do is iterate, search and display an element from an ArrayList. So I tried implementing my own snippet to the main function of the code to try: else if (menuChoice==3) { System.out.println("Search Student:"); String search = input.nextLine(); for (Student student : students) { if (students.equals(search)){ System.out.println(student); } } } Hoping that it would iterate through the ArrayList and access/display that specific element in the list. It returns blank, what am I doing wrong? Here's the whole code if you're wondering: package student; import java.util.*; public class Student { private String r_name; private int r_age; private String r_course; private String r_year; private String r_section; private String r_studno; public Student( String name, int age, String course, String year, String section, String studno ) { r_name = name; r_age = age; r_course = course; r_year = year; r_section = section; r_studno = studno; } public String getName() { return r_name; } public int getAge() { return r_age; } public String getCourse() { return r_course; } public String getYear() { return r_year; } public String getSection() { return r_section; } public String getStudno() { return r_studno; } public String toString() { return "Name: " + r_name + ", Age: " + r_age + ", Course: " + r_course + ", Year: " + r_year + ", Section: " + r_section + ", Student Number: " + r_studno; } public static void main(String[] args) { ArrayList&lt;Student&gt; students = new ArrayList&lt;Student&gt;(); Scanner input = new Scanner(System.in); int menuChoice = 4; do { System.out.println("\t\t\tStudent Record Menu"); System.out.println("\t\t1. Add Student\t2. View Students\t3. Search Student\t4. Exit"); try { System.out.println("Enter a choice: "); menuChoice = Integer.parseInt(input.nextLine()); } catch (NumberFormatException e) { continue; } if (menuChoice==1) { System.out.println("Add a Student"); System.out.println("Full nam…
tagged with: search
has answer: http://stackoverflow.com/a/25546231
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39888140
has comment: http://stackoverflow.com/comment/39887574
has answer: http://stackoverflow.com/a/25546218
type: Question

http://stackoverflow.com/comment/39612028
type: Comment
type: AnswerComment
has text: Guess the timer should be stop after leaving mouse.
comment on: http://stackoverflow.com/a/25393236
score: 1

http://stackoverflow.com/q/25422876
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25641526
score: 0
tagged with: linux
has body: We have an application that uses the .properties for storing the language translations. We tried accessing them using PropertyResourceBundle and PropertiesConfiguration (independently). On the local machine (windows) it works correctly but when we commit the code to the repository and run the build using jenkins on a Linux machine it works differently. Here is what happens: Java Version: JDK_1_7_u21. Windows 8.1: PropertyResourceBundle: Using the getString() to get the string. Returns it correctly the whole string. PropertiesConfiguration: Using getStringArray() returns the strings split by commas. Linux Ubuntu, kernel 3.5.0-31-generic: PropertyResourceBundle: Using the getString() to get the string. If a comma is present in the string, returns only the text after the LAST comma. Otherwise works correctly. E.g.: String: 123,456 Returns: "456" PropertiesConfiguration: Using getStringArray() returns the string correctly if no comma is present. If it is, it copies the text again in the next cell array. E.g.: String: 123, 456 Returns: ["123,456","123,456"] Anyone knows what might be the cause of this and how can this be fixed so that the implementation works the same in both environments?
tagged with: windows
tagged with: java
type: Question
tagged with: resourcebundle
accepted answer: http://stackoverflow.com/a/25641526
answer count: 1
has title: PropertiesConfiguration and PropertyResourceBundle behaves differently on windows and linux

http://stackoverflow.com/comment/39750552
type: Comment
type: AnswerComment
has text: you said that my data is not added in my current model, could you be more specific on how i can make that happen ?
comment on: http://stackoverflow.com/a/25465472
score: 0

http://stackoverflow.com/comment/39654419
has text: @Suresh there is nothing wrong. Im looking if this can be achieved in a more efficient way..?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25420136
score: 0

http://stackoverflow.com/comment/39819938
comment on: http://stackoverflow.com/a/25503220
has text: Great and Very Detail answer. It point me the issue out directly. Thanks very much.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25463866
type: Answer
answers question: http://stackoverflow.com/q/25462932
has body: you can calculate all your data in your code as it is now but don't update any UI elements (like a TextView) then create a new Thread and make it update one TextView, then delay it for 1000ms (1 sec). { //Your calculations take place here //... //Make your class extend Runnable, or create a new Runnable class - I hope you are familiar with threads Thread thread = new Thread(this); thread.start(); } run() { //Update UI - when updating UI from outside main thread use the view.post(Runnable) method instead of directly changing it's text textView.post(new Runnable() { public void run() { textView.setText(yourText); } } //Make thread sleep for 1000ms (or 1sec) try { Thread.sleep(1000); } catch(InterruptedException ex) {} //Here you can update more UI elements and after each one make Thread delay again for 1 second //... } I haven't worked with handlers yet so I can't say if it's better or not, but I know it works
score: 0

http://stackoverflow.com/q/25550628
has body: Sorry, I've been searching this forum and got no exact answer. so I ask my own. I have a class that display two layouts , glView and webview , with target portrait screen 640x960 . i plan to split the layout. so it would look that my background drawn at (0,0,640,480) or half of the portrait screen. , and i want my webview drawn at (0,481,640,479) which is occupy the other half from the middle to the bottom. however, i failed and couldn't figure out how to achieve the layout i want. How to set the webView size &amp; Position ? PS: if i set the layout to align bottom then the webview is indeed in the middle to bottom position however i need to specify the exact position.. and the worst.. when it loads the url , it will use the whole screen, covering all my first layout and i am lost. so how to make the webview display the loaded url into the webview specified width and height. Thank you.. sorry for my bad english. anyway, this is my code (i created all programatically, i didn't use any xml layout) glView = new GLSurfaceView(this); glView.setRenderer(this); glView.setZOrderMediaOverlay(false); layout = new RelativeLayout(this); layout.addView(glView); webView = new WebView(this); this.showWV(false); //handler message , i hide it in certain screen. //webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); webView.loadUrl("http://stackoverflow.com"); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); layout.addView(webView, params); setContentView(layout);
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25551424
score: 1
tagged with: java
downvote count: 0
has title: How to Display Webview in fixed width and height
type: Question
favorite count: 0
has comment: http://stackoverflow.com/comment/39897085
tagged with: layout
tagged with: android
accepted answer: http://stackoverflow.com/a/25551392
has comment: http://stackoverflow.com/comment/39897387
tagged with: webview
upvote count: 1
has answer: http://stackoverflow.com/a/25551392
possible better answer: http://stackoverflow.com/a/25551424

http://stackoverflow.com/q/25442120
tagged with: java
tagged with: jdbc
tagged with: mysql
has comment: http://stackoverflow.com/comment/39695012
type: AnsweredQuestion
score: 0
has body: I used mysql server 5.6.19 and mysql-connector-Java-5.0.8. I have following error. ERROR {xxxxxxx} - Error while retrieving roles from Internal JDBC role store com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=100' at line 1 Is this mysql server compatibility error ?? Is anyone can find what is the reason for this?
has title: Server startup error - Error in SQL syntax
tagged with: mysql-connector
answer count: 1
accepted answer: http://stackoverflow.com/a/25443303
has comment: http://stackoverflow.com/comment/39697224
has answer: http://stackoverflow.com/a/25443303
type: Question
has comment: http://stackoverflow.com/comment/39695053

http://stackoverflow.com/q/25533182
has title: get the following to return all urls in a text file that have a specific format
type: AnsweredQuestion
tagged with: java
answer count: 1
score: 1
upvote count: 1
favorite count: 0
type: Question
has body: This is more on the code I posted earlier. I have got the following to return a single URL contained within all the XML data I pulled from YouTube gdata. I am now having trouble getting it to return all the URLs that fall within the specified layout. This is the code that returns a single URL while ((inputLine = sc.findWithinHorizon("www.youtube.com/watch?v=9HJ2fl4zbx0&amp;amp;feature=youtube_gdata", 0)) != null) { System.out.println(inputLine); } Now, I need it to return all URLs that start with "www.youtube.com/watch?v=" and end with "&amp;feature=youtube_gdata" Alternatively, it would work perfectly if I could have it return just the next 11 characters after "www.youtube.com/watch?v="
has comment: http://stackoverflow.com/comment/39864256
tagged with: gdata
accepted answer: http://stackoverflow.com/a/25533279
downvote count: 0
has answer: http://stackoverflow.com/a/25533279

http://stackoverflow.com/a/25479502
has body: The second example actually uses more memory than the first example because now each instance of Example must be big enough to store a reference to an Object. I believe you meant to write public class Example { public Object obj = new Object(); public Object foo() { return obj; } } Now this example has the same memory requirement, but this does have the added benefit of not reallocating an Object every time foo is called. Which will save memory if you call foo() repeatedly.
has comment: http://stackoverflow.com/comment/39765502
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25479468
score: 1
type: Answer

http://stackoverflow.com/comment/39837360
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25518008
type: AnswerComment
has text: @ inner_class7....thanks again..and it would be great if you post it in pastebin..or here too..

http://stackoverflow.com/comment/39862759
type: AnswerComment
comment on: http://stackoverflow.com/a/25532327
type: Comment
has text: Thanks, we've resolved the issue without finding an actual cause, but I'll look at implementing this solution if the problem repeats.
score: 0

http://stackoverflow.com/a/25539765
has body: One mistake I notice is in the "Make Passages" sections. Each one is wrapped in an if(yPos.size() &gt; 0) conditional, but doesn't consider the case of when xPos.size() is greater than zero. Basically, if there's no change in Y, but there is a change in X, then it will just skip creating that section of passage. Example: p2 p3 p1 results in 1 1 1 1 0 0 0 0 4 0 0 0 Next bug: If one of the variables is only off by one, then the size of the list of points it generates will be 0, so it will not connect the two. For example enterX equals to 10 and point1X equal to 9 will not connect them. p3 p2 p1 results in 1 0 1 0 0 0 0 4 To fix this, I'd suggest changing all of the loops of the form for (int x = enterX - 1; x &gt; point1X; x--) to for (int x = enterX - 1; x &gt;= point1X; x--) In other words, including the final point in the list.
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39876675
accepted answer of: http://stackoverflow.com/q/25539525
type: Answer
answers question: http://stackoverflow.com/q/25539525
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25517451
has answer: http://stackoverflow.com/a/25517948
type: Question
answer count: 2
tagged with: scala
accepted answer: http://stackoverflow.com/a/25517948
has body: I am trying to store a function in my actions HashMap. I want this function to be readf("coffee", 1, doTest) Currently I get an error trying to execute the last line, "Any does not take parameters". How do I store a function into a HashMap, then call it at a later time? var xx = 0 val values = new HashMap[String, Int] values += "coffee" -&gt; 2 println(values("coffee")) val actions = new HashMap[String, Any] def readf(valueName: String, sufficient: Int, f: () =&gt; Unit): Unit = if (values(valueName) &gt; sufficient) f() else () def doTest(): Unit = { xx == xx + 1 println(xx) } actions += "check_cup" -&gt; readf("coffee", 1, doTest) actions("check_cup")()
type: AnsweredQuestion
score: 0
has title: "Any does not take parameters" - storing Unit functions in a Scala HashMap
has answer: http://stackoverflow.com/a/25517933
possible better answer: http://stackoverflow.com/a/25517933
tagged with: java

acl
tag name: acl
tags question: http://stackoverflow.com/q/25393406
type: Tag

http://stackoverflow.com/a/25535024
downvote count: 0
answers question: http://stackoverflow.com/q/25533924
type: Answer
accepted answer of: http://stackoverflow.com/q/25533924
upvote count: 3
has body: ResultSets are, by default, produced on demand. You can only iterate through them once, and then the results are consumed. After you do ResultSet result = qe.execSelect(); String text = ResultSetFormatter.asText(result); you probably can't get any results from doing ResultSetFormatter.outputAsJSON(b, result); or ResultSetFormatter.toList(result); Instead, you should copy the ResultSet with, e.g., ResultSet results = ResultSetFactory.copyResults( qe.execSelect() );
score: 3
has comment: http://stackoverflow.com/comment/39867602
type: AcceptedAnswer

http://stackoverflow.com/q/25468325
has comment: http://stackoverflow.com/comment/39744403
type: UnansweredQuestion
has title: Compiler error: '.class' expected
has comment: http://stackoverflow.com/comment/39744313
score: 0
has answer: http://stackoverflow.com/a/25468339
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25468352
type: Question
has body: String sAge = scan.nextLine(); Scanner scan = new Scanner( System.in ); System.out.print( "what year were you born? &gt;"); int iAge = scan.nextInt (sAge); final double Cyear = 2014; final double LEmax = 77.9; System.out.println( "\nThe percentage of your life you have lived is " + int LEmax ); When I compile this, I get these errors: C:\Users\PracticeMethods.java:54: error: '.class' expected System.out.println( "\nThe percentage of your life you have lived is " + int LEmax ); ^ C:\Users\PracticeMethods.java:54: error: ';' expected System.out.println( "\nThe percentage of your life you have lived is " + int LEmax ); What am I doing wrong? Can you help me resolve these errors?

http://stackoverflow.com/q/25526709
tagged with: java
tagged with: directory
accepted answer: http://stackoverflow.com/a/25531365
tagged with: gradle
tagged with: external
has answer: http://stackoverflow.com/a/25531365
type: Question
has title: Add directory to the jar which will be for insert external jars or classes
upvote count: 3
answer count: 1
tagged with: jar
downvote count: 0
has body: I have a jar file which is my application (which is builded by gradle) and I want to add directory which is "ext" folder for extensible files (jars or classes). How to do that?
favorite count: 0
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/39661696
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25423502
has text: @ankur-singhal thanks, how can I check if the package scan is fine?

http://stackoverflow.com/a/25520447
has body: I was able to connect to remote server and get the response from the remote queue. Both my client and server running in two separate computers, JBossAS [6.1.0.Final "Neo"]. My client is a simple web app ( a war file) Client side queue sender class. private static void prepareContext() { logger.debug("Loading Context"); try { Properties prop = new Properties(); prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); prop.put(Context.PROVIDER_URL, "jnp://10.1.4.48:1099"); ictx = new InitialContext(prop); conFactory = (ConnectionFactory)ictx.lookup("/ConnectionFactory"); qcon = (QueueConnection)conFactory.createConnection(); qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); } catch (NamingException er) { logger.fatal("Error ", er); } catch (JMSException er) { logger.fatal("Error ", er); } } public static boolean sendToQueue(String xml, String sendQ) { logger.warn("Sending to queue: " + xml); try { prepareContext(); Queue queue = getQueue(sendQ); if (null == queue) { throw new JMSException("Queue not defined at the end point"); } qcon.start(); QueueSender qsender = qsession.createSender(queue); TextMessage tmsg = qsession.createTextMessage(); tmsg.setText(xml); qsender.send(tmsg); return true; } catch (JMSException er) { logger.fatal("Error ", er); } finally { try { qsession.close(); } catch (Exception er) {/**/} try { qcon.close(); } catch (Exception er) {/**/} } return false; } Above is client side sender code. Now let's see how client side message receiver. I used MDB to listen remote server queue. public class MessageReceiverBean implements MessageListener { public void onMessage(Message message) { try { if (message instanceof TextMessage) { TextMessage textMsg = (TextMessage) message; logger.info("Inside onMessage of client app MessageReceiverBean : " + textMsg.getText()); } } catch (Exception er) { logger.error("Error while retrieving message…
accepted answer of: http://stackoverflow.com/q/25397138
type: Answer
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25397138

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/25525213
tags question: http://stackoverflow.com/q/25431712
tags question: http://stackoverflow.com/q/25541699
type: Tag
tags question: http://stackoverflow.com/q/25491781
tags question: http://stackoverflow.com/q/25398325

http://stackoverflow.com/q/25407522
has title: iOS MDM - How to close or stop connection after device responds back with valid response
has answer: http://stackoverflow.com/a/25419732
has body: We are building an iOS MDM server to manage iOS devices. Below were the steps which were involved in enrolling an iOS device into the MDM server Send enroll configuration Perform SCEP send MDM server certificate. Create APNS certificate. Send push notification to the device. The device receives the push notification and contacts the MDM server's "serverUrl". It responds with Status = "Idle" shown below <?xml version="1.0" encoding="UTF-8"?> Status Idle UDID <udid-of-device> In response to this command to get device information is sent as below. <?xml version="1.0" encoding="UTF-8"?> Command RequestType DeviceInformation Queries UDID DeviceName OSVersion ModelName IMEI CommandUUID command-for-the-session Device responds back with the device information as shown below <?xml version="1.0" encoding="UTF-8"?> CommandUUID command-for-the-session QueryResponses DeviceName iPhone IMEI 01 353150 432467 8 ModelName iPhone OSVersion 7.1 UDID <udid-device> Status Acknowledged UDID <udid-device> This flow works as required. After this i want to end connection with the device as there is nothing more to be sent to the device. My query is how to stop or close this connection after we receive the valid details from the device for that CommandUUID. It keeps on calling the mdm server url and does not end the connection. I have tried send an empty plist to stop the connection but no luck. Kindly help. Thanks for reading.!
score: 2
tagged with: java
tagged with: mdm
tagged with: javapns
favorite count: 0
tagged with: iphone
type: Question
upvote count: 2
answer count: 2
tagged with: ios
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25410076

http://stackoverflow.com/comment/39695666
has text: Maybe the confusion arose because I didn’t explicitly state that you should use it like within your question: the constructed `ac` is the only `CompletableFuture` you should care about, it’s the one you use for retrieving completion state and result and the one you cancel when appropriate; the helper `flag` is only relevant during construction. So when you want to `cancel` you should invoke cancel on `ac` which will then immediately reflect that is has been cancelled, of course. (Unless it already completed before the `cancel` call.
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25424801

http://stackoverflow.com/q/25464729
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39738254
has comment: http://stackoverflow.com/comment/39737761
has title: Extract String from a within a String using a Regular Expression
type: Question
accepted answer: http://stackoverflow.com/a/25464853
tagged with: java
has answer: http://stackoverflow.com/a/25464853
possible better answer: http://stackoverflow.com/a/25465132
tagged with: regex
has body: I have a very large String containing within it some markers like: {codecitation class="brush: java; gutter: true;" width="700px"} I'd need to collect all the markers contained in the long String. The difficulty I find in this task is that the markers all contain different parameter values. The only thing they have in common is the initial part that is: {codecitation class="brush: [VARIABLE PART] } Do you have any suggestion to collect all the markers in Java using a Regular Expression ?
has answer: http://stackoverflow.com/a/25465132
has comment: http://stackoverflow.com/comment/39739094

http://stackoverflow.com/comment/83841190
has text: @RoHo I found a solution to this problem. I assume that you are using Gradle but if not, those who will get this frustrating problem will be using it as of 2018. The solution I found packages all assets into the jar as you have asked.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25476311
type: AnswerComment

http://stackoverflow.com/q/25466205
has answer: http://stackoverflow.com/a/25466255
type: AnsweredQuestion
score: 0
tagged with: android
has body: I have developed an app that is suppose to show the image to user using viewpager. But my problem is that my images are not showing in full screen . can any one please suggest the codes for how to make this work ?. Following are my codes.. Mainactivity.java import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.view.Menu; import android.view.MenuItem; import android.widget.ShareActionProvider; public class MainActivity extends Activity { MediaPlayer oursong; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); oursong = MediaPlayer.create(MainActivity.this, R.raw.a); oursong.start (); ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); ImageAdapter adapter = new ImageAdapter(this); viewPager.setAdapter(adapter); } private ShareActionProvider mShareActionProvider; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate menu resource file. getMenuInflater().inflate(R.menu.activity_main, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_item_share); // Fetch and store ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider(); // Return true to display menu return true; } // Call to update the share intent private void setShareIntent(Intent shareIntent) { if (mShareActionProvider != null) { mShareActionProvider.setShareIntent(shareIntent); } } @Override protected void onPause(){ super.onPause(); oursong.release(); } } imageadapter.java import android.content.Context; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; public class ImageAdapter extends PagerAdapter { Context context; private int[] GalImages = new int[] { R.drawable.one, R.drawable.tw…
tagged with: java
tagged with: gallery
has title: How to display image located in drawable folder in full screen in viewpager app?
type: Question
tagged with: android-viewpager
answer count: 1
accepted answer: http://stackoverflow.com/a/25466255

http://stackoverflow.com/comment/39772859
score: 0
has text: Just making sure that I got it right: You want to let use input a word and a letter and count how many times is the letter in that word right? Btw you are not getting any exceptions in debug or something?
type: QuestionComment
comment on: http://stackoverflow.com/q/25483883
type: Comment

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/25517998
tags question: http://stackoverflow.com/q/25484261

http://stackoverflow.com/a/25398313
downvote count: 0
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25398174
has body: In the web.xml file,under the servlet mapping try changing the Url-Pattern from / to /*.

http://stackoverflow.com/a/25503947
accepted answer of: http://stackoverflow.com/q/25408206
type: Answer
answers question: http://stackoverflow.com/q/25408206
score: 0
has body: This was much simpler than I thought. I simply had to add: query.distinct(true); I spent a few hours fruitlessly trying to make the join work as I wanted.
type: AcceptedAnswer

http://stackoverflow.com/q/25479679
has answer: http://stackoverflow.com/a/25479723
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
has title: How to link the button to fragment class
score: 0
has comment: http://stackoverflow.com/comment/39765848
tagged with: android-fragments
tagged with: java
answer count: 1
has body: Hello everyone i just want to know whether i can link the button to the Fragment class using intent . I linked the same way how we do for Activity class using intent as shown below but now my app is crashing when i press the button. VideoFragment is a class which extends the class to fragment (not to an Activity) getActivity().runOnUiThread(new Runnable() { @Override public void run() { startActivity(new Intent(getActivity(),VideoFragment.class)); }}); Can anyone please help me how to link a particular fragment to the button. Thanks
has comment: http://stackoverflow.com/comment/39765639
type: Question

http://stackoverflow.com/comment/39791153
type: QuestionComment
comment on: http://stackoverflow.com/q/25490375
has text: I agree with @Brice. [Use an ArgumentCaptor as explained in this post](http://stackoverflow.com/questions/12295891/how-to-use-argumentcaptor-for-stubbing). No point posting a duplicate answer here.
type: Comment
score: 0

http://stackoverflow.com/comment/39889170
type: Comment
has text: Yes before null check
comment on: http://stackoverflow.com/a/25546840
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39750479
type: QuestionComment
comment on: http://stackoverflow.com/q/25471451
type: Comment
has text: Do you realise that if you download two files at once, they'll probably both download half as fast?
score: 0

http://stackoverflow.com/a/25440362
score: 2
has comment: http://stackoverflow.com/comment/39709586
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39717261
has comment: http://stackoverflow.com/comment/39714564
has comment: http://stackoverflow.com/comment/39727064
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25440178
type: Answer
has body: As with almost all aspects of Multithreading, even your case isn't guaranteed to behave as expected. Thread.yield() is just like a suggestion to the OS telling - if it is possible, then please execute other threads before this one. Depending on the architecture of your system (number of cores, and other aspects like affinity etc etc) the OS might just ignore your request. Also, after JDK6U23, the JVM might just change your code to : public void run() { for(int i=0;i&lt;=5;i++) { // 3 is too darn small. and yield() is not necessary // so let me just iterate 6 times now to improve performance. System.out.println(i+Thread.currentThread().toString()); } yield() can totally be ignored (which might be happening in your case. If you are getting the same result over and over again)
answers question: http://stackoverflow.com/q/25440178

http://stackoverflow.com/a/25423259
has body: If you want to get from the map the inner field you need to use a very uncomfortable syntax like this: ((Map&lt;String, Object&gt;)jsonMap.get("domain")).get("id") // returns "file" I think that you can read your json in a convenient class that you can create manually. The class will have all the fields contained in the json and you will have access to them using get methods. class DomainClass { public InnerDomain domain; } class MenuItem { public String value; public String onclick; } class PopupClass { public List&lt;MenuItem&gt; menuitem1; } class InnerDomain { public String id; public String value; public PopupClass popup; } The class DomainClass is the main class that you need to use to deserialize your json. Using jackson is pretty easy and it looks like the method that you've used in your case: ObjectMapper mapper = new ObjectMapper(); DomainClass domainObj = mapper.readValue(jsonString, DomainClass.class); // print the id field System.out.println(domainObj.domain.id);
has comment: http://stackoverflow.com/comment/39660320
has comment: http://stackoverflow.com/comment/39660104
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25422835
has comment: http://stackoverflow.com/comment/39660208
answers question: http://stackoverflow.com/q/25422835
type: Answer
has comment: http://stackoverflow.com/comment/39660268

http://stackoverflow.com/a/25429096
score: 0
answers question: http://stackoverflow.com/q/25428967
has body: I do not know why you use "store.add(line)". You should use myArrayList instead of this. After you have stored everything in the ArrayList you can use a for-each loop to traverse through the list: for (String string : myArrayList) { // do everything with the strings here }
type: Answer
has comment: http://stackoverflow.com/comment/39671948

http://stackoverflow.com/comment/39872020
has text: Yes, Properties is one, Serializing is another one... which type of data is the question and in which volume. On the other hand, based on your question I understand that you are just looking for tables, is this correct? Good luck.
type: Comment
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/25537233

http://stackoverflow.com/comment/39888559
type: QuestionComment
has text: Hibernate won't behave like that, can you directly hit the same query on DB and compare the results
comment on: http://stackoverflow.com/q/25546678
score: 0
type: Comment

http://stackoverflow.com/q/25517536
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39836517
has comment: http://stackoverflow.com/comment/39837112
type: Question
type: UnansweredQuestion
has body: I'm attempting to set an array in the ImageAdapter (pics) equal to JSON contents in the arrayList called mComments. I cannot seem to accomplish this by using a toArray() method on the mComments and also typecasting didn't work. I'm trying to use the JSON content to set the images in the GridView instead of the hard-coded resources. See my ImageAdapter class below and also the relevant calling class. Full classes available upon request and here is the JSON URL if that helps: https://shipstudent.com/complaint_desk/androidImageFetch.php. Please let me know if you need more information. ImageAdapter: public class ImageAdapter extends BaseAdapter { private Context context; public ImageAdapter(Context c) { context=c; } @Override public int getCount() { // TODO Auto-generated method stub return pics.length; } @Override public Object getItem(int position) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ImageView iv; if (convertView == null) { // if it's not recycled, initialize some attributes iv = new ImageView(context); iv.setLayoutParams(new GridView.LayoutParams(350,350)); iv.setScaleType(ImageView.ScaleType.CENTER_CROP); iv.setPadding(8, 8, 8, 8); } else { iv = (ImageView) convertView; } iv.setImageResource(pics[position]); return iv; } public Integer[] pics={ R.drawable.menu ,R.drawable.dog, R.drawable.favorites,R.drawable.pmlimage, R.drawable.progress,R.drawable.hearsay, // R.drawable.sample_6,R.drawable.sample_7 }; } Calling Class: private JSONArray mComments = null; public void updateJSONdata() { // Instantiate the arraylist to contain all the JSON data. // we are going to use a bunch of key-value pairs, referring // to the json element name, and the content, for example, // message it the tag, and "I'm awesome" as the content.. categoryList = new Array…
has title: Android-Java Set Array Contents Equal to ArrayList
tagged with: arrays
tagged with: arraylist
score: 0
answer count: 0

http://stackoverflow.com/q/25507522
type: Question
has body: Few years back I was writing code for conditional check as like below boolean isTesting ==false; if(isTesting==false) And one fine day one of senior guy came to me and told me this is not efficient way to do. And then explained something about this to me. I heard But I guess didn’t listened. So I started to write like as below without knowing the purpose of it. if(false==isTesting) Now sudden curiosity came on this subject again is really efficient!? which one is best way to do so? if(isTesting==false) ? if(false==isTesting) ? if(!isTesting) ? And same doubt about if(null==value) and if(value==null). Please clarify Thanks in advance.
has comment: http://stackoverflow.com/comment/39817476
has comment: http://stackoverflow.com/comment/39817391
has comment: http://stackoverflow.com/comment/39817373
tagged with: java
has answer: http://stackoverflow.com/a/25508753
downvote count: 5
score: -2
has comment: http://stackoverflow.com/comment/39817352
has answer: http://stackoverflow.com/a/25507599
has title: if(isTesting==false) ? if(false==isTesting) ? if(!isTesting) ? which is the best way of programming
answer count: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39817371
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39817420
has answer: http://stackoverflow.com/a/25507633
has comment: http://stackoverflow.com/comment/39817439
favorite count: 0

http://stackoverflow.com/a/25396629
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39611166
type: Answer
answers question: http://stackoverflow.com/q/25396459
has body: Try running your service as follows: Rewrite your main method into: public static void main(String[] args) throws Exception { new TestService().run(args); } Then in eclipse go to Run --> Run configurations...., create a new run configuration for your class, go to arguments and add "server path/to/config.yml" in "program arguments". If you put it in the root directory, it would be "server config.yml" I believe you are not passing the location/name of the .yml file and thus your configurations are not being loaded. Another solution is to just add the location of your config file to the array you're passing into run ;)
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/25396459
downvote count: 0

http://stackoverflow.com/comment/39716258
type: Comment
has text: @user3880721 you want a javadoc for what? you want this? http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25453305

http://stackoverflow.com/a/25434871
has comment: http://stackoverflow.com/comment/39682269
has comment: http://stackoverflow.com/comment/39682420
type: Answer
has body: In xml, write this- &lt;fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.SupportMapFragment" /&gt; In Java class file, write this- map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); Its because, you are using v4.app.Fragment. So, you have to use getSupportFragmentManager().
score: 0
answers question: http://stackoverflow.com/q/25434593
has comment: http://stackoverflow.com/comment/39682610

http://stackoverflow.com/comment/39891182
type: QuestionComment
comment on: http://stackoverflow.com/q/25543997
score: 0
has text: have you got any error in tomcat log while server is starting ?
type: Comment

http://stackoverflow.com/q/25453508
has body: I am trying to create an SAML 2.0 assertion with OpenSAML using an existing assertion element for a token renewal process. // Obtain the token Token tk = tkStorage.getToken(data.getTokenId()); OMElement assertionOMElement = tk.getToken(); int samlRstversion = data.getSamlRstVersion(); if(samlRstversion == 2) { DefaultBootstrap.bootstrap(); UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory(); Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller((Element)assertionOMElement); Element x1 = (Element)assertionOMElement; Assertion samlAssertion = (Assertion) unmarshaller .unmarshall(x1); //Add conditions to the assertion } I'm getting two errors. When the DefaultBootstrap.bootstrap(); is used, it throws an exception java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null" When DefaultBootstrap.bootstrap() is removed it throws at Assertion samlAssertion = (Assertion) unmarshaller.unmarshall(x1); Is there something that I have missed?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25457276
score: 0
answer count: 2
tagged with: java
has title: Create SAML 2.0 assertion by existing element in OpenSAML
has answer: http://stackoverflow.com/a/25643714
accepted answer: http://stackoverflow.com/a/25643714
type: Question
has answer: http://stackoverflow.com/a/25457276
tagged with: ws-trust
tagged with: opensaml

http://stackoverflow.com/comment/39733935
type: QuestionComment
has text: @KonstantinV.Salikhov it returns (-1), From the method's comment i see (at)return .... -1 if the character has no numeric value
score: 0
comment on: http://stackoverflow.com/q/25462660
type: Comment

layered
tag name: layered
tags question: http://stackoverflow.com/q/25413794
type: Tag

http://stackoverflow.com/a/25547095
has comment: http://stackoverflow.com/comment/39930469
has comment: http://stackoverflow.com/comment/40026683
accepted answer of: http://stackoverflow.com/q/25546869
has comment: http://stackoverflow.com/comment/39889433
type: Answer
has body: You should do something like this: Path relativePath = Paths.get("<put your path here>"); Path absolutePath = relativePath.toAbsolutePath(); System.out.println("Current relative path is: " + absolutePath.toString()); Another option could be: String workingDir = System.getProperty("user.dir"); This gives you the current working dir, so then work you path from it. EDIT For what you say in the comment: There is no problem in using relative paths, Your problem then could be one of these alternatives: The base path is not the one you think The same lines I put above should help you debug the problem, using them you could see what absolute path you get, for sure it won't be the one you think it is. The problem is the ".", I have not tested it but maybe this could give you some kind of problem under windows. The src directory does not exist, maybe it takes us to the first point or maybe (depending on your application) it was not created/installed... But, even you you want to work with relative paths, at some point (even if you do not do it explicitly), they get converted to absolute paths, so it would do no harm to you to convert them to absolute paths just before using them, at least when debugging or while you get some confidence working with paths.
answers question: http://stackoverflow.com/q/25546869
has comment: http://stackoverflow.com/comment/40022352
score: 2
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39934097
downvote count: 0

http://stackoverflow.com/comment/39755324
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25474022
type: Comment
has text: It will show it - Your label is for that. The hidden tag is to transfer the value back to the servlet. I have not removed the label.

http://stackoverflow.com/q/25499311
downvote count: 0
tagged with: spring
tagged with: spring-batch-admin
tagged with: spring-batch
has body: The question is regarding to the auto-recovery strategy of the batch jobs. Saying the server was shut down due to unknown reasons when there were several jobs running (with status "STARTED" and null end time). How can we recover all these jobs when we start up the server again. In my situation, I wrote my own job launcher to receive requests and save them into the DB queue. Then I run my own job scheduler to poll the requests from the DB and execute the jobs. In order to change these jobs' status from "STARTED" to "STARTING" in order to be picked up by my scheduler again, my current tries contain: because spring batch cannot restart "STARTED" jobs, and even the job is restartable, spring batch will create a new job execution under the same job instance. Hence, if I can restart the job, the origin job id needs to be changed. But we I tried to use the job operator to stop the job with "STARTED" status, and then to restart it again, I failed. Why doesn't this work? jobOperator.stop(jobId); jobOperator.restart(jobId); I also failed to use the job repository to update the job execution status from "STARTED" to "STARTING". jobExecution.setStatus(BatchStatus.STARTED); jobRepository.update(jobExecution); Any thoughts of achieving this would be appreciated!
tagged with: spring-integration
score: 1
has title: how to recover spring batch jobs after the server down time
tagged with: java
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25505944
has answer: http://stackoverflow.com/a/46806375
answer count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/25448434
has comment: http://stackoverflow.com/comment/39706741
type: Question
has comment: http://stackoverflow.com/comment/39706665
tagged with: multidimensional-array
type: UnansweredQuestion
tagged with: arrays
has answer: http://stackoverflow.com/a/25448554
has comment: http://stackoverflow.com/comment/39706545
tagged with: arraylist
score: 0
has body: I need to save an 1D array (histogram) from type double in a 2D array (represents parts of a picture). Actually I have done this (simplified code): private ArrayList&lt;double[]&gt;[][] calculateSignature(BufferedImage screenshot, int blocksizeX, int blocksizeY) { ArrayList&lt;double[]&gt;[][] signature = new ArrayList[2][2]; //!!!!! Type safety: The expression of type ArrayList[][] needs unchecked conversion to conform to ArrayList&lt;double[]&gt;[][] !!!!! for (int x = 0; x &lt; 2; x++) { for (int y = 0; y &lt; 2; y++) { signature[x][y] = calculateHistogram(screenshot.getSubimage(x * blocksizeX, y * blocksizeY, blocksizeX, blocksizeY)); } } return signature; } private ArrayList&lt;double[]&gt; calculateHistogram(BufferedImage screenshot) { double[] histogramRGB = new double[24]; ... ArrayList&lt;double[]&gt; imageLUT = new ArrayList&lt;double[]&gt;(); imageLUT.add(histogramRGB); return imageLUT; } This works but I think it isn´t a good implementation. Are there any improvements for that? Furthermore I get an error like this in the code comment above.
tagged with: java
answer count: 1
has title: Save 1D array in another 2d array

http://stackoverflow.com/comment/39751482
has text: When you reader goes into waiting state, how does it get out of it. Where does it get notified by the consumer? I think your implementation of the consumer/producer pattern is wrong. Particularly the use of wait/notify.
comment on: http://stackoverflow.com/q/25472013
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25420999
tagged with: mysql
has comment: http://stackoverflow.com/comment/39656673
favorite count: 0
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/39976756
has comment: http://stackoverflow.com/comment/40763434
has body: When this happens, i check in my db(refer to table below), the connections has not reach the limit of 1000. This is weird... wonder if there's a hidden hard limit being hit. mysql&gt; show variables like 'max_connections'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 1000 | +-----------------+-------+ mysql&gt; SHOW STATUS WHERE `variable_name` = 'Max_used_connections'; +----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | Max_used_connections | 510 | +----------------------+-------+ FYI, my application is having an average of 300 connections to the database. So any idea? Thanks. My setup: tomcat7, spring 3.1, tomcat7-dbcp, mysql5.5, java7
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39658136
has comment: http://stackoverflow.com/comment/39658223
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/39657629
score: 2
has title: JDBC MySQL complains Too Many Connections
downvote count: 0
has answer: http://stackoverflow.com/a/56923584
tagged with: java
has comment: http://stackoverflow.com/comment/40763404

http://stackoverflow.com/q/25445635
has comment: http://stackoverflow.com/comment/39703251
answer count: 3
tagged with: java
has title: Launching SOAP UI via terminal not working, gives "java; not found"
has comment: http://stackoverflow.com/comment/39701782
has comment: http://stackoverflow.com/comment/39702758
has comment: http://stackoverflow.com/comment/39701449
type: Question
possible better answer: http://stackoverflow.com/a/31027180
tagged with: soapui
tagged with: installation
has comment: http://stackoverflow.com/comment/39701418
upvote count: 2
has answer: http://stackoverflow.com/a/31027180
has comment: http://stackoverflow.com/comment/39701163
downvote count: 0
accepted answer: http://stackoverflow.com/a/25481565
has comment: http://stackoverflow.com/comment/39701556
has answer: http://stackoverflow.com/a/25481565
has body: I have downloaded java8 and then created a folder "java" in "/usr/local". Later I set the JAVA_HOME and PATH using export. echo $JAVA_HOME output /usr/local/java/jdk1.8.0_20 Now, when I open terminal and type java -version it prompts to choose any package from below to install java. But when I do $JAVA_HOME/bin/java -version it gives java version "1.8.0_20-ea" Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b23) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b22, mixed mode) and when I run sh /home/SOAPUI_HOME/soapui-4.0.1/bin/soapui.sh gives ================================ = = SOAPUI_HOME = /home/SOAPUI_HOME/soapui-4.0.1 = ================================ /home/SOAPUI_HOME/soapui-4.0.1/bin/soapui.sh: 141: /home/SOAPUI_HOME/soapui-4.0.1/bin/soapui.sh: java: not found
has answer: http://stackoverflow.com/a/40655021
has comment: http://stackoverflow.com/comment/39701591
favorite count: 0
has comment: http://stackoverflow.com/comment/39701388
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/39871515
has text: I didn't think it was related to generics. I'm not sure I see how this allows for effectively having an instance of a subclass inside the subclass instead of an instance of the parent class. What if I had a binary tree and create a self-balancing binary tree subclass that overrides insert with an insert that performs balancing operations. When insert is recursively called in a subtree of a self-balancing tree, that subtree also needs to perform balancing operations, and therefore needs to be an instance of the self-balancing subclass.
type: Comment
comment on: http://stackoverflow.com/a/25536652
score: 0
type: AnswerComment

http://stackoverflow.com/q/25447175
has comment: http://stackoverflow.com/comment/39706329
has comment: http://stackoverflow.com/comment/39707079
has comment: http://stackoverflow.com/comment/39704397
upvote count: 2
has comment: http://stackoverflow.com/comment/39704064
has comment: http://stackoverflow.com/comment/39766745
has body: I'm trying to provide some custom logging levels to the default logback configuration, but it seems my configuration file is being ignored. I though Boot may skip it for whatever reason but if I make the file not valid (remove / of self-closing tag for example) I got an exception about not being able to parse it - so it is being picked up. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;configuration&gt; &lt;!-- Spring boot base --&gt; &lt;include resource="org/springframework/boot/logging/logback/base.xml" /&gt; &lt;logger name="com.wedgetail" level="WARN" /&gt; &lt;logger name="nv" level="WARN" /&gt; &lt;logger name="StatsLogger" level="WARN" /&gt; &lt;/configuration&gt; So for testing purposes (as my loggers are may be wrongly spelled or whatever) I included: &lt;logger name="org.springframework" level="ERROR" /&gt; When the application comes up I still see spring logging on info level: 2014-08-22 14:28:34.756 WARN 5444 --- [on(3)-127.0.0.1] o.s.b.l.LoggingApplicationListener : Logging environment value '-Djava.util.logging.config.file="C:\Documents and Settings\zykajan\.IntelliJIdea13\system\tomcat\Unnamed_cnc-parent_2\conf\logging.properties"' cannot be opened and will be ignored . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.1.5.RELEASE) 2014-08-22 14:28:34.881 INFO 5444 --- [on(3)-127.0.0.1] o.s.boot.SpringApplication : Starting application on prgdwm395059 with PID 5444 (C:\workspace\command-and-control\webapp\target\cnc-webapp-UNVERSIONED-SNAPSHOT\WEB-INF\lib\spring-boot-1.1.5.RELEASE.jar started by zykajan in C:\Apps\Apache\jakarta\apache-tomcat-7.0.55\bin) 2014-08-22 14:28:34.928 INFO 5444 --- [on(3)-127.0.0.1] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5dd439: startup d…
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39704940
has comment: http://stackoverflow.com/comment/39705200
has comment: http://stackoverflow.com/comment/39704546
has title: Spring boot with custom logback configuration
has comment: http://stackoverflow.com/comment/39767220
favorite count: 0
type: Question
tagged with: spring-boot
tagged with: java
has comment: http://stackoverflow.com/comment/39707190
has comment: http://stackoverflow.com/comment/39706616
has comment: http://stackoverflow.com/comment/39723675
tagged with: logback
tagged with: spring
has comment: http://stackoverflow.com/comment/39766993
accepted answer: http://stackoverflow.com/a/25715812
score: 2
has answer: http://stackoverflow.com/a/25715812
type: AnsweredQuestion

http://stackoverflow.com/q/25400403
has comment: http://stackoverflow.com/comment/39618373
score: -1
type: AnsweredQuestion
upvote count: 0
tagged with: java
answer count: 1
has body: I am trying to parse data from this link http://www.railway.gov.bd/site/page/f8898018-00a5-4096-a803-8b533232e60c using jsoup. This website is available in two languages BANGLA(Bangladeshi language) and English. I wanted the parse data should be in English but when the program run it always parse data in bangla language.My code is : Document doc = Jsoup.connect("http://www.railway.gov.bd/site/page/f8898018-00a5-4096- a803-8b533232e60c").get(); Elements allTables=doc.getElementsByTag("table"); Element table=allTables.get(0); Elements rows=table.getElementsByTag("tr"); for(Element row:rows) { Elements tds=row.getElementsByTag("td"); for(Element td:tds) { Log.i("data", td.text()); } } What i wanted is that the data which is parsed should be in english. Please give me some suggestion how can i do this. Thanks in advance :)
has answer: http://stackoverflow.com/a/25400685
tagged with: html-parsing
downvote count: 1
accepted answer: http://stackoverflow.com/a/25400685
favorite count: 0
type: Question
tagged with: jsoup
has title: Having trouble to parsing html with jsoup in android
tagged with: android

http://stackoverflow.com/comment/39808440
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25502081
has text: whoops I totally messed something trivial up, sec - changed something in the AI class to fix it (added `void`)

http://stackoverflow.com/q/25400646
has answer: http://stackoverflow.com/a/25798999
tagged with: shiro
tagged with: angularjs
type: Question
tagged with: jpa
type: UnansweredQuestion
upvote count: 4
tagged with: rest
score: 3
tagged with: java
answer count: 3
has title: How to integrate Apache Shiro with AngularJS
downvote count: 1
has body: I am having REST API with JPA and for login framework I am using Apache Shiro. Is it possible to integrate Apache Shiro with AngularJS and If YES Please give some example to workout with it. Thanks
favorite count: 0
has answer: http://stackoverflow.com/a/40164448
has answer: http://stackoverflow.com/a/25798961

http://stackoverflow.com/q/25408020
tagged with: sql
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25440979
favorite count: 0
has title: jOOQ - General way to insert multiple data and get generated IDs
score: 9
type: Question
tagged with: jooq
has body: what is the general way to insert multiple data via jooq, when I need the generated key of each element? Normally I would use a batch insert, which is not possible at the moment because of this. I could use create.newRecord(...) and insert each element separately. Afterwards, the ID is set correctly, but this approach has a bad performance. I hope someone has a better approach, I cannot be the only one who need this feature... Thanks a lot in advance, tohoe
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25440979
upvote count: 9

http://stackoverflow.com/a/25451829
score: 3
has body: Let's say you have: String one = "1"; String two = "2"; String three = "3"; System.out.println("one: " + stringOne + " and two: " + stringTwo + " and also a three: " + stringThree); Will print one: 1 and two: 2 and also a three: 3 It is called concatenation. I.e. you "create a new String". Look at this answer too for mor information. In you actual code " " will just add a white space between the values of your variables.
type: Answer
accepted answer of: http://stackoverflow.com/q/25451719
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25451719
downvote count: 0

http://stackoverflow.com/comment/39613383
type: Comment
type: QuestionComment
score: 0
has text: Have you tried simply `mvn clean`?
comment on: http://stackoverflow.com/q/25397717

audio-converter
tags question: http://stackoverflow.com/q/25426187
tag name: audio-converter
type: Tag

http://stackoverflow.com/comment/39608608
type: AnswerComment
score: 1
has text: That's why I changed the question to be IDE-specific
comment on: http://stackoverflow.com/a/25395038
type: Comment

http://stackoverflow.com/comment/39802016
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25499239
has text: see Path.transform method
type: Comment

http://stackoverflow.com/comment/39891877
comment on: http://stackoverflow.com/q/25537533
type: Comment
type: QuestionComment
score: 1
has text: I add a pull request to your project.

http://stackoverflow.com/q/25520498
linked to: http://stackoverflow.com/q/6865538
type: Question
has title: weird error while creating mysql connection in jdbc
has comment: http://stackoverflow.com/comment/39841266
answer count: 0
has comment: http://stackoverflow.com/comment/39841476
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39841423
has comment: http://stackoverflow.com/comment/39841478
has comment: http://stackoverflow.com/comment/39841458
score: 0
linked to: http://stackoverflow.com/q/2121829
has comment: http://stackoverflow.com/comment/39841450
has comment: http://stackoverflow.com/comment/39841336
tagged with: java
has body: Note: I have Googled a LOT and found hundreds of suggestions for this problem but nothing seem to work for me. That's why I am posting a duplicate looking question I am getting a weird error in my java program org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure, The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.) I am not able to figure out what's wrong. I tried updating mysql jar file, closing other mysql connections, increasing connection limit, restart mysql/tomcat, etc.. Surprisingly, the connection properly works in a different project of mine using exactly same db configs. This problem started suddenly, I haven't changed a bit in db config lately. Any info on possible causes will help me debug this issue further.
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39841356
has comment: http://stackoverflow.com/comment/39841501
has comment: http://stackoverflow.com/comment/39841302
tagged with: mysql
has comment: http://stackoverflow.com/comment/39841388

http://stackoverflow.com/a/25463481
score: 0
type: Answer
has body: function ckh(ev){ ev.preventDefault(); //... do stuff here } is this working ? if no, try to log arguments in your function : you should get the event as the first argument, then try also onsubmit="chk()" without the return
answers question: http://stackoverflow.com/q/25463427

http://stackoverflow.com/q/25497739
type: Question
has answer: http://stackoverflow.com/a/25499745
tagged with: java
has answer: http://stackoverflow.com/a/47654502
tagged with: lotus-notes
score: 2
answer count: 2
upvote count: 2
type: UnansweredQuestion
downvote count: 0
has title: Extracting attachments from Lotus Notes Email with Java
has body: In my project I am attempting to read lotus notes email in the Inbox. Right now I have two emails in my inbox, each email has an attachment, and I am trying to open each email and download the attachment from that email. The issue I am having now is that my program is only reading the first email. try { NotesThread.sinitThread(); Session session = NotesFactory.createSession(); Database database = session.getDatabase("servername", "mailbox link"); View view = database.getView("$Inbox"); Document document = view.getFirstDocument(); while(document != null) { RichTextItem Body = (RichTextItem)document.getFirstItem("Body"); Vector vector = Body.getEmbeddedObjects(); Enumeration iterator = vector.elements(); while (iterator.hasMoreElements()) { EmbeddedObject eo = (EmbeddedObject)iterator.nextElement(); if(eo.getType()==EmbeddedObject.EMBED_ATTACHMENT) { attachment = eo.getName(); eo.extractFile("destination" + eo.getName()); eo.remove(); } }//end of inner while logger.info("Received email and downloaded attachment"); document = view.getNextDocument(document); } //end of outer while } catch(NotesException nex) { logger.severe("Exception in INotes connection"); } finally { NotesThread.stermThread(); } I thought the line -- document = view.getNextDocument(document) would open the next email in the Inbox. But I am only getting the first email as the result. Appreciate any pointers.
favorite count: 0

http://stackoverflow.com/q/25443757
type: Question
has comment: http://stackoverflow.com/comment/39697978
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25443852
type: AnsweredQuestion
score: 5
accepted answer: http://stackoverflow.com/a/25443859
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/25443832
has answer: http://stackoverflow.com/a/25443859
has body: I see a lot of java examples connecting to a db, makes a call to newInstance(). Some don't use it at all. I tried both and are working fine. I couldn't understand why some use and some don't? ... Class.forName("com.mysql.jdbc.Driver").newInstance(); ... ... Class.forName("com.mysql.jdbc.Driver"); ...
has answer: http://stackoverflow.com/a/25443832
favorite count: 0
has title: What is the difference between using .newInstance() and not using?

http://stackoverflow.com/comment/39848804
type: AnswerComment
score: 0
has text: @lukassz this answer is wrong, as is mentoned by answerer in his comment to me, he don't want to solve anything, put Integer value to JComboBoxDefaultComboBoxModel, again don't to parse whatever in Java, Java is designated to nest all data types thought all Java APIs (excluding a few bugs) correctly
type: Comment
comment on: http://stackoverflow.com/a/25524568

http://stackoverflow.com/comment/124444389
has text: NetBeans part was very helpful!
type: AnswerComment
comment on: http://stackoverflow.com/a/69200638
score: 0
type: Comment

http://stackoverflow.com/q/25480845
has comment: http://stackoverflow.com/comment/39767672
score: 0
has body: I have list of list String named as mainPartition: [[23423],[23133],[32323],[23211]] input file is: now I want to sort this mainPartition, But it dont work for me code I used is: Collections.sort(mainPartition, new Comparator&lt;List&lt;String&gt;&gt; () { public int compareTo(List&lt;String&gt; a, List&lt;String&gt; b) { return a.get(1).compareTo(b.get(1)); } });
has answer: http://stackoverflow.com/a/25481047
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39768005
type: Question
has comment: http://stackoverflow.com/comment/39767597
has comment: http://stackoverflow.com/comment/39767761
type: UnansweredQuestion
has title: How to sort list of list in java
linked to: http://stackoverflow.com/q/1080030
tagged with: sorting

http://stackoverflow.com/comment/39847007
score: 0
type: Comment
has text: I have no login action. I am not using spring security. Infact, I have no authentication plugin at all.
type: AnswerComment
comment on: http://stackoverflow.com/a/25523735

http://stackoverflow.com/q/25403293
has body: I have a ListView and in every single ListviewItem there is an ImageView with a little star (for marking it as favourite). Therefore I put an OnClickListener to the ImageView on every item in the custom ArrayAdapter. imgStar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Bitmap bitmap = ((BitmapDrawable)imgStar.getDrawable()).getBitmap(); Bitmap bitmap2 = ((BitmapDrawable)(context.getResources().getDrawable(R.drawable.ic_action_not_important))).getBitmap(); if(bitmap != bitmap2) { imgStar.setImageResource(R.drawable.ic_action_not_important); } else { imgStar.setImageResource(R.drawable.ic_action_important); } } }); The problem: When I get some items and click for example on the star of the first item, the image changes as it should but a few items lower the image changes too o.O I tested it with some code: The thing that won't get into my head is it is only changing the image (on the other item below), code that would be executed in the onclick is only executed for the item I really click not for the one where the image changes too. Why does the image of a random other item in the list change also? I hope someone can help me. Custom Adapter Constructore Code public LinkArrayAdapter(Context con, int textViewResourceId) { super(con, textViewResourceId); context = con; }
tagged with: imageview
has comment: http://stackoverflow.com/comment/39622875
tagged with: android-arrayadapter
has comment: http://stackoverflow.com/comment/39624487
linked to: http://stackoverflow.com/q/25187400
has title: Android Imageview in Listview onClick change image doesn't work properly
has comment: http://stackoverflow.com/comment/39623780
tagged with: android
has answer: http://stackoverflow.com/a/25403471
accepted answer: http://stackoverflow.com/a/25403471
has comment: http://stackoverflow.com/comment/39622974
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39623661
has comment: http://stackoverflow.com/comment/39624772
has comment: http://stackoverflow.com/comment/39622786
answer count: 3
downvote count: 0
tagged with: android-listview
has comment: http://stackoverflow.com/comment/39622894
upvote count: 1
has comment: http://stackoverflow.com/comment/39622839
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39622765
has answer: http://stackoverflow.com/a/49313479
has comment: http://stackoverflow.com/comment/39622881
has answer: http://stackoverflow.com/a/25403492
possible better answer: http://stackoverflow.com/a/25403492
has comment: http://stackoverflow.com/comment/39624636
favorite count: 0
has comment: http://stackoverflow.com/comment/39624356
type: Question
has comment: http://stackoverflow.com/comment/39624567
has comment: http://stackoverflow.com/comment/39624010

http://stackoverflow.com/comment/39775467
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25484321
has text: Great, you nailed it so! I'll use IST and see what happens. Thanks a lot! :)
score: 0

http://stackoverflow.com/q/25406198
score: 1
upvote count: 1
tagged with: java
tagged with: jboss-forge
favorite count: 0
type: Question
tagged with: postgresql
has comment: http://stackoverflow.com/comment/44228187
has title: No working postgresql connection in OpenShift jBoss web app
type: UnansweredQuestion
tagged with: jboss
has body: I've been having this problem for over a week now and I cannot find any leads to solving it. I have a Java EE web application, initially built using jBoss Tools Forge, following the guide on OpenShift's website titled 'JBoss Forge--Build and Deploy Java EE 6 AngularJS Applications using JBoss Forge and OpenShift'. The application is hosted on OpenShift, having JBoss Application Server 7 and PostgreSQL 9.2 as main and secondary cartridges. It runs fine, and doesn't provide any errors about the database connection, but the data entered through the interface is lost upon application restart, and persistence is quite crucial. Here are the relevant parts of the files that should be responsible for detailing the postgresql connection: Persistence.xml: <?xml version="1.0" encoding="UTF-8" standalone="no"?> Forge Persistence Unit org.hibernate.ejb.HibernatePersistence java:jboss/datasources/PostgreSQLDS <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.transaction.flush_before_completion" value="true"/> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> Standalone.xml: jdbc:postgresql://${env.OPENSHIFT_POSTGRESQL_DB_HOST}:${env.OPENSHIFT_POSTGRESQL_DB_PORT}/${env.OPENSHIFT_APP_NAME} postgresql adminpielw4l Fy7dRZirzc7Y <check-valid-connection-sql>SELECT 1</check-valid-connection-sql> true <background-validation-millis>60000</background-validation-millis> IdleConnections org.h2.jdbcx.JdbcDataSource com.mysql.jdbc.jdbc2.optional.MysqlXADataSource org.postgresql.xa.PGXADataSource </datasources> I have one .java file that defines the entity, such as: @Entity @XmlRootElement public class wugMember implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", updatable = false, nullable = false) private Long id =…
tagged with: openshift
linked to: http://stackoverflow.com/q/27893712
downvote count: 0
answer count: 0

http://stackoverflow.com/a/25400267
accepted answer of: http://stackoverflow.com/q/25399933
type: Answer
has body: The following is the way to add elements to the first of queue using deque and asLifoQueue method in collections.this will arrange the elements in last in first out order... public class Practice15 { public static void main(String[] args) { Deque&lt;Integer&gt; dd=new ArrayDeque&lt;Integer&gt;(); dd.offerFirst(123); dd.offerFirst(258); dd.offerFirst(125); System.out.println(dd); Queue&lt;Integer&gt; q1=Collections.asLifoQueue(dd); System.out.println(q1); } }
score: 7
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25399933
upvote count: 7

http://stackoverflow.com/a/25422024
has comment: http://stackoverflow.com/comment/39662073
answers question: http://stackoverflow.com/q/25421914
has comment: http://stackoverflow.com/comment/39661399
type: Answer
accepted answer of: http://stackoverflow.com/q/25421914
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Take a look at h2 You can use Server mode to allow multiple java process to access the database file without having file locking issues. Database URL will look something like jdbc:h2:tcp://localhost/C:/Users/SomeName/Desktop/h2/SomeDATABASEFile Hibernate officially supports h2
upvote count: 1

http://stackoverflow.com/q/25400841
upvote count: 2
tagged with: facebook
accepted answer: http://stackoverflow.com/a/25424398
has comment: http://stackoverflow.com/comment/39643955
has answer: http://stackoverflow.com/a/25424398
has title: JSOUP - how to get content of Facebook event page as logged in user?
type: AnsweredQuestion
has body: When you are logged into Facebook, content of page is little different, like: One of event hosts instead of just: One of hosts I've tried a few ways to take page content with hovercard. I really don't have any more idea how to do that, my last try was: String login = "secret.user@gmail.com"; String password = "veryHardPassword"; String URL = "https://www.facebook.com/events/"; String loginURL = "https://www.facebook.com/login.php?login_attempt=1"; String useragent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0"; String referrer = "http://www.google.com"; Connection.Response res2 = Jsoup.connect(loginURL) .userAgent(useragent) .referrer(referrer) .data("email", login,"pass", password) .method(Method.POST).execute(); Map<String, String> cookies = res2.cookies(); Response res = Jsoup.connect(URL + "eventID") .userAgent(useragent) .referrer(referrer) .timeout(200000) .cookies(cookies) .method(Method.POST) .execute(); Document doc = res.parse(); System.out.print(doc); Unfortunately that cookies are changing during logging in. Could anyone help me?
score: 2
tagged with: cookies
has comment: http://stackoverflow.com/comment/39656314
tagged with: java
has comment: http://stackoverflow.com/comment/39655303
downvote count: 0
answer count: 1
favorite count: 0
type: Question
tagged with: jsoup

http://stackoverflow.com/comment/39801528
has text: Right, that isn't clear at all in the question - please edit it to make it clearer. Also, please show any attributes specified for your test, and tell us more about how your tests are being run. (JUnit 4? Something else?)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25498993
type: Comment

http://stackoverflow.com/q/25412681
tagged with: java
tagged with: anonymous
has comment: http://stackoverflow.com/comment/46270652
has comment: http://stackoverflow.com/comment/45559028
has title: Spring Security Anonymous Authentication not initialised
type: Question
upvote count: 2
score: 2
tagged with: spring-4
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: spring-security
favorite count: 0
has body: I am using Spring4 with Spring Security 3.2.4. I have some http configurations in my security configuration in order to host form based authentication and REST services (with authentication) together. For the pages and REST services which require app-authentication everything works fine with my current configuration but for the pages which does not require authentication, such as login and register, the anonymous authentication is not initialised somehow. Speaking in Java: SecurityContextHolder.getContext().getAuthentication() returns null. I expect that anonymous authentication is initialised as the documentation (http://docs.spring.io/spring-security/site/docs/3.2.4.RELEASE/reference/htmlsingle/#introduction) refers: Anonymous authentication support is provided automatically when using the HTTP configuration Spring Security 3.0 and can be customized (or disabled) using the element. You don’t need to configure the beans described here unless you are using traditional bean configuration. Does anyone have an idea why does it not happen although the documentation refers? (Beside the fact, that the documentation for 3.2.4 refers to 3.0 version and some of the given configuration suggestions refer deprecated implementation)

http://stackoverflow.com/q/25391041
has comment: http://stackoverflow.com/comment/39600747
tagged with: bukkit
type: Question
has comment: http://stackoverflow.com/comment/39600511
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25391135
tagged with: arrays
has title: Getting Integers into Byte Arrays according to bizarre protocols
tagged with: minecraft
has answer: http://stackoverflow.com/a/25391368
has answer: http://stackoverflow.com/a/25391549
has body: I am constructing a byte array which contains data about a block which has changed. I have integers x, y, z and blockID, blockMeta: Bit mask Width Meaning 00 00 00 0F 4 bits Block metadata 00 00 FF F0 12 bits Block ID 00 FF 00 00 8 bits Y co-ordinate 0F 00 00 00 4 bits Z co-ordinate, relative to chunk so can fit F0 00 00 00 4 bits X co-ordinate, relative to chunk so can fit How would I get the integers into the array? I can safely assume that the integer will 'fit' if that is an issue. This is what I got so far: byte[] data = new byte[blocks.length * 4]; for (int i = 0; i &lt; blocks.length; i++) { int j = i * 4; int blockX = blocks[i].getBlockX() - (chunk.getX() * 16); int blockY = blocks[i].getBlockY(); int blockZ = blocks[i].getBlockZ() - (chunk.getZ() * 16); int blockID = material.getId(); int blockMeta = 0; // data[j] = // Help! // data[j + 1] = //Help! // data[j + 2] = //Help! // data[j + 3] = //Help! }
has comment: http://stackoverflow.com/comment/39600676
answer count: 3
score: 0
tagged with: java

http://stackoverflow.com/q/25466085
tagged with: expandablelistview
has comment: http://stackoverflow.com/comment/39740323
has answer: http://stackoverflow.com/a/25467229
type: Question
has comment: http://stackoverflow.com/comment/39740246
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39740345
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39740214
has comment: http://stackoverflow.com/comment/39740242
has answer: http://stackoverflow.com/a/25475478
score: 0
tagged with: notifydatasetchanged
answer count: 2
has comment: http://stackoverflow.com/comment/39740227
has body: in my android application i have a ExpandableListView and BaseExpandableListAdapter the BaseExpandableListAdapter is in a separate class. In the list i have a delete button inside the child row of the list , The button remove the current row but the list are stay like before and not show it in real time. I get the data to the adapter via my DbHandler into a HashMap . I tried to use notifyDataSetChanged() but no result else i running onCreate again. How can i solve that?
has title: How to use notifyDataSetChanged on CustomAdapter?

http://stackoverflow.com/comment/39605891
score: 0
has text: What is the "it" that is complaining about the main class? What things have you tried and what specifically were the results? What are you using to open the HTML page?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25393232

http://stackoverflow.com/q/25418243
type: Question
upvote count: 2
type: UnansweredQuestion
has title: Data validation with JOptionPane
has answer: http://stackoverflow.com/a/25435376
has body: I want to perform data validation while JOptionPane.I found the following approach but i am not really satisfied with it import javax.swing.*; import java.util.regex.*; public class ValidateJOptionPane { public static void main(String[] args) { String input = JOptionPane.showInputDialog("Enter number: "); Pattern p = Pattern.compile("[A-Z,a-z,&amp;%$#@!()*^]"); Matcher m = p.matcher(input); if (m.find()) { JOptionPane.showMessageDialog(null, "Please enter only numbers"); } } } It would have been better and more sensible to use the regex to detect the characters that can be entered rather than testing for characters that can't be entered. Is there a better and simpler way to do data validation with JOptionPane ? . I feel regex is overkill here.Correct me if i am wrong:P P.S i am a beginner with Java
score: 2
tagged with: joptionpane
answer count: 2
has answer: http://stackoverflow.com/a/25418345
tagged with: validation
tagged with: java
downvote count: 0
tagged with: swing
favorite count: 0

http://stackoverflow.com/comment/39823841
type: AnswerComment
comment on: http://stackoverflow.com/a/25510859
score: 0
has text: @meriton it doesnt matter, it has (1+2+3+...300) thats n(n+1)/2 which is O(n^2) for the 2 loops inside
type: Comment

http://stackoverflow.com/comment/39628249
has text: Obviously we're guessing, but it's likely it's the public-facing API, e.g., what clients access.
comment on: http://stackoverflow.com/q/25405966
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25411529
tagged with: html-parsing
type: Question
has body: My code is using jsoup cleaner to remove unwanted elements from the document. I have noticed that after the cleaning operation that many empty text nodes remain. Since they have no child nodes it should be ok to delete them. Wondering if anyone has implemented a solution for this already... Document output to string is below: li text: a: http://www.example.com//mobile/ text: Mobile Apps text: li text: Financial Products a: another-link text: xyz Visual Data text: text: text: text: text: text:
tagged with: java
has answer: http://stackoverflow.com/a/25414052
has title: How to remove empty text elements during cleaning of the document?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39639055
score: 0
accepted answer: http://stackoverflow.com/a/25414052
tagged with: jsoup
answer count: 1
has comment: http://stackoverflow.com/comment/78222695

http://stackoverflow.com/comment/39712934
score: 0
type: Comment
type: QuestionComment
has text: Actually, it gives. I've tested it by printing each value in the console, and it works. The problem is with the sum
comment on: http://stackoverflow.com/q/25451481

http://stackoverflow.com/a/25407778
answers question: http://stackoverflow.com/q/25407657
type: AcceptedAnswer
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39631534
downvote count: 0
has comment: http://stackoverflow.com/comment/39631745
accepted answer of: http://stackoverflow.com/q/25407657
has comment: http://stackoverflow.com/comment/39631595
has body: mTrue.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, R.string.correct_toast,Toast.LENGTH_LONG).show(); } }); Here you are passing an instance of an anonymous class implementing the View.OnClickListener() interface. The setOnClickListener method of View class accepts a parameter of type View.OnClickListener. Therefore, giving an instance that implements this interface works. As for addMouseListener, assuming you are referring to this method of Component, it accepts an interface too - MouseListener. However, in your example : public void init(){ addMouseListener(new MouseAdapter(){ public void mousePressed(MouseEvent me){ showStatus("mouse pressed"); } }); } you are passing to it an instance of an anonymous class that inherits from MouseAdapter, which itself implements the interface MouseListener. Those two examples are therefore quite similar.
upvote count: 2

http://stackoverflow.com/comment/39769114
has text: but i think i can use that :-?
type: Comment
comment on: http://stackoverflow.com/q/25481604
score: 0
type: QuestionComment

http://stackoverflow.com/comment/39635020
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25408969
has text: You'll need to include two `StringBuffer`s. One for your H2OIN row and another for your CO2IN row.

http://stackoverflow.com/comment/39779330
type: Comment
type: QuestionComment
has text: What is a DisplayList?
comment on: http://stackoverflow.com/q/25487328
score: 0

http://stackoverflow.com/comment/39741106
type: Comment
type: QuestionComment
has text: `if (gettreasurelist == null) { System.out.println("gtl is null"); }`
comment on: http://stackoverflow.com/q/25466481
score: 0

http://stackoverflow.com/comment/39753219
type: QuestionComment
has text: @Luka, "The notify method inside the read method of the Reader class notifies the main thread the output is ready." No! It doesn't. The only thing that `notify()` does is to wake another thread that is in a `wait()` call on the same object. If no other thread is waiting at that exact moment, then `notify()` does not do anything at all. We call it a "lost notification" bug when thread A gets stuck in a wait() call _after_ thread B has already done the `notify()`.
comment on: http://stackoverflow.com/q/25472013
score: 0
type: Comment

http://stackoverflow.com/q/25489131
upvote count: 1
has title: Base64 Encoder not encoding UTF-8
favorite count: 0
type: Question
tagged with: apache-commons
has body: So I have a program that is supposed to encode UTF-8 Base64, but is not. My Encoder code is as follows: public class Encoder { public static void Encode() throws IOException{ byte[] bytes = Base64.encodeBase64(readFile("C:\\Users\\Dragon\\Desktop\\Binary\\Diamond.png", StandardCharsets.UTF_8).getBytes(StandardCharsets.UTF_8)); String binary = new String(bytes); PrintWriter out = new PrintWriter("C:\\Users\\Dragon\\Desktop\\Binary\\Base64.txt"); out.println(binary); out.close(); System.out.println("Your File has been saved at C:\\Users\\Dragon\\Desktop\\Binary\\Base64.txt"); } static String readFile(String path, Charset encoding) throws IOException { byte[] encoded = Files.readAllBytes(Paths.get(path)); return new String(encoded, encoding); } } And when I decode it with this website (That has UTF-8 Functionality): http://www.base64decode.org/ I get: Input (My code made this): [binary] Expected output from website: ‰PNG IHDR óÿa tEXtAuthor minecraftinfo.comßf'K ²IDAT8Ëcøÿÿ?%Á@&lt;æÿ‘1º&lt;^@Ðº!8 €i^ôí9_üõù¿Áí½(†`5 ¦¤¦¼Þ^c¢ €iÃ ]a ºæž/P°ÂÔFWà5 d#.`®Ài H³ÎÙX ®Îc¼À¤ƒa«°@iÙÓ Ã01œa 3 äG\Àl'˜Œît¢“26Œ7)SœÉÅ aÍ^L‹ IEND®B`‚ Actual output From website: �PNG IHDR��atEXtAuthorminecraftinfo.com�f'K�IDAT8�c���?%�@&lt;���1�&lt;^@��!8 �i^��9_�����(�`5�����^c� �i� �]�a��/�P���FW�5d#.`��iH��ٍX ���c����a��@i���01�a3�G\�l'������t��26�7)S���a�^L�IEND�B`� However, when I encode the same exact thing using this site and not my code, It DOES have UTF-8 Formatting and decodes correctly. So what am I doing wrong?
tagged with: java
tagged with: base64
accepted answer: http://stackoverflow.com/a/25489588
has answer: http://stackoverflow.com/a/25489588
type: AnsweredQuestion
score: 1
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/39701935
has text: What have you tried so far? The obvious solution would be to post a `Runnable` or use a `Timer`. But don't forget to check if the `Button` is still pressed.
comment on: http://stackoverflow.com/q/25445951
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25464114
answers question: http://stackoverflow.com/q/25464062
score: 0
has comment: http://stackoverflow.com/comment/39736498
has body: The method cancel(boolean mayInterruptIfRunning) (in class AsyncTask) is not a static method and you're calling it with the class name (the way static methods are invoked). You should use the instance of MyAsyncTask to call (this): this.cancel(true);
type: Answer

http://stackoverflow.com/a/25515855
score: 7
downvote count: 0
answers question: http://stackoverflow.com/q/25490581
type: AcceptedAnswer
type: Answer
upvote count: 7
has body: This is a new bug that exists in the JDK 8u20 update release and in the current JDK 9 development branch. This code worked before, so yes, this would be considered a regression. The JDK langtools team has filed the following bug report: JDK-8055963 Inference failure with nested invocation Judging from the comments, it appears that the current behavior actually conforms to the specification (the JLS), but the behavior is clearly wrong, so it might be the case that a clarification to the specification is necessary. Note that this is a different type inference bug from the one reported in this other StackOverflow question Java 1.8.20 Compiler Error, bug JDK-8051402. That bug has been fixed already, although but the fix isn't in JDK 8u20.
accepted answer of: http://stackoverflow.com/q/25490581

http://stackoverflow.com/comment/39778253
score: 0
type: AnswerComment
has text: I just commented it out to print output in a specific manner. You are playing with exceptions to parse a JSON. so there will be huge stack trace and output clubbed
type: Comment
comment on: http://stackoverflow.com/a/25484276

http://stackoverflow.com/q/25497671
type: Question
has title: Why my JavaFX TableView is empty
accepted answer: http://stackoverflow.com/a/25503220
tagged with: javafx-2
has answer: http://stackoverflow.com/a/25503220
type: AnsweredQuestion
tagged with: java
tagged with: javafx
downvote count: 0
upvote count: 1
score: 1
answer count: 1
favorite count: 0
has body: I added default TEST1 and TEST2 as Name Col in TableView but didn't display when I run it. Here are two classes and one fxml I used for, can anyone give me some advices regarding this issue ? only one package call : controllerJBoxFXTest 1st Class MainView.class package controllerJBoxFXTest; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; public class MainView extends Application { public static void main(String[] args){ Application.launch(MainView.class, (java.lang.String[]) null); } @Override public void start(Stage primaryStage) throws Exception { try { AnchorPane Page = (AnchorPane) FXMLLoader.load(MainView.class.getResource("MainController.fxml")); Scene scene = new Scene(Page); primaryStage.setScene(scene); primaryStage.setTitle("Test Main"); primaryStage.show(); } catch (Exception e){ Logger.getLogger(MainView.class.getName()).log(Level.SEVERE, null, e); } } } 2nd MainController.java, you can see I added TEST1 and TEST2 package controllerJBoxFXTest; import java.net.URL; import java.util.ResourceBundle; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.beans.property.SimpleStringProperty; public class MainController implements Initializable{ @FXML TableView tableID; @FXML TableColumn<Table, String> iName; public class Table { private final SimpleStringProperty rName; public Table(String sName) { this.rName = new SimpleStringProperty(sName); } public String getName(){ return rName.get(); } public void setName(String vName) { this.rName.set(vName); } } final ObservableList data = FXCollections.observableArrayList( new Table("TEST1"), new Table("TEST2…

http://stackoverflow.com/comment/39926458
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25553136
has text: @MathiasMüller: Ofc they are considered part of the string. That's the point, the string becomes the XPath expression
type: AnswerComment

http://stackoverflow.com/q/25436410
has title: LDAP Continuation Reference error in search results from Active Directory when using GSSAPI authentication in Java
has comment: http://stackoverflow.com/comment/59540852
score: 5
type: UnansweredQuestion
has body: UPDATE: Based on the comment from @Michael-O below, it seems like the correct way to handle this issue if for the LDAP JNDI provider or the SASL implementation to canonicalize the host name by doing a forward then a revers DNS lookup before issue in KRN service ticket request. I will try to reach out to the Open JDK security list and see if any answers come back from there. I am trying to do a recursive LDAP search on the root DN against an Active Directory server using a session that is authenticated via GSSAPI using a Subject from a Kerberos LoginContext. I am able to successfully bind to the server with URL ldap://dc1.example.com. The InitidalDirContext has java.naming.referral set to follow. When I execute the search (&amp;(objectClass=user)(userPrincipalName=sample_user@EXAMPLE.COM)) against the root DN of dc=example,dc=com, I get one SearchResult back: CN=Sample User,OU=ExampleUsers,DC=example,DC=com And several Continuation References: ldap://example.com/CN=Configuration,DC=example,DC=com ldap://ForestDnsZones.example.com/DC=ForestDnsZones,DC=example,DC=com ldap://DomainDnsZones.example.com/DC=DomainDnsZones,DC=example,DC=com I can iterate over the SearchResult just fine, but as soon as I encounter a continuation, I get a PartialResultsException. I checked DNS and all of the above host names resolve correctly. The exception I get looks like this: javax.naming.PartialResultException [Root exception is javax.naming.AuthenticationException: GSSAPI [Root exception is javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Server not found in Kerberos database (7))]]]. Looking at the Kerberos trace, this error makes sense. When trying to follow the continuation, the LDAP library attempts to bind to ldap://example.com. Since we're using GSSAPI for authentication, this triggers a service ticket request for ldap/example.com. The response I see in the log is: &gt;&gt;&gt;KRBError: sTime is Thu Aug…
upvote count: 5
downvote count: 0
tagged with: active-directory
has answer: http://stackoverflow.com/a/25652440
tagged with: ldap
has comment: http://stackoverflow.com/comment/39870120
tagged with: sasl
tagged with: java
answer count: 1
tagged with: gssapi
favorite count: 0
has comment: http://stackoverflow.com/comment/40083171
type: Question

http://stackoverflow.com/a/25500964
has body: As stated in some examples throught the Dropwizard repository, you may need to provide your template file configuration so that database properties are pulled out from there. So have you tried running you application to set up your database with the .yml file as a command line argument? Something like the following: java -jar your-artifact.jar db migrate your-configuration-file.yml Then run your application as follows: java -jar your-artifact.jar server your-configuration-file.yml
has comment: http://stackoverflow.com/comment/39806985
accepted answer of: http://stackoverflow.com/q/25480442
score: 5
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25480442

http://stackoverflow.com/q/25484102
score: -1
upvote count: 0
tagged with: stream
downvote count: 1
answer count: 1
favorite count: 0
has title: How to avoid outOfMemmoryError when store bitmap high quality in sd Card in android
has answer: http://stackoverflow.com/a/25484243
type: Question
has body: I want to store bitmap in to SD card but when I pick large bitmap I faced "out of memory error" problem. My code: FileOutputStream out = new FileOutputStream(file); bm.compress(Bitmap.CompressFormat.JPEG, 100, out); out.flush(); out.close(); I read many likely questions but they answers not solve my problem because all of answers says you must save bitmap in low quality. Pleas don't answer me to reduce quality because I need to store bitmap in high quality.
tagged with: android
tagged with: java
tagged with: android-bitmap
type: UnansweredQuestion

newrelic
tag name: newrelic
type: Tag
tags question: http://stackoverflow.com/q/25416956
tags question: http://stackoverflow.com/q/25392120

http://stackoverflow.com/q/25421743
has comment: http://stackoverflow.com/comment/39764030
tagged with: java
linked to: http://stackoverflow.com/q/24866220
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39749407
has body: Regarding to my question I have before How to stop .next() and .previous() from looping It seems that whenever I cancel/finish/close my jframe I can't make my original program run again like when I run it for the first time. I made the code below in netbeans while my original code is in eclipse. There shouldn't be difference where I run my program, right? But then.. I have that code in my original program in eclipse and it only execute .setEnable and .setText only once when I run my program. Even though both of the platforms have the same code I get different outcomes. Is this natural or not? My code below works perfectly fine but then in my original code it isn't. Is there something I'm doing wrong here? Should I post a snippet of codes from my original code for comparison? This is my sample code though its not that short... main class: import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Action; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; /** * * @author lenovo */ public class main { JFrame Card = new JFrame(); public main(){ Card.setVisible(true); Card.setSize(605,333); Card.setTitle("Tank Delivery"); Card.setResizable(false); final Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); int x=(int)((dimension.getWidth() - Card.getWidth())/2); int y=(int)((dimension.getHeight() - Card.getHeight())/2); Card.setLocation(x, y); Card.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel panel = new JPanel(); JButton a = new JButton("OPEN"); a.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { gridbaglayoutdemo g = new gridbaglayoutdemo(); } }); panel.add(a); Card.add(panel); } public static void main(String[] args){ //Use the event dispatch thread for Swing components EventQueue.invokeLater(new Runnable() { …
type: Question
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39675312
tagged with: swing
has comment: http://stackoverflow.com/comment/39749167
score: 0
has comment: http://stackoverflow.com/comment/39763926
has title: Is there a difference where I run my program?

http://stackoverflow.com/a/25434440
has comment: http://stackoverflow.com/comment/39682958
has comment: http://stackoverflow.com/comment/39682460
has body: Try this code: List&lt;HashMap&lt;String, String&gt;&gt; artEvents = ...; //this map stores all of the result maps (one map per uri_path, uri_path is the key in this uniqueUriMap, map itself being a value). HashMap&lt;String, HashMap&lt;String, String&gt;&gt; uniqueUriMap = new HashMap&lt;String, HashMap&lt;String, String&gt;&gt;(); for (HashMap&lt;String, String&gt; mapBeingProcessed : artEvents) { String uri_path = mapBeingProcessed.get("uri_path"); Double art = Double.parseDouble(mapBeingProcessed.get("avgRespT")); Integer count =Integer.parseInt(mapBeingProcessed.get("count")); if (uniqueUriMap.containsKey(uri_path)) { Double artFromMap = Double.parseDouble(uniqueUriMap.get(uri_path).get("avgRespT")); int countFromMap = Integer.parseInt(uniqueUriMap.get(uri_path).get("count")); count = count + countFromMap; art = ((art * count) + (artFromMap * countFromMap)) / count; } HashMap&lt;String, String&gt; newUriMap = new HashMap&lt;String, String&gt;(); newUriMap.put("uri_path",uri_path); newUriMap.put("avgRespT",String.valueOf(art)); newUriMap.put("count", String.valueOf(count)); uniqueUriMap.put(uri_path, newUriMap); } //result list. List&lt;HashMap&lt;String, String&gt;&gt; artProcessedEvents=new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); artProcessedEvents.addAll(uniqueUriMap.values()); The problem was with storing the temp values. This: if (processedMap.containsValue(uri_path)) always returned false as you initialized processedMap inside the loop.
answers question: http://stackoverflow.com/q/25434001
has comment: http://stackoverflow.com/comment/39685670
score: 0
has comment: http://stackoverflow.com/comment/39693873
has comment: http://stackoverflow.com/comment/39685760
type: Answer
has comment: http://stackoverflow.com/comment/39692298
has comment: http://stackoverflow.com/comment/39692610
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25434001

http://stackoverflow.com/comment/39617895
type: AnswerComment
comment on: http://stackoverflow.com/a/25398085
score: 1
has text: @b16db0 - You need to *recursively* make sure that all fields are final and references don't escape the scope. This will ensure immutability. For Strings, only *final* is enough as they are implicitly *immutable*.
type: Comment

http://stackoverflow.com/comment/39659058
type: QuestionComment
score: 0
has text: He didn't just dump code, he posted code with a specific problem, the line on which it was occurring and asked how to fix it...
comment on: http://stackoverflow.com/q/25422601
type: Comment

http://stackoverflow.com/comment/39831368
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25513019
has text: http://stackoverflow.com/a/25513639/900873
score: 1

http://stackoverflow.com/q/25506386
has answer: http://stackoverflow.com/a/25506560
has title: How to make this codes run.?
has body: public static void main(String[] args) { String sInput1; int iInput1, iInput2,iNum,iCards,iNumInCards; Random Numbers = new Random(); int Number[][] = new int[10][4]; int Cards[] = new int[10]; int Slots[] = new int[9]; for (int y=0;y&lt;=9;y++) { for (int z=0;z&lt;=3;z++) { iCards = y; iNumInCards = z; } } for (int i = 0; i &lt; 40; i++) { iNum = Numbers.nextInt(10) + 1; // yung iNum yung 40 random numbers } Number[iCards][iNumInCards] = iNum; System.out.println (Number[iCards][iNumInCards]); } I would like to get the iCards and iNumInCards for using them in the 2d array that I created. How do I do it?
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/39815281
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25506516
answer count: 2
tagged with: for-loop
upvote count: 2
has answer: http://stackoverflow.com/a/25506516
downvote count: 3
has comment: http://stackoverflow.com/comment/39815203
tagged with: string
accepted answer: http://stackoverflow.com/a/25506560
favorite count: 0
type: Question

http://stackoverflow.com/a/25433278
answers question: http://stackoverflow.com/q/25431087
has comment: http://stackoverflow.com/comment/39725829
has comment: http://stackoverflow.com/comment/39729641
upvote count: 6
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/39715098
downvote count: 2
has comment: http://stackoverflow.com/comment/39702969
has body: If you have HAL available it will be selected for you by spring boot (and "_links" is what you get with HAL). You should be able to @EnableHypermediaSupport manually to override the defaults.

http://stackoverflow.com/q/25449706
tagged with: string
has answer: http://stackoverflow.com/a/25449760
type: Question
has comment: http://stackoverflow.com/comment/39708917
type: UnansweredQuestion
has title: what is the date format of this string?
tagged with: simpledateformat
linked to: http://stackoverflow.com/q/2201925
tagged with: date
has answer: http://stackoverflow.com/a/25449776
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39708948
tagged with: java
has body: I want to parse this json string into date "startDateTime":"2014-08-10T20:08:45.0218Z" and then parse it to another date format. I thought using this: Gson gson = new GsonBuilder().setDateFormat("dd/MM HH:mm ???").create; but I'm not sure how what is the format of "2014-08-10T20:08:45.0218Z" is it yyyy-mm-dd ???
tagged with: gson

http://stackoverflow.com/a/25444187
upvote count: 1
has body: I'm not not sure that this will be of much help to you, but since I'm in the pretty much the same situation: Any way someone has to keep updating the WSDL file. Currently we discuss solution that this WSDL file can be included in build.x.x.x.jar (I have it included in my project too).
type: Answer
answers question: http://stackoverflow.com/q/25443864
score: 1
downvote count: 0

http://stackoverflow.com/comment/117976108
has text: Could you add text outside of your code snippet to explain what this code does?
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/66739876

http://stackoverflow.com/a/25406520
type: Answer
answers question: http://stackoverflow.com/q/25405440
score: 3
has comment: http://stackoverflow.com/comment/39629976
has comment: http://stackoverflow.com/comment/39655667
has comment: http://stackoverflow.com/comment/39637080
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has body: If you already have a JLabel in your component, you don't need to recreate one for each state change. Move that part to where you also add your comboBox: lblTesting = new JLabel(accNo1); lblTesting.setBounds(496, 49, 106, 22); frmAccountPayable.getContentPane().add(lblTesting); But with the default constructor. And instead of adding a new label each time, simply call: lblTesting.setText(accNo1); That being said, I guess that in your example you add new label, but only the first is displayed - depending on your layout.
accepted answer of: http://stackoverflow.com/q/25405440

http://stackoverflow.com/q/25443434
has answer: http://stackoverflow.com/a/25443499
accepted answer: http://stackoverflow.com/a/25443499
has comment: http://stackoverflow.com/comment/39697483
tagged with: android-event
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39697449
has answer: http://stackoverflow.com/a/25443530
possible better answer: http://stackoverflow.com/a/25443530
score: -1
type: Question
has body: I have imageView for play and stop and I have tried to implement OnClickListener. But the click event is not handled. Even if I try to start the application in debug mode then also I am not able to detect click event. What could be the error in this code ? public class DetailActivity extends ActionBarActivity implements OnClickListener { MediaPlayer mp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.details_activity); try { mp = MediaPlayer.create(this, R.raw.baabaa); mp.prepare(); } catch (Exception e) { e.printStackTrace(); } } @Override public void onClick(View v) { switch (v.getId()) { case R.id.stop: mp.stop(); break; case R.id.play: mp.start(); break; default: break; } } }
answer count: 2
has title: Android:OnClick Event not functioning
upvote count: 0
has comment: http://stackoverflow.com/comment/39697428
linked to: http://stackoverflow.com/q/4153517
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39697542
type: AnsweredQuestion

http://stackoverflow.com/comment/39716548
type: AnswerComment
has text: @redFIVE Im just saying he should consider size and memory availability. Furthermore, some data structures have different complexity which might make them more or less efficient with more or less data.
comment on: http://stackoverflow.com/a/25453147
score: 0
type: Comment

http://stackoverflow.com/a/25550411
has comment: http://stackoverflow.com/comment/39897551
upvote count: 3
answers question: http://stackoverflow.com/q/25549866
score: 3
has comment: http://stackoverflow.com/comment/39897767
type: Answer
has body: If I correctly inderstood problem why don't select value in first dropDown using webdriver, and then (after value in second changes) get value in second comboBox?! e.g. smth like //First click on first comboBox var dropDown = driver.findElement(By.Css("#aff_network_id")); dropDown.click(); //Select value from first dropDown dropDown.findElement(By.Css("option[value='1']")).click(); //after that value in second dropDown will be changed and you can get it's value driver.findElement(By.Css("#aff_campaign_id")).getAttribute('value');
downvote count: 0

http://stackoverflow.com/q/25399965
has title: Getting started with openid4java on XAMPP?
type: Question
type: UnansweredQuestion
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25400463
tagged with: openid
tagged with: xampp
tagged with: linux
tagged with: java
has body: Noob here trying to install openid4java so that I can create an OpenID provider. How should I start? I've downloaded openid4java, working with XAMPP and OpenSuse.

http://stackoverflow.com/a/25453444
type: AcceptedAnswer
has body: You can only call it directly, e.g. new HelloWorld() { // ... }.g2(); However, notice that you can't assign the variable and call it directly, and you can't call it elsewhere in the method. Still, this is the closest thing I could think of to answering your question.
has comment: http://stackoverflow.com/comment/39716590
has comment: http://stackoverflow.com/comment/140245848
accepted answer of: http://stackoverflow.com/q/25453209
type: Answer
answers question: http://stackoverflow.com/q/25453209
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/25543627
has title: Trusting all certificates in java Websocket client
has body: First of all, I'm aware of the possible risks of trusting all certificates, however for some test purposes I have to implement this. How can I force my client to trust all certificates? I'm implementing with javax.websocket All I've done is simply connecting to ws like WebSocketContainer client = ContainerProvider.getWebSocketContainer(); try { session = client.connectToServer(ClientImpl.class, URI.create(uri)); } catch (DeploymentException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); }
has answer: http://stackoverflow.com/a/28627150
tagged with: java
answer count: 1
tagged with: ssl
favorite count: 0
type: Question
upvote count: 4
type: UnansweredQuestion
downvote count: 0
tagged with: websocket
tagged with: java-websocket
score: 4

http://stackoverflow.com/q/25415225
has body: I have a native C++ application that uses Java library, in a bunch of jar files, via JNI. There's now an issue as to how to distribute the application to a third party without compromising security. We're worried that jar files can be reverse engineered easily. After digging around, I found one solutions for this problem is to use an AOT Java compiler suggested here. If I use the AOT Java compiler and make a native lib file, will I still be able to use JNI to call the Java methods the same way I'm doing now with jar files.
score: -2
tagged with: java-native-interface
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39646687
accepted answer: http://stackoverflow.com/a/25415799
has title: Using compiled java code in a native application
upvote count: 0
tagged with: java
downvote count: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39646411
type: Question
has answer: http://stackoverflow.com/a/25415799

http://stackoverflow.com/a/25476299
score: 0
accepted answer of: http://stackoverflow.com/q/25475989
has comment: http://stackoverflow.com/comment/39759097
has comment: http://stackoverflow.com/comment/39764698
type: AcceptedAnswer
type: Answer
has body: In your main activity's onCreate method, after your last line add: list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapter, View v, int position, long id) { HashMap&lt;String,String&gt; item = (HashMap&lt;String,String&gt;) adapter.getItem(position); Intent intent = new Intent(this, YourSecondActivity.class); intent.putExtra("TAG_ID_RS", item.get("TAG_ID_RS")); intent.putExtra("TAG_NAMA_RS", item.get("TAG_NAMA_RS")); ...... startActivity(intent); } }); In the YourSecondActivity.java there goes something like: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_yoursecondactivity); Intent i = getIntent(); //now your item data are in i String TAG_ID_RS = i.getString("TAG_ID_RS"); String TAG_NAMA_RS = i.getString("TAG_NAMA_RS"); .... TextView namaView = (TextView)findViewById(R.id.yourNameView); namaView.setText(TAG_NAMA_RS); .... } For your intent receiving activity you need to define an intent filter in the manifest file: &lt;activity android:name="SingleMenuItemActivity"&gt; &lt;intent-filter&gt; &lt;action android:name="yourpackage.intent.action.showsinglemenuitem"/&gt; &lt;/intent-filter&gt; &lt;/activity&gt; Use the "yourpackage.intent.action.showsinglemenuitem" action name when constructing the INTENT to be p I think I found out your problem finally: In your MainActivity you define your field names as for example: public static final String TAG_NAMA_RS = "nama_rs"; and you fill them with that name into the Intent, but in your SingleMenuItemActivity you are trying to access them with different name: String TAG_NAMA_RS = i.getStringExtra("TAG_NAMA_RS"); you need to do String TAG_NAMA_RS = i.getStringExtra("nama_rs");
has comment: http://stackoverflow.com/comment/39773710
answers question: http://stackoverflow.com/q/25475989
has comment: http://stackoverflow.com/comment/39759255
has comment: http://stackoverflow.com/comment/39759807

http://stackoverflow.com/comment/39805955
has text: You should check and print the null value before you assign to it, otherwise that element won't be null when you check it the second time.
comment on: http://stackoverflow.com/q/25501549
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25516145
type: Question
has body: I have the following interface: public interface ISort&lt;T extends Comparable&lt;T&gt;&gt; { public void sort(T[] array); } My understanding of this is that the the &lt;T extends Comparable&lt;T&gt;&gt; tells the compiler that within this class, there may be some generic types T, and they must be a Comparable&lt;T&gt; or be any class which implements Comparable&lt;T&gt;. I then have the following class: public class Sort&lt;T extends Comparable&lt;T&gt;&gt; implements ISort&lt;T&gt; { public void swap(T[] array, int i, int j) { T temp = array[i]; array[i] = array[j]; array[j] = temp; } public void sort(T[] array) { java.util.Arrays.sort(array); } } Again, I have the &lt;T extends Comparable&lt;T&gt;&gt; telling the compiler that within this class I will be using the type T which must form an IS-A relationship with Comparable&lt;T&gt;. However, why must I only type implements ISort&lt;T&gt;, why do I not need to write implements ISort&lt;T extends Comparable&lt;T&gt;&gt;? In order to help me understand this could you explain what exactly these generics statements are inferring to the compiler?
score: 3
tagged with: extends
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25516200
has title: Java Generics - Specifying upper bound on a class implementing an interface which itself specifies an upper bound
has answer: http://stackoverflow.com/a/25516202
has answer: http://stackoverflow.com/a/25516204
answer count: 3
upvote count: 3
tagged with: implements
tagged with: java
downvote count: 0
tagged with: generics
favorite count: 0

http://stackoverflow.com/comment/39918160
comment on: http://stackoverflow.com/q/25499207
score: 0
type: Comment
type: QuestionComment
has text: @PratikButani, I have tried as you said but it is not helping

http://stackoverflow.com/comment/39676902
has text: Does the content of the first 1016 bytes change at second write? Not needed to delete an existing file first. Does deleting succeede? Check the return value of write().
comment on: http://stackoverflow.com/q/25431871
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25452940
tagged with: optimization
tagged with: replace
has comment: http://stackoverflow.com/comment/39715438
answer count: 2
has comment: http://stackoverflow.com/comment/39715479
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25453147
upvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/39715481
has answer: http://stackoverflow.com/a/25453076
has title: Most efficient way to replace many (5000+) strings in a .txt file
has body: Using a general-purpose programming language like Java, what is the most efficient way to search through a ~20 page document to replace a set of 5000+ strings with some predetermined replacement string? The program should not replace any strings that have already been replaced. What data structure would be optimal to store the 5000+ strings and each of their replacements - two arrays, a dictionary, or something else? Here are some of the options that I have considered so far: Iterate through the entire .txt document once time per string using string.replace. The problem is that the algorithm must iterate through the entire .txt document an extra time for each string stored. Iterate through the .txt once while replacing string as necessary while creating a new string by appending replacements. This seems more efficient, but each step would still require checking the entire set of 5000+ strings for any strings to replace. Is there a more optimized means of solving this problem, or is one of the above attempts already optimal? Also, would it be possible to run this algorithm more efficiently in a lower-level language like C?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39715492
has comment: http://stackoverflow.com/comment/39715488
has comment: http://stackoverflow.com/comment/39715480
has comment: http://stackoverflow.com/comment/39715440
has comment: http://stackoverflow.com/comment/39715617
has comment: http://stackoverflow.com/comment/39715406
has comment: http://stackoverflow.com/comment/39715475
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/39724839
linked to: http://stackoverflow.com/q/4385623
has comment: http://stackoverflow.com/comment/39715450
has comment: http://stackoverflow.com/comment/39715574
has comment: http://stackoverflow.com/comment/39716071
tagged with: regex
has comment: http://stackoverflow.com/comment/39715571

http://stackoverflow.com/q/25520477
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25520787
has comment: http://stackoverflow.com/comment/40010570
has body: I am searching for more hours now with no result. Please help... This is my class to test: public class DBSelectSchema extends Database { private static final Logger LOG = Logger .getLogger(DBSelectSchema.class.getName()); private Connection conn = null; public DBSelectSchema() { super(); } /** * This method will return the version of the database. * * @return version * @throws Exception */ public JSONObject getVersionFromDB() throws SQLException { ResultSet rs = null; JSONObject version = new JSONObject(); PreparedStatement query = null; try { conn = mensaDB(); query = conn.prepareStatement("SELECT number FROM version"); rs = query.executeQuery(); if (rs.isBeforeFirst()) { rs.next(); version.put(HTTP.HTTP, HTTP.OK); version.put("version", rs.getString("number")); } else { version.put(HTTP.HTTP, HTTP.NO_CONTENT); version.put(HTTP.ERROR, "Die SQL Abfrage lieferte kein Result!"); } rs.close(); query.close(); conn.close(); } catch (SQLException sqlError) { String message = ERROR.SQL_EXCEPTION; LOG.log(Level.SEVERE, message, sqlError); return version; } catch (JSONException jsonError) { String message = ERROR.JSON_EXCEPTION; LOG.log(Level.SEVERE, message, jsonError); return version; } return version; } I am trying to get in each branch for 100% code coverage. How can I mock ResultSet rs, JSONObject version and PreparedStatement query to do/return what I want: Currently I am testing like that: @Test public void getVersionFromDB_RS_FALSE() throws SQLException, JSONException { MockitoAnnotations.initMocks(this); Mockito.when(dbSelMocked.mensaDB()).thenReturn(conn); Mockito.when(conn.prepareStatement(Mockito.anyString())).thenReturn(query); Mockito.when(query.executeQuery()).thenReturn(rs); Mockito.when(rs.isBeforeFirst()).thenReturn(false); JSONObject returnObj = dbSelMocked.getVersionFromDB(); assert(...); } But this just works when the 3 variables are class variables (like Connection conn) and not local variables. But I dont want them (even Connection) not to be global. …
linked to: http://stackoverflow.com/q/780614
score: 2
answer count: 3
downvote count: 0
has title: Junit Mockito test everything
tagged with: java
tagged with: junit
has answer: http://stackoverflow.com/a/33527119
favorite count: 0
has answer: http://stackoverflow.com/a/25520850
type: Question
upvote count: 2
tagged with: testing
tagged with: code-coverage
tagged with: mockito

http://stackoverflow.com/q/25432610
downvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/39678001
has answer: http://stackoverflow.com/a/25433311
favorite count: 0
has title: Generics and varargs java
type: Question
tagged with: interface
score: 3
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/39677942
has comment: http://stackoverflow.com/comment/39679447
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39683878
has comment: http://stackoverflow.com/comment/39678050
tagged with: generics
has comment: http://stackoverflow.com/comment/39677907
tagged with: variadic-functions
has comment: http://stackoverflow.com/comment/39678489
has body: Below is my set up public interface Test&lt;T extends MyInterface&gt; { someMethod(T... a) } public class TestImpl implements Test&lt;MyInterfaceImpl&gt; { someMethod(MyInterfaceImpl... a) } public class MyInterfaceImpl implements MyInterface {} public someClass { @Autowired TestFactory testfactory ...... // getting an error -- Type mismatch Can't assign non-array value to an array testfactory.getTest(Type type).someMethod(new MyInterfaceImpl()) } public class TestFactoryImpl implements TestFactory { Test getTest(Type type) { return registry.get(type)}} which in turn is results in java.lang.ClassCastException: [Lcom.test.MyInterface; cannot be cast to [Lcom.test.Impl.MyInterfaceImpl; but the below works testfactory.getTest(Type type).someMethod(new MyInterfaceImpl[]{new MyInterfaceImpl()}) Not sure what is happening. Help please
has comment: http://stackoverflow.com/comment/39680866
has answer: http://stackoverflow.com/a/25433207

http://stackoverflow.com/a/25451152
has comment: http://stackoverflow.com/comment/39712827
has body: Well I am not sure if I got you but what about just adding another parameter to your listener callback method? Like this: BaseSwipeListViewListener myBaseSwipeListViewListener = new BaseSwipeListViewListener(){ @Override public void onOpened(int position, boolean toRight, SwipeListView swipeListView) { //Here you now have your calling swipelistview } } In your BaseSwipeListViewListener now just add the third parameter by returning itself (this). Update: I did not know that it is a library. This is not what I would do but if you don't want to edit the source just do the following: BaseSwipeListViewListener myBaseSwipeListViewListener0 = new BaseSwipeListViewListener() { @Override public void onOpened(int position, boolean toRight) { onOpenedAdvanced(position, toRight, swipelistview0); } } BaseSwipeListViewListener myBaseSwipeListViewListener1 = new BaseSwipeListViewListener() { @Override public void onOpened(int position, boolean toRight) { onOpenedAdvanced(position, toRight, swipelistview1); } } BaseSwipeListViewListener myBaseSwipeListViewListener2 = new BaseSwipeListViewListener() { @Override public void onOpened(int position, boolean toRight) { onOpenedAdvanced(position, toRight, swipelistview0); } } public void onOpenedAdvanced(int position, boolean toRight, SwipeListView swipeListView){ //Here you now have your calling swipelistview } swipelistview0.setSwipeListViewListener(myBaseSwipeListViewListener0); swipelistview1.setSwipeListViewListener(myBaseSwipeListViewListener1); swipelistview2.setSwipeListViewListener(myBaseSwipeListViewListener2);
has comment: http://stackoverflow.com/comment/39712678
has comment: http://stackoverflow.com/comment/39712623
has comment: http://stackoverflow.com/comment/39712786
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25450877
downvote count: 0
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25450877
has comment: http://stackoverflow.com/comment/39712352

http://stackoverflow.com/q/25460409
answer count: 2
tagged with: hashmap
tagged with: android
has comment: http://stackoverflow.com/comment/39729964
accepted answer: http://stackoverflow.com/a/25460708
has comment: http://stackoverflow.com/comment/39730240
tagged with: arraylist
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25460478
tagged with: java
has title: How to get ArrayList from Hashmap<String String>
has body: Here I have fetched data from server/json and populated my ArrayList ArrayList&lt;HashMap&lt;String, String&gt;&gt; newsUpdateList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); private static final String TAG_NEWSCAPTION = "caption"; private static final String TAG_NEWSDATE = "date"; HashMap&lt;String, String&gt; newsUpdate = new HashMap&lt;String, String&gt;(); //adding each child node to HashMap key =&gt; value newsUpdate.put(TAG_NEWSCAPTION, newsCaption); newsUpdate.put(TAG_NEWSDATE, newsDate); newsUpdateList.add(newsUpdate); Somewhere else (within my Adapter Class), I want to populate a ListView using this data, and i get the data like: HashMap&lt;String, String&gt; newsItem = newsUpdateList.get(position); And then in building the individual List items, I have two TextViews in which i have to load the news caption, and news date. TextView caption = (TextView) v.findViewById(R.id.newsCaption); TextView date = (TextView) v.findViewById(R.id.newsDate); Here's the problem, what is the proper way the extract the caption and date from the HashMap&lt;String, String&gt; newsItem Any ideas, ...new to JAVA and Android :)
has answer: http://stackoverflow.com/a/25460478
linked to: http://stackoverflow.com/q/18683130
type: Question
has answer: http://stackoverflow.com/a/25460708
has comment: http://stackoverflow.com/comment/39729873

http://stackoverflow.com/q/25546306
score: -1
has answer: http://stackoverflow.com/a/25546432
answer count: 4
favorite count: 0
type: Question
upvote count: 0
type: UnansweredQuestion
has body: I'm new in JavaFx but have good knowledge in Java. Now basically I'm learning at the moment with this program: package com.lesson; import javafx.stage.Stage; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.control.TitledPane; import javafx.scene.control.Button; import javafx.scene.control.Accordion; public class MyProgram extends Application{ public static void main(String[] args){ launch(args); } @Override public void start(Stage primaryStage){ primaryStage.setTitle("My anme is rajedra"); Group group=new Group(); Scene s=new Scene(group, 400, 400, Color.web("0x0001FF", 1.0)); TitledPane tp1=new TitledPane("T1", new Button("B1")); TitledPane tp2=new TitledPane("T2", new Button("b2")); TitledPane tp3=new TitledPane("T3", new Button("b3")); TitledPane tp4=new TitledPane("T4", new Button("b4")); Accordion accordion=new Accordion(); accordion.getPanes().addAll(tp1, tp2, tp3); group.getChildren().add(accordion); primaryStage.setScene(s); primaryStage.show(); } } But don't understand exactly what Color.web("0x0001FF", 1.0) here? I found background color shows Blue After running this program. But I haven't typed any blue or any Code which tends to show. Now what's that mean here please help. Help would be appreciated! :) Thanks
has answer: http://stackoverflow.com/a/25546388
has answer: http://stackoverflow.com/a/25546409
has title: What is Color.web("0x0001FF", 1.0) and why i'm getting blue color in background?
has answer: http://stackoverflow.com/a/25546426
tagged with: java
tagged with: javafx
downvote count: 1

http://stackoverflow.com/comment/39797157
comment on: http://stackoverflow.com/q/25496568
has text: @arielnmz because the `returnedDate` is in second, I assumed.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/39704546
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25447175
score: 0
has text: Also note that I mentioned the file is being parsed in the question. This makes me think that Boot `sees` it.

http://stackoverflow.com/a/25537975
type: AcceptedAnswer
downvote count: 0
has body: Is there any performance difference for either way? Yes - the second is marginally slower, due to a pointless instance being constructed. I know the first way of doing it here is accessing it properly. But the second way only instantiates the util object once as opposed to three times. No, the second way creates one instance of Util whereas the first way doesn't create any instances. The first way is significantly better, because it makes it clear that it is a static method. Consider this code: Thread t = new Thread(someRunnable); t.start(); t.sleep(1000); What does it look like that last call does? Surely it makes the new thread sleep, right? No... it just calls Thread.sleep(), which only ever makes the current thread sleep. When you mangle a static method call to act "through" a reference, the value of the reference is completely ignored - it can even be null: Util util = null; util.method1(); // This will still work...
has comment: http://stackoverflow.com/comment/39879670
has comment: http://stackoverflow.com/comment/39875014
score: 12
answers question: http://stackoverflow.com/q/25537944
type: Answer
upvote count: 12
accepted answer of: http://stackoverflow.com/q/25537944

http://stackoverflow.com/comment/40054488
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25463773
type: Comment
has text: send me your code and the data file to logumohan@gmail.com. I will fix it and send the code back to you

http://stackoverflow.com/q/25541697
has answer: http://stackoverflow.com/a/25541962
has comment: http://stackoverflow.com/comment/39879958
has title: java.lang.NoSuchMethodError: org.apache.tomcat.util.ExceptionUtils.unwrapInvocationTargetException
type: Question
tagged with: exception
has body: The code is not written by me, so I am not able to give proper input for question ;), but still want to know the cause of the exception in general. :) I have installed OpenCRX CRM, and when I run, the following exception is thrown, SEVERE: Begin event threw error java.lang.NoSuchMethodError: org.apache.tomcat.util.ExceptionUtils.unwrapInvocationTargetException(Ljava/lang/Throwable;)Ljava/lang/Throwable; at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:184) at org.apache.catalina.core.AprLifecycleListener.isAprAvailable(AprLifecycleListener.java:83) at org.apache.catalina.connector.Connector.setProtocol(Connector.java:592) at org.apache.catalina.connector.Connector.(Connector.java:66) at org.apache.catalina.startup.ConnectorCreateRule.begin(ConnectorCreateRule.java:62) at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1282) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:507) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1323) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2750) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:828) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:757) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:133) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1211…
has comment: http://stackoverflow.com/comment/39879875
has answer: http://stackoverflow.com/a/54590076
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: java
tagged with: apache

http://stackoverflow.com/comment/39798624
comment on: http://stackoverflow.com/q/25497421
score: 0
has text: Why is `i` `static`?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25405435
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25419475
tagged with: java
tagged with: jtds
answer count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25419475
has body: I am persisting BigDecimal to MS SQL Server using OpenJPA and the JTDS driver. I have specified the column definition like this: @Column(precision = 22, scale = 4) private BigDecimal initialFee; If I drop the table and get OpenJPA to create it then it looks like this in SQL server: Column_name Type Computed Length Prec Scale initialFee numeric no 9 18 0 Here is the persistence.xml: <?xml version="1.0" encoding="UTF-8"?> org.apache.openjpa.persistence.PersistenceProviderImpl java:jboss/datasources/Core ... <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> <property name="jboss.as.jpa.providerModule" value="org.apache.openjpa"/> <property name="openjpa.DynamicEnhancementAgent" value="false"/> <property name="openjpa.Log" value="File=stdout, DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=INFO"/> <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.SQLServerDictionary"/> How can I specify the scale and precision for SQL server?
tagged with: openjpa
has title: JTDS Ignoring OpenJPA scale annotation on BigDecimal
tagged with: sql-server

http://stackoverflow.com/q/25484733
has body: being new to mysql I start learning how to use mysql workbench and by mistake I removed default schemas like sakila and other using mysql workbench, So How Can I restore them back again. thanks
type: UnansweredQuestion
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/25485439
has answer: http://stackoverflow.com/a/25484805
score: 0
answer count: 2
tagged with: sql
has title: how to restore mysql default schemas like sakila
tagged with: mysql
type: Question

http://stackoverflow.com/q/25540739
score: 0
tagged with: interface
tagged with: java
has comment: http://stackoverflow.com/comment/39878312
type: Question
has comment: http://stackoverflow.com/comment/39878286
has comment: http://stackoverflow.com/comment/39878317
answer count: 0
has body: I have an interface say Foo interface Foo { } and an implementation say FooImpl class FooImpl implements Foo { } My requirement is to convert Foo[] to ArrayList&lt;FooImpl&gt; Anyone have a quick solution? Thanks.
type: UnansweredQuestion
tagged with: arrays
has comment: http://stackoverflow.com/comment/39878257
has comment: http://stackoverflow.com/comment/39878376
tagged with: arraylist
has title: How to convert interface[] to List<implementation> in java?

http://stackoverflow.com/q/25461595
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25461712
has title: Add background into JPANEL in JAVA Eclipse
tagged with: jpanel
tagged with: swing
has body: I tried to add background image from internet into my JPanel, but there is source only for add JFrame background and don't have any source for add JPanel background. Please Help. I tried the Image image= ImageIO.read(new File("resources/2.png")); also but still failed. My Jpanel Code: contentPane = new JPanel(); contentPane.setBackground(new Color(32, 178, 170)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null);;
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25461712
score: 0
tagged with: java
answer count: 1
tagged with: layout-manager
upvote count: 1
downvote count: 1

cdi
type: Tag
tags question: http://stackoverflow.com/q/25401435
tag name: cdi
tags question: http://stackoverflow.com/q/25395443
tags question: http://stackoverflow.com/q/25391037
tags question: http://stackoverflow.com/q/25396614
tags question: http://stackoverflow.com/q/25488277

http://stackoverflow.com/comment/39642337
comment on: http://stackoverflow.com/q/25409362
has text: You've got cast exception for ISession to IDfSession object trying to get mocked object for getBatchManager method? I'm not that much experienced with mock object frameworks but I assume you made some beginners mistake. Can you please provide more details?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40419376
type: AnswerComment
has text: @cocorossello That's actually exactly what I did. The initial run I just let it be called multiple times and (while expensive) wasn't terrible. When I did a load test is when it became noticeable. After that I switched the handling and made sure it was only called once. Everything behaved tremendously better.
type: Comment
comment on: http://stackoverflow.com/a/25448419
score: 0

http://stackoverflow.com/a/25424682
has body: Those are normal. You will get those any time your code references some class that does not exist on the API level that your app is running on. However, so long as the code does not actually execute the Java statements that references a missing class, everything is fine.
has comment: http://stackoverflow.com/comment/39684001
has comment: http://stackoverflow.com/comment/39663794
has comment: http://stackoverflow.com/comment/39684551
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39684928
answers question: http://stackoverflow.com/q/25416731
has comment: http://stackoverflow.com/comment/39665500
has comment: http://stackoverflow.com/comment/39664077
has comment: http://stackoverflow.com/comment/39684126
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39665858

listactivity
tags question: http://stackoverflow.com/q/25426296
tags question: http://stackoverflow.com/q/25424045
type: Tag
tag name: listactivity

http://stackoverflow.com/q/25420437
has comment: http://stackoverflow.com/comment/39750329
has comment: http://stackoverflow.com/comment/39692516
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/39678181
has title: IntelliJ Idea: Column of entity class cannot be resolved
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39692459
has body: I have setup a multi-module java project in intellij idea (version 13.1.4), seperating the different application layers in different modules. It uses hibernate on top of jpa for the persistence layer. Amongst others there is a core module that contains the configuration of the persistence unit. I have already set up the required facades (jpa, hibernate) as well as the database connection and the persistence mapping to the datasource. IntelliJ recognizes database queries for an instance quite well. Even in modules that have no persistence mapping of their own. Now for the problem. I have another module that holds all the entities used for the object-relational-mapping. For an instance: @Entity public class SomeEntity { @Id @GeneratedValue @Column(name = "column_name") private Long entityId; } IntelliJ shows a validation error stating that it cannot resolve the database column even though it definitely exists. I can as well browse it in the database view. This goes for the other fields as well. Im sure I must have setup something wrong. Any ideas?
has comment: http://stackoverflow.com/comment/39676766
type: UnansweredQuestion
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/39705258
has comment: http://stackoverflow.com/comment/39678171

http://stackoverflow.com/comment/39748898
type: Comment
score: 0
type: AnswerComment
has text: @user3970513 Edited - added some explanation tho the semaphore example.
comment on: http://stackoverflow.com/a/25470257

http://stackoverflow.com/q/25467063
score: 0
has title: TableRow weights scaling opposite of what I expect when using GraphView in my Android java app
tagged with: android
tagged with: java
answer count: 1
has body: I've created the following layout xml-file: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="some.package.MainActivity" &gt; &lt;TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TableRow android:id="@+id/mainRow" android:layout_weight="1" &gt; &lt;FrameLayout android:id="@+id/mainLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" /&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/footerRow" android:layout_weight="1" &gt; &lt;FrameLayout android:id="@+id/footerLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/RelativeLayout&gt; ... and populate it with graphs from the GraphView api as follows: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); int[] assetLayouts = new int[]{ R.id.mainLayout, R.id.footerLayout, }; int count = 0; for (int assetLayout :assetLayouts ) { GraphViewSeries exampleSeries = new GraphViewSeries(new GraphViewData[] { new GraphViewData(1, 2.0d) , new GraphViewData(2, 1.5d) , new GraphViewData(3, 2.5d) , new GraphViewData(4, 1.0d) }); GraphView graphView = new LineGraphView(this, "" + ++count); graphView.addSeries(exampleSeries); FrameLayout layout = (FrameLayout) findViewById(assetLayout); layout.addView(graphView); } } This behaves as expected and divides the screen in two parts, with one graph taking up the first top half, and the second one taking up the other bottom half. Now,…
type: Question
has answer: http://stackoverflow.com/a/25467117
tagged with: android-layout
tagged with: layout
type: UnansweredQuestion
tagged with: android-tablelayout

http://stackoverflow.com/comment/39613166
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25397879
has text: its too old question, google it

http://stackoverflow.com/q/25412364
tagged with: java
has title: "java.net.SocketException: Software caused connection abort: socket write error" on streaming multidimensional array
score: 1
upvote count: 1
duplicate of: http://stackoverflow.com/q/2126607
tagged with: dataoutputstream
favorite count: 0
type: Question
type: UnansweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/2126607
tagged with: serversocket
answer count: 0
has body: I'm making a server application which streams a multidimensional array. But when it should start streaming, i'm getting a socket write error. Here's the code: Part 1 public class Server { ServerSocket server; DataInputStream quitDis; int port = 8090; DataInputStream dis; DataOutputStream dos; Socket socket = null; public Server(){ quitDis = new DataInputStream(System.in); try{ System.out.println("Server starting..."); server = new ServerSocket(port); System.out.println("Server started. It runs on IP: " + Inet4Address.getLocalHost().getHostAddress() +" Port: "+ port); } catch (IOException e){ System.out.println("Port is used"); } try { while(quitDis.available() == 0){ socket = server.accept(); System.out.println("Anfrage von " + socket.getInetAddress().getHostAddress()); dis = new DataInputStream(socket.getInputStream()); dos = new DataOutputStream(socket.getOutputStream()); int request = dis.readInt(); if(request == 1){ System.out.println("Transmitting matrix 1"); new sendArray(dos, matrix1); }else if(request == 2){ System.out.println("Transmitting matrix 2"); new sendArray(dos, matrix2); }else if(request == 3){ System.out.println("Transmitting matrix 3"); new sendArray(dos, matrix3); }else if(request == 4){ System.out.println("Transmitting matrix 4"); new sendArray(dos, matrix4); }else if(request == 5) { System.out.println("Transmitting matrix 5"); new sendArray(dos, matrix5); } else{ System.out.println("Invalid request"); System.out.println("Request: " + request); } System.out.println("Reuest has been proccessed. Waiting for new requests"); } System.out.println("Server stopped"); } catch (IOException e) { e.printStackTrace(); } try { dis.close(); } catch (IOException e) { e.printStackTrace(); } } } Part 2 import java.io.DataOutputStream; import java.io.IOException; public class sendArray { int x; int y; DataOutputStream dos = null; public sendArray(DataOutputStream dos,boolean[][] matrix) throws IOException { this.dos = dos; for(x = 0; x &lt;= 4; x++){ for(y = 0;y…

http://stackoverflow.com/comment/39829127
comment on: http://stackoverflow.com/a/25513809
type: Comment
has text: __There is no other way, other than using ternary.__ At least this looks cleaner.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25483483
has title: Unexpected behavior when assigning JSP getparameters to an array
type: UnansweredQuestion
tagged with: jsp
score: 0
has answer: http://stackoverflow.com/a/25483619
tagged with: java
answer count: 1
has body: Can someone please explain the following issue when I assign the results of request.getParameters to two different string array objects : I assign the values of getParameterValues to two different string arrays I then update the contents of one string array. When I check the values of the other string array, they have also been changed. // pseudo code below // assign the values of getParameterValues to a string array String[] obj1 = request.getParameterValues("some_parameters"); // assign the values of getParameterValues to another string array String[] obj2 = request.getParameterValues("some_parameters"); // loop through the values of obj1 and update them for(int i=0; i&lt; obj1 .length; i++) { obj1[i] = obj1[i] + " UPDATED VALUE"; } for(int i=0; i&lt; obj2 .length; i++) { // output values in obj2 array // THESE HAVE BEEN UPDATED - WHY ? } Secondly, I run this code in the form of a JSP page running under Tomcat. We have two servers and this behavior was only exhibited one one of the Tomcat servers - i.e. on one Tomcat server, changing one string array did not affect the other. Is there a Tomcat setting which could explain this behavior ? Many thanks in advance for your feedback !
type: Question

http://stackoverflow.com/a/25455559
answers question: http://stackoverflow.com/q/25455545
downvote count: 0
upvote count: 1
score: 1
type: Answer
has body: Write a recursive method which will call itself when it encounters that the entry to corresponding key is a map.

computer-vision
tags question: http://stackoverflow.com/q/25529557
type: Tag
tag name: computer-vision
tags question: http://stackoverflow.com/q/25466319

http://stackoverflow.com/comment/39775373
type: QuestionComment
comment on: http://stackoverflow.com/q/25485271
score: 0
type: Comment
has text: To me, case 2 is more clearer, i was just thinking if there is any downside of using case 2?

http://stackoverflow.com/q/25420136
has title: The best way to check if List<String[]> contains a String[]
has comment: http://stackoverflow.com/comment/39662183
answer count: 4
score: 8
has comment: http://stackoverflow.com/comment/39654879
linked to: http://stackoverflow.com/q/16218863
possible better answer: http://stackoverflow.com/a/25420952
accepted answer: http://stackoverflow.com/a/25420258
duplicate of: http://stackoverflow.com/q/16218863
downvote count: 2
has answer: http://stackoverflow.com/a/25420404
tagged with: arrays
has comment: http://stackoverflow.com/comment/39654362
has comment: http://stackoverflow.com/comment/39654905
tagged with: string
has comment: http://stackoverflow.com/comment/39696877
has answer: http://stackoverflow.com/a/25420690
tagged with: collections
has comment: http://stackoverflow.com/comment/39654718
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39654419
has comment: http://stackoverflow.com/comment/39654496
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25420952
has comment: http://stackoverflow.com/comment/39654550
has body: I have a List declared as: List&lt;String[]&gt; arrayList = new ArrayList&lt;&gt;(); This List contains multiple arrays of Strings. I need to check if a String[] which I have is contained in this ArrayList&lt;String[]&gt;. I am currently iterating through the ArrayList and comparing each String[] with the one I am searching for: for(String[] array: arrayList){ if(Arrays.equals(array, myStringArray)){ return true; } } return false; Is there any better way to check if an ArrayList&lt;String[]&gt; contains a specific String[]?
has answer: http://stackoverflow.com/a/25420258
tagged with: java
upvote count: 10
has comment: http://stackoverflow.com/comment/39654395
has comment: http://stackoverflow.com/comment/39668952
has comment: http://stackoverflow.com/comment/39665459
has comment: http://stackoverflow.com/comment/39699198
has comment: http://stackoverflow.com/comment/39654473
has comment: http://stackoverflow.com/comment/39654673

http://stackoverflow.com/comment/39677374
score: 0
has text: Sorry I didnot get you.
type: Comment
comment on: http://stackoverflow.com/a/25428524
type: AnswerComment

http://stackoverflow.com/comment/39660793
type: QuestionComment
comment on: http://stackoverflow.com/q/25423148
score: 0
has text: Can you provide a few more details on the dynamic nature of the property? Is going to come from a system variable? A properties file?
type: Comment

http://stackoverflow.com/comment/39802610
score: 0
comment on: http://stackoverflow.com/q/25499253
type: Comment
type: QuestionComment
has text: @pratik My server side path is correct.

http://stackoverflow.com/comment/39852188
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25526734
score: 2
has text: Are you sure `a` is not null? and error is not on `String.valueOf(a)`?

http://stackoverflow.com/q/25404594
has comment: http://stackoverflow.com/comment/39625930
has body: I am trying to understand java treeviews. I created a Treeviewer with the following tutorial: http://www.eclipse.org/articles/Article-TreeViewer/TreeViewerArticle.htm Now I have a problem that I can´t solve :/ I want to expand the book-objects with another object. For example: + BookTitleX BookAuthorX etc otherobjectname etc etc etc How can I add an object to an object ? Thank u so much This is the code: Content Provider: import java.util.Iterator; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; public class ContentProvider implements ITreeContentProvider, IDeltaListener { private static Object[] EMPTY_ARRAY = new Object[0]; protected TreeViewer viewer; /* * @see IContentProvider#dispose() */ public void dispose() {} public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { this.viewer = (TreeViewer)viewer; if(oldInput != null) { removeListenerFrom((MovingBox)oldInput); } if(newInput != null) { addListenerTo((MovingBox)newInput); } } /** Because the domain model does not have a richer * listener model, recursively remove this listener * from each child box of the given box. */ protected void removeListenerFrom(MovingBox box) { box.removeListener(this); for (Iterator iterator = box.getBoxes().iterator(); iterator.hasNext();) { MovingBox aBox = (MovingBox) iterator.next(); removeListenerFrom(aBox); } } /** Because the domain model does not have a richer * listener model, recursively add this listener * to each child box of the given box. */ protected void addListenerTo(MovingBox box) { box.addListener(this); for (Iterator iterator = box.getBoxes().iterator(); iterator.hasNext();) { MovingBox aBox = (MovingBox) iterator.next(); addListenerTo(aBox); } } public Object[] getChildren(Object parentElement) { if(parentElement instanceof MovingBox) { MovingBox box = (MovingBox)parentElement; return concat(box.getBoxes().toArray(), box.getBooks().toArray(), box.getGam…
type: Question
tagged with: expand
has comment: http://stackoverflow.com/comment/39626942
type: UnansweredQuestion
tagged with: swt
has answer: http://stackoverflow.com/a/25405688
tagged with: jface
has title: How to expand an object in a Treeviewer?
tagged with: treeviewer
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39691115
comment on: http://stackoverflow.com/q/25426187
type: QuestionComment
has text: Yes, in case you have different one you can resample using sox.
score: 0
type: Comment

http://stackoverflow.com/comment/39745334
score: 0
has text: @user465342 Updated with an alternative solution, which is not plain java, but uses a method reference.
type: Comment
comment on: http://stackoverflow.com/a/25468763
type: AnswerComment

http://stackoverflow.com/comment/39740400
comment on: http://stackoverflow.com/q/25466182
score: 1
type: Comment
has text: The above doesn't work because you have to send the parameters as content of body of the request. Please provide the code you're using to start the request, otherwise this question is not Java at all.
type: QuestionComment

http://stackoverflow.com/a/25503571
answers question: http://stackoverflow.com/q/25503454
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/39884379
has comment: http://stackoverflow.com/comment/39809576
type: Answer
accepted answer of: http://stackoverflow.com/q/25503454
downvote count: 0
type: AcceptedAnswer
has body: getDeclaredFields() (or any other method of java.lang.Class for that matter) returns the compile-time data that's available for the class - it cannot return data based on a specific instance you're using. What you could do is simply retrieve the instance you're holding and query its type: System.out.println(a.property.getClass()); EDIT: To address the comments, this can also be done by reflection, but would still have to address a specific instance: for (Field f : a.getClass().getDeclaredFields()) { Class&lt;?&gt; cls = f.get(a).getClass(); System.out.println (f.getName() + " is set with a concrete class of " + cls.getName()); }

http://stackoverflow.com/q/25508655
type: Question
score: -5
has body: Apache] Problem detected! Apache] Port 80 in use by "Unable to open process" with PID 4! Apache] Apache WILL NOT start without the configured ports free! Apache] You need to uninstall/disable/reconfigure the blocking application Apache] or reconfigure Apache and the Control Panel to listen on a different port How can I solve the above problem?
upvote count: 0
type: UnansweredQuestion
has title: Port 80 unable to open process
has comment: http://stackoverflow.com/comment/39819481
has answer: http://stackoverflow.com/a/25508718
has answer: http://stackoverflow.com/a/25509104
favorite count: 0
tagged with: java
downvote count: 5
answer count: 4
has answer: http://stackoverflow.com/a/38934763
has answer: http://stackoverflow.com/a/73532003

http://stackoverflow.com/q/25416607
has comment: http://stackoverflow.com/comment/39651452
has title: How do I make dialog windows in java?
tagged with: dialog
tagged with: java
possible better answer: http://stackoverflow.com/a/25416645
has comment: http://stackoverflow.com/comment/39648475
has answer: http://stackoverflow.com/a/25416645
has comment: http://stackoverflow.com/comment/39648843
type: Question
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/39667678
accepted answer: http://stackoverflow.com/a/25416624
answer count: 2
has answer: http://stackoverflow.com/a/25416624
tagged with: window
tagged with: swing
has body: I found a webpage on the java site on how to make dialog windows, but it isn't working when I try it. The site said to type: JOptionPane.showMessageDialog(frame, "Window text."); I'm just trying to make a window with a bit of text and an ok button, but when I type this in, my Eclipse IDE wants me to import something for the JOptionPane, and after I do that, it says the the "frame" part is incorrect, that it "cannot be resolved to a variable." What am I doing wrong here?
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25460924
accepted answer of: http://stackoverflow.com/q/25460886
answers question: http://stackoverflow.com/q/25460886
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: To append String values to a TextView, you can use the append() method: String [] array; TextView textView; for (int i = 0; i &lt; array.length; i++) { textView.append(array[i]); }
has comment: http://stackoverflow.com/comment/39730816
type: Answer

http://stackoverflow.com/a/25407575
score: 0
answers question: http://stackoverflow.com/q/25391118
has comment: http://stackoverflow.com/comment/39641419
has body: Those dependencies will come from the repository configured in your pom.xml or settings.xml.It looks like your Maven is configured to resolve from Artifactory (which is a good thing to do). If you want to add your own files to be resolved by Maven you should deploy them to Artifactory. If this instance is not in your control you should install your own instance of Artifactory inside your team/organization and configure your Maven installation to resolve from it. I really recommend reading the DZone Refcard on this.
has comment: http://stackoverflow.com/comment/39652436
type: Answer

http://stackoverflow.com/a/60057082
downvote count: 1
has body: I was kind of in a similar situation, but an override with -D is no solution (just don't ask) and since I've got a few variables, profiles are none either. In my case it's like this: The fabric8 docker maven plugin uses a variable. That variable is generated by the "build-helper-maven-plugin" regex-property. If "mvn docker:build" is invoked, the validate phase is not used and the variable is not there (so I get a "${blabla}" literal) and the build fails. If I invoke the usual build, the variable gets created. I took the strategy to run "mvn validate docker:build" instead of "mvn docker:build" to force the validation step, so the variable gets created.
type: Answer
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/25483586

http://stackoverflow.com/a/25394562
answers question: http://stackoverflow.com/q/25394296
score: 3
type: Answer
has body: The code you presented is not very rich so I'm not sure if I understand you correctly, but maybe this pseudo-code would help you. public class Card extends SomeComponent{ public void turn() { //doStuff } } public class CardGame { private SomeComponent[] cards; public void prepareGame() { CardListener listener = new CardListener(); for (int i=0; i&lt;=16; i++) { cards[i] = new Card(); cards[i].addActionListener(listener); } } } public class CardListener implements ActionListener { public void actionPerformed(ActionEvent e) { ((Card) e.getSource()).turn(); } } You can use adding MouseListener or KeyListener instead of ActionListener which doesn't give you much information about what has happened.
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/25435982
accepted answer of: http://stackoverflow.com/q/25430560
score: 2
answers question: http://stackoverflow.com/q/25430560
downvote count: 0
upvote count: 2
has body: Yet another GridLayout confusion! It is stretching its children and there is nothing that we can do about it. GridLayout is a very simple manager with very limited practical usage. Skip it and skip BorderLayout as well. The only thing that you need to know about BorderLayout is that it is the default manager of the frame's content pane. Layout management is a complex thing -- there not shortcuts. One has to put some effort to learn it. The good news is that there are some very capable layout managers. I recommend the following two: MigLayout GroupLayout JGoodies' FormLayout is a good option too. These managers are doing it properly. Study them carefully and choose your favourite. I provide two solutions, one with MigLayout, one with GroupLayout. MigLayout solution MigLayout is a third-party layout manager for which we need to dowload a single jar file. package com.zetcode; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import net.miginfocom.swing.MigLayout; public class MigLayoutEx extends JFrame { public MigLayoutEx() { initUI(); } private void initUI() { JPanel pnl = new JPanel(new MigLayout("ins dialog, center, " + "center, wrap")); pnl.add(new JLabel("Text one")); pnl.add(new JTextField(15)); pnl.add(new JLabel("Text two")); pnl.add(new JTextField(15)); add(pnl); pack(); setTitle("MigLayout example"); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { MigLayoutEx ex = new MigLayoutEx(); ex.setVisible(true); } }); } } GroupLayout solution GroupLayout is a built-in layout manager. package com.zetcode; import java.awt.Container; import java.awt.EventQueue; import javax.swing.GroupLayout; import static javax.swing.GroupLayout.Alignment.LEADING; import static javax.swing.GroupLayout.DEFAULT_SIZE; import static javax.swing.GroupLayout.PREFE…
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/39612172
has text: What is your expected output.
score: 0
comment on: http://stackoverflow.com/q/25397276
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25458852
score: 0
has body: You need to understand how synchronization works. Threads take a 'lock' on the object on which you are synchronizing when they enter the synchronized block. If you have a synchronized method then in that case the object becomes the 'this' instance. Now, no 2 threads can take a lock on the same object at the same time. object locks are mutex based in philosophy so only once thread can hold the mutex at a time. When the thread holding the lock exits the synchronized method or the block, it releases the mutex and thus the object lock becomes available to other threads to request lock on. This link explains the concepts excellently. It has pictures about disassembled byte code which shows how threads take and leave locks and why 2 threads on 2 different object dont block each other.
type: Answer
answers question: http://stackoverflow.com/q/25458810

event-handling
tag name: event-handling
type: Tag
tags question: http://stackoverflow.com/q/25548158

http://stackoverflow.com/comment/81096440
type: AnswerComment
comment on: http://stackoverflow.com/a/45558112
has text: Unfortunately, this won't work. The address space for each process is virtual. That is, process one's address 0x400000 will not map to the same physical address as process two's address 0x400000. So it is not possible to map addresses directly between two processes in the way you are suggesting. The way to do it is via memory-mapped files, as the accepted answer explains.
type: Comment
score: 2

http://stackoverflow.com/q/25486514
has title: Java Android display message before closing the activity (pressing back)
type: Question
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39777742
has comment: http://stackoverflow.com/comment/39777889
tagged with: android
has answer: http://stackoverflow.com/a/25486569
has body: I am trying to get to display a message on my Android Application before the app is closed (when user presses the back message). What I did till now is this: public class MainActivity extends DroidGap { @JavascriptInterface @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // new code super.setBooleanProperty("keepRunning", true); super.setIntegerProperty("splashscreen", R.drawable.splashscreen); super.setStringProperty("loadingDialog", "Loading Silver Angel ..."); appView.addJavascriptInterface(this, "MainActivity"); super.setIntegerProperty("loadUrlTimeoutValue", 10000); super.loadUrl("file:///android_asset/www/index.html",10000); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { //Handle the back button if(keyCode == KeyEvent.KEYCODE_BACK) { //Ask the user if they want to quit new AlertDialog.Builder(this) .setTitle("Closing Silver Angel") .setMessage("Are you sure you want to close this application?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //Stop the activity MainActivity.this.finish(); } }) .setNegativeButton("No", null) .show(); return true; } else { return super.onKeyDown(keyCode, event); } } } I also tried to use this method instead: @Override public void onBackPressed() { new AlertDialog.Builder(this) .setTitle("Closing Activity") .setMessage("Are you sure you want to close this activity?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }) .setNegativeButton("No", null) .show(); } The Problem I am facing is that when I am testing on Nexus 7 tablet, the message displays for 1 second and disappears with the application closing itself too. Thanks
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25486658
has comment: http://stackoverflow.com/comment/39777786

http://stackoverflow.com/comment/39628262
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25405966
has text: The client usually invokes the server over a transport (say HTTP) using a message level protocol (such as JSON) and sends requests. The server understands the request and responds. There can be several clients written in different languages and what is common between them is the network and message protocol. That is how the client and server are decoupled. It's hard to narrow down the answer further based on the information you provided. More here - http://en.wikipedia.org/wiki/Web_service
type: Comment

http://stackoverflow.com/q/25543523
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25543646
tagged with: compareto
has comment: http://stackoverflow.com/comment/39883134
tagged with: java
score: -1
has body: I'm new to Java and am working through some problems. I'm stuck on a question that asks me to "Write a program to input ten words and then display the words that are first and last in alphabetical order". The question is ambiguous. It could mean put all the input words into alphabetical order and display the first and last of these (harder) or display the first and last inputted word in alphabetical order (easier). I wrote the following code: import java.util.Scanner; public class Alphabetical { public static void main(String[] args) { String[] s = new String[10]; for (int i = 0; i &lt; 10; i++) { System.out.println("Enter word"); Scanner ins = new Scanner(System.in); s[i] = ins.nextLine().toLowerCase(); } int result = s[0].compareTo(s[10]); if (result &lt; 0) { System.out.println(s[0]); System.out.println(s[10]); } else if(result&gt;0){ System.out.println(s[10]); System.out.println(s[0]); } else{ System.out.println("Words are identical so cannot be placed in alphabetical order"); } } } But I'm getting an out of bounds exception where the compareTo method is placed and I'm not sure why. If anybody could help that would be great. If anyone could help with the harder version of the question too, that would be even better.
has answer: http://stackoverflow.com/a/25543641
has answer: http://stackoverflow.com/a/25543620
answer count: 3
has title: Using the compareTo(); method doesn't seem to be working
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/comment/39813714
has text: I followed the steps said by you.but i could get only the first and last elements of the array.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25499611

http://stackoverflow.com/comment/39799856
has text: @MadProgrammer Perfect, I don't quite understand what's happening so I'll have to read up on regular expressions but it looks like that's what I need to learn :) Thanks for pointing me in the right direction.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25498022

http://stackoverflow.com/comment/39843113
type: AnswerComment
comment on: http://stackoverflow.com/a/25521454
score: 0
type: Comment
has text: yes sorry im still learning to code properly so your critic on the formatting is very much appreciated ill work on making it better. You used size 5 to print to console and where you have . is correct but how do i get it to print on both sides of the hourglass

http://stackoverflow.com/comment/39868841
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25535318
has text: @user3635998 Try using httpExchange.getResponseHeaders().add("Content-Disposition", "attachment; filename=" + filename + ";");
score: 1

http://stackoverflow.com/q/25411157
tagged with: jsp
has comment: http://stackoverflow.com/comment/39640062
tagged with: struts2
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has answer: http://stackoverflow.com/a/25413017
favorite count: 0
type: Question
upvote count: 2
has title: struts logic tags rendering html format, JSTL tags do not
tagged with: jstl
has body: I am reading some messages from a database and throwing it to a jsp page. When using struts logic tags to render the message from the database the message in the database allows HTML formatting, meaning if an html tag such as &lt;table width="99%"&gt; is used in the database message then it will render this html properly when using struts logic tags... however if JSTL is used to render the object (database message) then the html formatting is not rendered properly. An example of the struts logic tags is: &lt;div class="textTitle"&gt;&lt;bean:write name="blahBlah" filter="false" property="displayObjects[1].fieldName"/&gt;&lt;/div&gt; An example of the JSTL tag is: &lt;td width="30%" class="formOpt"&gt;&lt;c:out value="${pubParam.fieldName}"/&gt;:&lt;/td&gt; notice i use c:out for JSTL and bean:write for struts tag.. Does anyone know why in JSTL the html formatting is not being rendering yet thrown to the page as is (meaning including the &lt;table width="99%"&gt; from the database message)?
accepted answer: http://stackoverflow.com/a/25413017

imagedownload
tag name: imagedownload
type: Tag
tags question: http://stackoverflow.com/q/25499868
tags question: http://stackoverflow.com/q/25502261

http://stackoverflow.com/comment/39815203
has text: It's very unclear what you're asking, but assigning to a variable in a loop (without using previous values, or storing them anywhere) is a bad sign. What do you expect your first loop to achieve? Why would you expect it to be any different to just `iCards = 8; iNumInCards = 2;`? I think you should probably step through the code you've got to understand what's wrong here...
score: 2
comment on: http://stackoverflow.com/q/25506386
type: QuestionComment
type: Comment

webbrowser-control
type: Tag
tag name: webbrowser-control
tags question: http://stackoverflow.com/q/25396036

http://stackoverflow.com/q/25421220
has comment: http://stackoverflow.com/comment/39656379
upvote count: 1
has body: I want to get my class property with string name. I have a code like this class Test { public String simple = "hello"; public void getSetting() { try { Test c = new Test(); Class cls = this.getClass(); Field field = cls.getField("simple");; } catch(Exception e) { // error } } } I get an error with this code , because my property is non-static , and when i changing my property to static , it's work fine , how can i get non-static properties with reflection?
has comment: http://stackoverflow.com/comment/39656404
accepted answer: http://stackoverflow.com/a/25421300
has comment: http://stackoverflow.com/comment/39656361
has comment: http://stackoverflow.com/comment/39656664
has answer: http://stackoverflow.com/a/25421300
type: AnsweredQuestion
answer count: 2
possible better answer: http://stackoverflow.com/a/25421457
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25421457
downvote count: 0
has comment: http://stackoverflow.com/comment/39656380
has title: Java - Access to non-static properties with reflection
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39656510

http://stackoverflow.com/comment/39863355
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25532386
has text: I tested this answer as well, and it worked fine. Thanks @rgettman

http://stackoverflow.com/q/25539351
type: Question
answer count: 8
tagged with: hash
has answer: http://stackoverflow.com/a/25539455
has comment: http://stackoverflow.com/comment/39875933
has answer: http://stackoverflow.com/a/69796716
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25539446
linked to: http://stackoverflow.com/q/15130764
upvote count: 1
has body: If two objects of the same class have the same hashCode in Java then how would they be stored in a HashMap / HashTable? What is the actual architecture for hashcode and memory address. Where does hashCode reside in memory? Example: There is a class A. when creating objects a1 and a2 then they will represent some memory address but I overrode hashcode every time same. When I read an article then I found that hashcode functions generate a hashcode from the memory address. this means the memory address will same if hashcode is same. Please clear my doubt. public class A { @Override public int hashCode() { return 1; } public static void main(String args[]) { A a1 = new A(); A a2 = new A(); System.out.println(a1.hashCode()); System.out.println(a2.hashCode()); } }
has comment: http://stackoverflow.com/comment/39875929
has answer: http://stackoverflow.com/a/25539398
has title: if two objects have same hashcode then what about their memory addresses
has answer: http://stackoverflow.com/a/25628091
has answer: http://stackoverflow.com/a/25539475
has comment: http://stackoverflow.com/comment/39875873
tagged with: hashcode
has answer: http://stackoverflow.com/a/25539451
tagged with: java
has answer: http://stackoverflow.com/a/25539402
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/q/25398698
tagged with: initialization
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25398876
tagged with: oop
has title: How to load data into java program without bloating main method
has answer: http://stackoverflow.com/a/25398833
has comment: http://stackoverflow.com/comment/39614716
has answer: http://stackoverflow.com/a/25399101
answer count: 6
type: AnsweredQuestion
has body: I'm looking for some object oriented design help basically. At the start of my program I need to load a whole bunch of data into the program(not from a database or anywhere; in this case I'm just loading it into the program) by building objects and assigning variables. However this takes up a lot of room and I feel like I'm just clogging up the main method and making it unreadable. I'm wondering what's the right way to approach this is, as far as OOP goes. I tried to make a class SubjectBuilder, and create everything in the constructor or variable space, and then create a new object in the main method. But it seems that alldata is out of the scope of the main method so when I need to manipulate it later I can't. Student jack = new Student("Jack Smith"); // Creating all the Student objects Student jim = new Student("Jim Lucas"); Student beck = new Student("Beck Barber"); Student ann = new Student("Ann Walker"); Student lucy = new Student("Lucy Boxer"); Subject maths = new Subject("Maths"); // Creating all the Subject objects Subject business = new Subject("Business"); Subject java = new Subject("Java"); Subject design = new Subject("Design"); Subject project = new Subject("Project"); business.addStudent(jack, 70); business.addStudent(jim, 65); business.addStudent(beck, 70); business.addStudent(ann, 83); business.addStudent(lucy, 78); ^^ That's a snippet data I need to load. I have a bunch of marks for each subject. At this stage I only have the Application class, Subject class (HashMap of student and Integer mark), and Student. All I need to do is create this program that displays individual data for students or subjects and allows changes to particular marks etc. I'm confident I could complete the whole project in the main method but I feel like that's not very object oriented. I just don't know how to do it otherwise.
downvote count: 0
score: 1
upvote count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25398833
has answer: http://stackoverflow.com/a/25399259
has answer: http://stackoverflow.com/a/25398960
has answer: http://stackoverflow.com/a/25398869
possible better answer: http://stackoverflow.com/a/25398869

http://stackoverflow.com/comment/39731282
score: 1
has text: @SyedAliTaqi the method `print()` does not exist on `String`. Your code does not make much sense
comment on: http://stackoverflow.com/a/25461178
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25522726
downvote count: 0
answers question: http://stackoverflow.com/q/25521397
type: Answer
upvote count: 2
has body: Having a quick look at your code I presume that these lines are what gives you the wrong results: if (temp!=l) answer+=r+1;` I do not see what this is there for. If you remove it you will get the correct result. However, I think that merge sort is not suitable to solve this problem. Have a look at this example: For the list 5 4 3 4 the correct answer would be 4. Now lets see, what merge sort would do to this list considering your approach: 5 4 | 3 4 result 0 5 | 4 | 3 | 4 result 0 4 5 | 3 4 result 1 3 || 4 5 | 4 result 2 3 4 || 5 | 4 result 2 3 4 4 || 5 | result 3 3 4 4 5 || | result 3 Now if you think about this, merge sort does have a complexity of n*log n, so we do not look at all pairs.
score: 2

http://stackoverflow.com/comment/39750592
type: Comment
comment on: http://stackoverflow.com/a/25466378
type: AnswerComment
score: 0
has text: Yes, I need info about every `JLabel`. I tried yesterday for couple of hours with both your ideas but couldn't make anything working... I don't understand that, yes, how to get values of cooX, cooY, panel_1, even frame in this example... I know I should've figured that by myself somehow, but I'm not (yet) so good at this. :D Btw. thank you for the answer.

utf-8
tags question: http://stackoverflow.com/q/25481288
tags question: http://stackoverflow.com/q/25445048
tags question: http://stackoverflow.com/q/25404373
tags question: http://stackoverflow.com/q/25502501
tags question: http://stackoverflow.com/q/25390203
tags question: http://stackoverflow.com/q/25398425
tags question: http://stackoverflow.com/q/25462660
tag name: utf-8
tags question: http://stackoverflow.com/q/25455760
tags question: http://stackoverflow.com/q/25535878
tags question: http://stackoverflow.com/q/25442442
tags question: http://stackoverflow.com/q/25539064
tags question: http://stackoverflow.com/q/25466127
type: Tag
tags question: http://stackoverflow.com/q/25407433
tags question: http://stackoverflow.com/q/25510085
tags question: http://stackoverflow.com/q/25462219

http://stackoverflow.com/comment/39780257
has text: @Arash It's an ActionBarActivity.
type: Comment
comment on: http://stackoverflow.com/q/25486349
type: QuestionComment
score: 0

http://stackoverflow.com/a/25446519
has body: Nope. That is not possible with Java. Best alternative is using switch cases as you already mentioned.
accepted answer of: http://stackoverflow.com/q/25446426
type: Answer
answers question: http://stackoverflow.com/q/25446426
has comment: http://stackoverflow.com/comment/39703780
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39705570
type: AcceptedAnswer

http://stackoverflow.com/q/25449543
has answer: http://stackoverflow.com/a/25449904
answer count: 6
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39708940
has body: I am trying to remove elements that do not contain a specific string from an arrayList but with no luck. I am using the following code: ArrayList&lt;String&gt; classes = ClassesRetrieval.getYagoClasses(); Iterator&lt;String&gt; it = classes.iterator(); while(it.hasNext()){ if(it.next().contains("yago")){ it.remove(); } } for(String i : classes){ System.out.println(i); } I also tried for(int i=0;i&lt;classes.size();i++){ if(!classes.get(i).contains("yago")){ classes.remove(i); } } for(String i : classes){ System.out.println(i); } but with no luck..
has comment: http://stackoverflow.com/comment/39709142
has answer: http://stackoverflow.com/a/25449826
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39708725
has comment: http://stackoverflow.com/comment/39708688
has comment: http://stackoverflow.com/comment/39708796
possible better answer: http://stackoverflow.com/a/25449745
has answer: http://stackoverflow.com/a/25449783
has comment: http://stackoverflow.com/comment/39708694
accepted answer: http://stackoverflow.com/a/25449777
has answer: http://stackoverflow.com/a/25449745
has answer: http://stackoverflow.com/a/25449777
has comment: http://stackoverflow.com/comment/39708823
has comment: http://stackoverflow.com/comment/39708802
has title: Elements are not being removed from ArrayList
type: Question
has answer: http://stackoverflow.com/a/25449823
tagged with: arrays
has comment: http://stackoverflow.com/comment/39708632

http://stackoverflow.com/q/25414129
has comment: http://stackoverflow.com/comment/39644257
answer count: 3
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25414303
has body: I'm making an application in Java using a JTabbedFrame. Each tab is created by a separate class extending JFrame. I would like to save each tab's state by saving the object to a file on window close and read them back from the file when the tabs are created. I know when you serialize an object all the instance variables are saved, but what happens to the constructor? When I say for example in the class that builds the tab frame: public class Jtab{ private ClassThatExtendsJFrame tab; public Jtab(ClassThatExtendsJFrame tab){ this.tab = tab; // what happens here? Is the constructor called? JTabbedPane tabs = new JTabbedPane(); tabs.addTab("name", icon, this.tab, "tooltip"); } } All of the code that lays out the JFrame is currently in the constructor. All of the JLabels and elements in the the layout are properties of the class which I assign in the constructor. So I see there are two options that might happen: The constructor is called and all the variables are reset, or the constructor is not called and and my layout is not created. What's the best way to accomplish what I am looking to do?
has title: What happens when you say Object someObject = otherSameObject;
has comment: http://stackoverflow.com/comment/39644669
has answer: http://stackoverflow.com/a/25414153
has comment: http://stackoverflow.com/comment/39644422
has comment: http://stackoverflow.com/comment/39644339
tagged with: constructor
has comment: http://stackoverflow.com/comment/39644781
score: 0
has answer: http://stackoverflow.com/a/25414155
has comment: http://stackoverflow.com/comment/39644539
tagged with: swing
has comment: http://stackoverflow.com/comment/39644171
type: Question
tagged with: serialization

http://stackoverflow.com/a/25547613
answers question: http://stackoverflow.com/q/25546898
has body: When it's only a small file you could solve it like this read all lines into a list implement your own Comparator sort the list using your own comparator The example is only a PoC. Anything not necessary to show the principle has been omitted. import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * @author SubOptimal */ public class Main { public static Comparator&lt;String&gt; getComparator() { return new Comparator&lt;String&gt;() { @Override public int compare(String o1, String o2) { // split the lines to compare by whitespaces String[] columns1 = o1.split("\\s+"); String[] columns2 = o2.split("\\s+"); // compare first column if (columns1[0].compareTo(columns2[0]) != 0) { return columns1[0].compareTo(columns2[0]); } // compare third column if (columns1[2].compareTo(columns2[2]) != 0) { return columns1[2].compareTo(columns2[2]); } // both lines have equal return 0; } }; } public static void main(String[] args) throws IOException { final Path path = Paths.get("input.csv"); // read all lines into a list of String List&lt;String&gt; lines = Files.readAllLines(path, DEFAULT_CHARSET); // sort the list using your own comparator Collections.sort(lines, getComparator()); // output the sorted list for (String line : lines) { System.out.println(line); } } private static final Charset DEFAULT_CHARSET = Charset.defaultCharset(); }
score: 1
upvote count: 1
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25546898
downvote count: 0

http://stackoverflow.com/comment/39619655
type: Comment
type: QuestionComment
has text: Try to send BytesMessage and do a manual conversion on receiver side. Also, please post producer-side code that is sending that hindi string.
score: 0
comment on: http://stackoverflow.com/q/25398425

http://stackoverflow.com/q/25411193
type: AnsweredQuestion
has body: Can you guys tell me what really is the problem in this if statement,'getItem' and 'getQty 'are both strings if((getQty != null &amp;&amp; getQty.length()&gt;0) || (getItem!= null &amp;&amp; getItem.length()&gt;0)) { //do something } else { //do something }
has comment: http://stackoverflow.com/comment/39638302
tagged with: if-statement
has comment: http://stackoverflow.com/comment/39638379
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25411337
has comment: http://stackoverflow.com/comment/39638492
score: -1
has comment: http://stackoverflow.com/comment/39638414
has comment: http://stackoverflow.com/comment/39638295
has answer: http://stackoverflow.com/a/25411337
has comment: http://stackoverflow.com/comment/39638484
has comment: http://stackoverflow.com/comment/39638374
type: Question
has comment: http://stackoverflow.com/comment/39638501
has comment: http://stackoverflow.com/comment/39638473
has comment: http://stackoverflow.com/comment/39638674
answer count: 2
has title: Error in checking if the strings are empty or not
has comment: http://stackoverflow.com/comment/39638428
upvote count: 0
has comment: http://stackoverflow.com/comment/39638342
possible better answer: http://stackoverflow.com/a/25411518
tagged with: string
has comment: http://stackoverflow.com/comment/39638359
has answer: http://stackoverflow.com/a/25411518
downvote count: 1
has comment: http://stackoverflow.com/comment/39638396
favorite count: 0
has comment: http://stackoverflow.com/comment/39638293
has comment: http://stackoverflow.com/comment/39638500

http://stackoverflow.com/q/25481288
has comment: http://stackoverflow.com/comment/39768578
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39768738
has comment: http://stackoverflow.com/comment/39768384
has title: Trying to output UTF-8 Text, and it doesn't work
has comment: http://stackoverflow.com/comment/39768301
tagged with: java
has answer: http://stackoverflow.com/a/25481575
has comment: http://stackoverflow.com/comment/39768523
has body: I have this code: import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; public class Decoder { public static void Decode() throws IOException{ String input = ""; input = readFile("C:\\Users\\Dragon\\Pictures\\Binary.txt", StandardCharsets.UTF_8); input = input.replace(" ",""); System.out.println(input); String output = ""; Writer out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(new File("C:\\Users\\Dragon\\Pictures\\Binary2.txt")), "UTF8")); for(int i = 0; i &lt;= input.length() - 8; i+=8) { int k = Integer.parseInt(input.substring(i, i+8), 2); out.append((char)k); } out.close(); System.out.println("Your File has been saved at C:\\Users\\Dragon\\Pictures\\Binary.txt"); } static String readFile(String path, Charset encoding) throws IOException { byte[] encoded = Files.readAllBytes(Paths.get(path)); return new String(encoded, encoding); } } and basically what I'm doing is converting a text file containing binary that can be decoded into text. It decodes successfully, but when outputting the file containing the output, all UTF-8 Characters are replaced with '?'. Why is this happening? EDIT: Example Input: 00111111 01010000 01001110 01000111 00001101 00001010 00011010 00001010 00000000 00000000 00000000 00001101 01001001 01001000 01000100 01010010 00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000001 00001000 00000110 00000000 00000000 00000000 00011111 00010101 00111111 00000000 00000000 00000000 00000001 01110011 01010010 01000111 01000010 00000000 00111111 00111111 00011100 00111111 00000000 00000000 00000000 00000100 01100111 01000001 01001101 01000001 00000000 00000000 00111111 00111111 00001011 00111111 01100001 00000101 00000000 00000000 00000000 0000100…
possible better answer: http://stackoverflow.com/a/25481881
type: Question
has comment: http://stackoverflow.com/comment/39768673
has answer: http://stackoverflow.com/a/25481881
has comment: http://stackoverflow.com/comment/39768344
accepted answer: http://stackoverflow.com/a/25481575
tagged with: utf-8

http://stackoverflow.com/a/25470691
has comment: http://stackoverflow.com/comment/39748978
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/25470536
has body: The problem is in these lines : tv1 = (TextView) findViewById(R.id.medresults1); tv2 = (TextView) findViewById(R.id.medresults2); ... The textviews are not being initialized. Check your XML file(memorygameresults.xml) whether textviews with these IDs exist.
has comment: http://stackoverflow.com/comment/39748944
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39749017
has comment: http://stackoverflow.com/comment/39748865
has comment: http://stackoverflow.com/comment/39748871
type: Answer
accepted answer of: http://stackoverflow.com/q/25470536

http://stackoverflow.com/comment/67205557
comment on: http://stackoverflow.com/a/26953407
type: Comment
has text: Does it work with non-csv files like plaintext files for example?
type: AnswerComment
score: 0

http://stackoverflow.com/a/25494013
downvote count: 0
has body: JDBC doesn't bring back all the results of a query in a ResultSet, because there may be too many of them to fetch them all eagerly. Instead it gives you something you can use to retrieve the results, but which goes away when the connection closes. So when you pass it back from your method after closing the database connection, nothing else can use it. What you can do instead is to have this method use the resultSet to populate an object or a collection of objects, and pass that populated object back. If you change your code to pass in a rowMapper (that takes a resultSet and passes back an object populated with the current row in the resultset), and use that to populate a container object that you pass back, then you'll have something as reusable as what what you've written, but which actually works because it doesn't depend on having the connection held open after the call is finished. Here's your example code rewritten to use the rowmapper, get rid of some unnecessary exception-catching, and fix a bug that will prevent the connection from getting closed in some cases: public static List&lt;T&gt; sqlquery (String query, RowMapper&lt;T&gt; rowMapper) throws SQLException { Connection connection=null; Statement st=null; ResultSet rs=null; // don't need Class.forName anymore with type4 driver connection = DriverManager.getConnection("databaseadress","username","password"); st = connection.createStatement(); rs = st.executeQuery(query); List&lt;T&gt; list = new ArrayList&lt;T&gt;(); while (rs.next()) { list.add(rowMapper.mapRow(rs)); } // don't let exception thrown on close of // statement or resultset prevent the // connection from getting closed if(rs != null) try {rs.close()} catch (SQLException e){log.info(e);} if(st!= null) try {st.close()} catch (SQLException e){log.info(e);} if(connection != null) try {connection.close()} catch (SQLException e){log.info(e);} return list; } If you don't catch each exception thrown on close individually, as shown above, you risk fai…
upvote count: 14
score: 14
has comment: http://stackoverflow.com/comment/39793501
type: Answer
answers question: http://stackoverflow.com/q/25493837

http://stackoverflow.com/q/25439568
has answer: http://stackoverflow.com/a/25440139
has comment: http://stackoverflow.com/comment/39690638
has answer: http://stackoverflow.com/a/25439641
type: AnsweredQuestion
score: 3
has title: Deleting a node in java
tagged with: linked-list
upvote count: 3
tagged with: java
has body: When we delete a node in java, we simply do n.data=n.next.data; n.next=n.next.next; (To delete the node n.next). Does this complete the purpose of deletion or we have some method to remove the deleted node (like free(n.next) in C)?
has comment: http://stackoverflow.com/comment/39690566
answer count: 4
has answer: http://stackoverflow.com/a/25439640
favorite count: 0
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25439941
possible better answer: http://stackoverflow.com/a/25439640
accepted answer: http://stackoverflow.com/a/25439641

http://stackoverflow.com/a/56209677
score: 0
answers question: http://stackoverflow.com/q/25547630
has body: If you are trying to represent an AID object with CURRENT_PROVIDER, then you have to add this schema as a ConceptSchema object, not as a PrimitiveSchema object. Just change this line: cs.add(CURRENT_PROVIDER,(PrimitiveSchema) getSchema(BasicOntology.AID)); to this: cs.add(CURRENT_PROVIDER,(ConceptSchema) getSchema(BasicOntology.AID));
type: Answer

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/25460661
tags question: http://stackoverflow.com/q/25467703
tags question: http://stackoverflow.com/q/25398174
tags question: http://stackoverflow.com/q/25442725
tags question: http://stackoverflow.com/q/25479970
tags question: http://stackoverflow.com/q/25422967
tags question: http://stackoverflow.com/q/25514695
tags question: http://stackoverflow.com/q/25474814
tags question: http://stackoverflow.com/q/25455056
tags question: http://stackoverflow.com/q/25430610
tags question: http://stackoverflow.com/q/25522564
tags question: http://stackoverflow.com/q/25529132
tags question: http://stackoverflow.com/q/25510173
tags question: http://stackoverflow.com/q/25488529
tags question: http://stackoverflow.com/q/25459448
tags question: http://stackoverflow.com/q/25503939
tags question: http://stackoverflow.com/q/25529167
tags question: http://stackoverflow.com/q/25523548
tag name: xml
tags question: http://stackoverflow.com/q/25529307
tags question: http://stackoverflow.com/q/25443890
tags question: http://stackoverflow.com/q/25466846
tags question: http://stackoverflow.com/q/25391494
tags question: http://stackoverflow.com/q/25453727
tags question: http://stackoverflow.com/q/25464783
tags question: http://stackoverflow.com/q/25391038
tags question: http://stackoverflow.com/q/25468938
tags question: http://stackoverflow.com/q/25470933
tags question: http://stackoverflow.com/q/25536008
type: Tag
tags question: http://stackoverflow.com/q/25411410
tags question: http://stackoverflow.com/q/25428939
tags question: http://stackoverflow.com/q/25512055
tags question: http://stackoverflow.com/q/25519898
tags question: http://stackoverflow.com/q/25486782
tags question: http://stackoverflow.com/q/25509651
tags question: http://stackoverflow.com/q/25514862
tags question: http://stackoverflow.com/q/25398554
tags question: http://stackoverflow.com/q/25528769
tags question: http://stackoverflow.com/q/25521220
tags question: http://stackoverflow.com/q/25508845
tags question: http://stackoverflow.com/q/25408842
tags question: http://stackoverflow.com/q/25483189
tags question: http://stackoverflow.com/q/25465969
tags question: http://stackoverflow.com/q/25486726
tags question: http://stackoverflow.com/q/25528475
tags question: http://stackoverflow.com/q/25469673
tags question: http://stackoverflow.com/q/25546879
tags question: http://stackoverflow.com/q/25420567
tags question: http://stackoverflow.com/q/25535453
tags question: http://stackoverflow.com/q/25393252
tags question: http://stackoverflow.com/q/25480168
tags question: http://stackoverflow.com/q/25425974
tags question: http://stackoverflow.com/q/25420743
tags question: http://stackoverflow.com/q/25424345
tags question: http://stackoverflow.com/q/25529114
tags question: http://stackoverflow.com/q/25394131
tags question: http://stackoverflow.com/q/25493605
tags question: http://stackoverflow.com/q/25511017
tags question: http://stackoverflow.com/q/25403840
tags question: http://stackoverflow.com/q/25427065
tags question: http://stackoverflow.com/q/25535462
tags question: http://stackoverflow.com/q/25426429
tags question: http://stackoverflow.com/q/25518253
tags question: http://stackoverflow.com/q/25534680
tags question: http://stackoverflow.com/q/25442568
tags question: http://stackoverflow.com/q/25435345
tags question: http://stackoverflow.com/q/25541295
tags question: http://stackoverflow.com/q/25419012
tags question: http://stackoverflow.com/q/25449434
tags question: http://stackoverflow.com/q/25491163
tags question: http://stackoverflow.com/q/25450767
tags question: http://stackoverflow.com/q/25398146
tags question: http://stackoverflow.com/q/25449534
tags question: http://stackoverflow.com/q/25547096
tags question: http://stackoverflow.com/q/25438381
tags question: http://stackoverflow.com/q/25517868
tags question: http://stackoverflow.com/q/25468152
tags question: http://stackoverflow.com/q/25510701
tags question: http://stackoverflow.com/q/25518143

http://stackoverflow.com/comment/39886126
has text: Can you please show some more code? What do you mean they are constants? Do you have for example `static final String NORTH = "000";`? You don't provide many details. You don't even specify what the problem is. So if you need help give us more.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25545107
type: QuestionComment

http://stackoverflow.com/comment/39608168
comment on: http://stackoverflow.com/q/25394513
has text: Thats a good question lol. I just noticed I don't have a main :-\ I'm away from my computer at the moment. Ill give it a go when I get home. Copy paste my code if you don't mind and see if it at least runs.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25535804
has body: There's the java.net.URLEncoder and java.net.URLDecoder for. String url = "some.xhtml?drilldownproperty=" + URLEncoder.encode(drilldownpropertyvals, "UTF-8"); And then on the other side String drilldownpropertyvals = URLDecoder.decode(drilldownproperty, "UTF-8");
type: Answer
accepted answer of: http://stackoverflow.com/q/25535021
has comment: http://stackoverflow.com/comment/39870615
answers question: http://stackoverflow.com/q/25535021
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25895762
score: 6
answers question: http://stackoverflow.com/q/25403012
type: Answer
upvote count: 6
has body: If this happened from not closing eclipse properly (or it just crashed): When it is closed, 'End Process Tree' on javaw.exe with task manager. Restart eclipse. This is not likely the best way but it works... or did for me at least. If this is from another server running: You need to make sure you have separate port numbers per server instance. Otherwise it will not bind correctly; or at all.
downvote count: 0

http://stackoverflow.com/a/25547079
has comment: http://stackoverflow.com/comment/39889303
type: Answer
answers question: http://stackoverflow.com/q/25545473
score: 0
has body: You are always storing the same instance of current. You could create a new instance for every iteration. int[][] interpolate(int[] source, int[] goal){ int[] current; ArrayList&lt;int[]&gt; steps = new ArrayList&lt;int[]&gt;(); while(/* condition */){ current = new int[source.length]; // Change value of current steps.add(current); } int[][] stepsArr = steps.toArray(new int[0][0]); return stepsArr; }

http://stackoverflow.com/a/25462117
has body: ArrayList implements the Collection interface and therefore supports the Collection.addAll() method: if (needsSubClass1) { listOfSuperClassObjects.addAll(listOfSubClass1Objects); } else { listOfSuperClassObjects.addAll(listOfSubClass2Objects); } Incidentally, ArrayList also has a generic copy constructor that probably just calls addAll() on its own: listOfSuperClassObjects = new ArrayList&lt;SuperClass&gt;(listOfSubClass1Objects);
type: Answer
has comment: http://stackoverflow.com/comment/39732825
accepted answer of: http://stackoverflow.com/q/25462098
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25462098

http://stackoverflow.com/comment/39778341
has text: _is harder for me to give code examples but if needed I will_ Yes, we need it. We can't know what is the problem, and where it is without the code you are using
score: 0
comment on: http://stackoverflow.com/q/25486859
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39837471
score: 0
comment on: http://stackoverflow.com/q/25518186
has text: what is your application context? Is it ROOT under your web server?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/59628392
answers question: http://stackoverflow.com/q/25447590
has body: In my case eclipse was using an old settings.xml file.
score: 0
type: Answer

http://stackoverflow.com/q/25484164
has answer: http://stackoverflow.com/a/25484556
answer count: 4
has answer: http://stackoverflow.com/a/25485110
upvote count: 4
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39797068
accepted answer: http://stackoverflow.com/a/25550104
has title: CharBuffer on top of a memory-mapped ByteBuffer without using lots of heap space
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39797010
has body: I am writing a java code to search of email address and passwords in a large txt file (6-8Gb). I have written the code and it worked with 200Mb txt file and given the output. But when i input a 500Mb file it displays the following error. Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.nio.HeapCharBuffer.&lt;init&gt;(HeapCharBuffer.java:57) at java.nio.CharBuffer.allocate(CharBuffer.java:331) at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:792) at regular.expression_fyp.RegularExpression_fyp.main(RegularExpression_fyp.java:56) Java Result: 1 I am new to java programming so i need any help from you to solve this problem. What should i do to solve this problem? Please send me any suggessions and i have attached my code as well. Thank you. import java.io.FileInputStream; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.channels.FileChannel; import java.nio.charset.Charset; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegularExpression_fyp { public static void main(String[] argv) throws Exception { String pattern = "\\w[%A-Za-z0-9-]+\\%40\\w+\\.com\\w[%A-Za-z0-9]+"; Pattern r = Pattern.compile(pattern); FileInputStream input = new FileInputStream("E:\\test7.txt"); FileChannel channel = input.getChannel(); ByteBuffer bbuf = channel.map(FileChannel.MapMode.READ_ONLY, 0, (int) channel.size()); CharBuffer cbuf = Charset.forName("8859_1").newDecoder().decode(bbuf); Matcher matcher = r.matcher(cbuf); if (matcher.find( )) { System.out.println("Found value: " + matcher.group(0) ); } else { System.out.println("NO MATCH"); } } }
has comment: http://stackoverflow.com/comment/39802175
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25507595
possible better answer: http://stackoverflow.com/a/25485110
linked to: http://stackoverflow.com/q/21891654
has answer: http://stackoverflow.com/a/25550104
has comment: http://stackoverflow.com/comment/39773156
has comment: http://stackoverflow.com/comment/39773232
linked to: http://stackoverflow.com/q/1596009
tagged with: regex
score: 4
tagged with: memory
has comment: http://stackoverflow.com/comment/39773431

http://stackoverflow.com/a/25465305
has comment: http://stackoverflow.com/comment/39884146
score: 4
has comment: http://stackoverflow.com/comment/39814203
has comment: http://stackoverflow.com/comment/39814389
has comment: http://stackoverflow.com/comment/39857387
has comment: http://stackoverflow.com/comment/39857459
has comment: http://stackoverflow.com/comment/39864318
type: Answer
has comment: http://stackoverflow.com/comment/39857403
upvote count: 4
has comment: http://stackoverflow.com/comment/39886436
has body: I believe @fpsColton's answer is correct - I'm just added extra info for clarity. As requested on linked thread here is the code changes I made on this - note: I only added the parts where I've labelled "DH" In BOSHConnection: // DH: function to preserve current api public void login(String username, String password, String resource) throws XMPPException { login(username, password, resource, false); } // DH: Most of this is existing login function, but added prebind parameter // to allow leaving function after all required pre-bind steps done and before // presence stanza gets sent (sent from attach in XMPP client) public void login(String username, String password, String resource, boolean preBind) throws XMPPException { if (!isConnected()) { throw new IllegalStateException("Not connected to server."); } if (authenticated) { throw new IllegalStateException("Already logged in to server."); } // Do partial version of nameprep on the username. username = username.toLowerCase().trim(); String response; if (config.isSASLAuthenticationEnabled() &amp;&amp; saslAuthentication.hasNonAnonymousAuthentication()) { // Authenticate using SASL if (password != null) { response = saslAuthentication.authenticate(username, password, resource); } else { response = saslAuthentication.authenticate(username, resource, config.getCallbackHandler()); } } else { // Authenticate using Non-SASL response = new NonSASLAuthentication(this).authenticate(username, password, resource); } // Indicate that we're now authenticated. authenticated = true; anonymous = false; // DH: Prebind only requires connect and authenticate if (preBind) { return; } // Set the user. if (response != null) { this.user = response; // Update the serviceName with the one returned by the server config.setServiceName(StringUtils.parseServer(response)); } else { this.user = username + "@" + getServiceName(); if (resource != null) { this.user += "/" + resource; } } // Create the roster if it is not a reconnection. if (this.rost…
answers question: http://stackoverflow.com/q/25455638
downvote count: 0
has comment: http://stackoverflow.com/comment/39887787

http://stackoverflow.com/comment/39722339
type: QuestionComment
has text: because i can't write: List<Faehigkeit> help = service.path("Faehigkeit").path("getFaehigkeiten").post(art);
comment on: http://stackoverflow.com/q/25455908
type: Comment
score: 0

http://stackoverflow.com/comment/39649818
score: 1
has text: @Alexander Feel free to answer your own question if you have the solution
comment on: http://stackoverflow.com/q/25417284
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39729964
comment on: http://stackoverflow.com/q/25460409
type: QuestionComment
has text: Check this : http://stackoverflow.com/questions/18683130/list-item-not-showing-correct-text/18710591#18710591
score: 0
type: Comment

http://stackoverflow.com/comment/39850926
comment on: http://stackoverflow.com/q/25523976
type: QuestionComment
has text: Yes I have checked through a ping app. This is only the IP address.
type: Comment
score: 0

http://stackoverflow.com/q/25439409
has answer: http://stackoverflow.com/a/40378618
tagged with: arraylist
score: 2
tagged with: list
has comment: http://stackoverflow.com/comment/39690387
has answer: http://stackoverflow.com/a/25439451
tagged with: java
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/25439540
has answer: http://stackoverflow.com/a/25439476
has body: Hi i have two value object classes . package org.array; import java.util.List; public class Father { private String name; private int age ; private List&lt;Children&gt; Childrens; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public List&lt;Children&gt; getChildrens() { return Childrens; } public void setChildrens(List&lt;Children&gt; childrens) { Childrens = childrens; } } second is for children package org.array; public class Children { private String name; private int age ; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } and i want to print there value i nested a list inside a list here i am putting only a single value inside the objects while in real i have many values . so i am nesting list of children inside father list. how can i print or get the value of child and father both. here is my logic. package org.array; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class ArrayDemo { public static void main(String[] args) { List &lt;Father&gt; fatherList = new ArrayList&lt;Father&gt;(); Father father = new Father(); father.setName("john"); father.setAge(25); fatherList.add(father); List &lt;Children&gt; childrens = new ArrayList&lt;Children&gt;(); Children children = new Children(); children.setName("david"); children.setAge(2); childrens.add(children); father.setChildrens(childrens); fatherList.add(father); Iterator&lt;Father&gt; iterator = fatherList.iterator(); while (iterator.hasNext()) { System.out.println(iterator.toString()); } } }
favorite count: 0
has answer: http://stackoverflow.com/a/25440465
type: Question
has answer: http://stackoverflow.com/a/25439439
has answer: http://stackoverflow.com/a/25439448
tagged with: iterator
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39690268
has comment: http://stackoverflow.com/comment/39697149
has title: How to iterate a list inside a list in java?

http://stackoverflow.com/comment/39626395
has text: Time has clearly come for you to show some source code, cause all seems rather correct.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25404441

http://stackoverflow.com/q/25512146
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/25512219
type: Question
upvote count: 20
has answer: http://stackoverflow.com/a/25515423
tagged with: concurrency
linked to: http://stackoverflow.com/q/25561759
type: AnsweredQuestion
score: 20
answer count: 2
accepted answer: http://stackoverflow.com/a/25515423
downvote count: 0
has comment: http://stackoverflow.com/comment/39828203
tagged with: java
tagged with: multithreading
has body: Let's assume this is about to happen in a true parallel environment, one VM, at the same time: // Thread 1: new Cat() // Thread 2: new Dog() // Thread 3: new Mouse() How does JVM ensure thread safety of memory allocations on heap? Heap is one for all threads and it has its own internal data. For simplicity assume a simple compacting garbage collector implementation, -XX:+UseSerialGC -XX:+UseParallelGC, with simple incremental pointer to mark a start of free space and one continuous free space in Eden (heap). There must be some kind of synchronization between threads when heap space is allocated for Cat, Dog and Mouse instances otherwise they can easily end up overwriting each other. Does that mean that every new operator hides inside some synchronized blocks? This way, many "lock free" algorithms are not in fact completely lock free ;) I assume that memory allocations are made by the application thread themselves, synchronously, not by another dedicated thread(s). I am aware of TLABs, or Thread Local Allocation Buffer. They allow threads to have a separate memory areas in Eden for allocations, so no synchronization is required. But I am not sure if TLAB is set by default, it is somewhat very obscure HotSpot feature. Note: do not confuse TLAB and ThreadLocal variables! I also assume, that with more complex garbage collectors, like G1, or non-compacting garbage collectors, more complex heap structure data has to be maintained, like list of free blocks for CMS, so more synchronization is needed. UPDATE: Please let me clarify this. I accept answer for HotSpot JVM implementation and variants with and without active TLAB. UPDATE: According to my quick test, TLAB are set ON by default, on my 64-bit JDK 7, for Serial, Parallel and CMS garbage collectors, but not for G1 GC.
tagged with: new-operator
has title: How JVM ensures thread safety of memory allocation for a new object
linked to: http://stackoverflow.com/q/24618467
possible better answer: http://stackoverflow.com/a/25512219

http://stackoverflow.com/comment/39876315
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25539540
has text: `Calendar.rightNow` has a `.` instead of a space.

http://stackoverflow.com/comment/39857073
type: QuestionComment
comment on: http://stackoverflow.com/q/25478405
has text: do you see anything in the console output from starting tomcat?
score: 0
type: Comment

http://stackoverflow.com/q/25486352
has comment: http://stackoverflow.com/comment/39777265
tagged with: session
accepted answer: http://stackoverflow.com/a/25488467
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
has title: Spring Security session timeout is too short
upvote count: 2
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25488467
downvote count: 0
tagged with: spring-security
favorite count: 0
type: Question
has body: I don't know how, but session timeout is incredibly short. As I know Spring Security session timeout depends on default server's session configurations. I've found out that GlassFish timeout is 1800 sec(10 min). But I think session removes every 5 minutes. How could this happened? This is my Spring Security configurations: &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"&gt; &lt;!-- enable use-expressions --&gt; &lt;http auto-config="true" use-expressions="true"&gt; &lt;intercept-url pattern="/adminRole/**" access="hasRole('ROLE_ADMIN')" /&gt; &lt;intercept-url pattern="/userRole/**" access="hasRole('ROLE_USER')" /&gt; &lt;!-- access denied page --&gt; &lt;access-denied-handler error-page="/403" /&gt; &lt;form-login login-page="/" default-target-url="/resolveRoles" authentication-failure-url="/?error" username-parameter="username" password-parameter="password" /&gt; &lt;remember-me key="key" token-validity-seconds="2419200" /&gt; &lt;logout logout-success-url="/?logout" /&gt; &lt;!-- enable csrf protection --&gt; &lt;/http&gt; &lt;!-- Select users and user_roles from database --&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;password-encoder hash="sha"/&gt; &lt;jdbc-user-service data-source-ref="dataSource" users-by-username-query= "select username,password, enabled from smsc.users where username=?" authorities-by-username-query= "select username, role from smsc.user_roles where username =? " /&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; &lt;/beans:beans&gt;

http://stackoverflow.com/a/25485451
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25485271
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25485271
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39775674
has body: This depends on your logic. Consider these two pairs of interfaces: interface House { int doorCount(); int windowCount(); } interface Automobile { int doorCount(); int windowCount(); int wheelCount(); } Nobody in his right mind would derive Automobile by extending a house, because an automobile is not a house with wheels. On the other hand, in situation like this interface House { int doorCount(); int windowCount(); } int Mansion extends House { int poolCount(); } deriving from House makes sense, because Mansion is a kind of House with "additional features".
has comment: http://stackoverflow.com/comment/39775821
type: Answer

http://stackoverflow.com/comment/39763842
score: 2
comment on: http://stackoverflow.com/q/25478857
type: Comment
type: QuestionComment
has text: how sure are you that `wiekEditText` has inputted numbers in it?

http://stackoverflow.com/comment/39779934
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25487606
score: 0
has text: actually starting the JVM yourself in C AND calling java-methods/functions is massive overkill and extremely error-prone - thats what the java-binary is for.

http://stackoverflow.com/comment/42024009
comment on: http://stackoverflow.com/a/25536297
type: Comment
score: 0
type: AnswerComment
has text: I attempted this with PMD, but eventually abandoned and switched to FindBugs for 2 reasons. One - more precision. I can note where the bug is as well as all parameter set up lines (e.g. Map.put calls) that are missing the type info. Two - FindBugs can be used with plain Maven or wrapped in a Sonar plugin and used there. [SonarQube is in the process of deprecating PMD rules](http://www.sonarqube.org/tag/pmd/) and having one artifact that can be used in both places is a huge plus for our team.

http://stackoverflow.com/comment/39609899
has text: Do you need to visit all the G point `before` reaching the D point, or you can visit them in any order? And the question is minimize the total distance to travel, or you just ask how to find the shortest path between two locations?
score: 0
comment on: http://stackoverflow.com/q/25395797
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39702369
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25429268
has text: I dont want to write a thing either! I was thinking about mod_rewrite (or mod_proxy as you said), but I *have to* use a Java base solution... the HTTP-Proxy-Servlet project looks great, I've played around with it today and it seems like it'll do everything I need!

http://stackoverflow.com/comment/39799349
score: 0
comment on: http://stackoverflow.com/q/25497590
type: Comment
has text: are you throwing away objects that you create? anything you can reuse?
type: QuestionComment

http://stackoverflow.com/q/25409103
has body: Why does the NetBeans precompiler give a warning for this? public class PrimitiveVarArgs { public static void main(String[] args) { int[] ints = new int[]{1, 2, 3, 4, 5}; prints(ints); } static void prints(int... ints) { for(int i : ints) System.out.println(i); } } It complains about line 5, saying: Confusing primitive array passed to vararg method but as far as I (and others on SO) know, int... is the same as int[]. This works if it's a non-primitive type, like String, but not on primitives. I can't even add this method: void prints(int[] ints) { for(int i : ints) System.out.println(i); } because the compiler says: name clash: prints(int[]) and prints(int...) have the same erasure cannot declare both prints(int[]) and prints(int...) in PrimitiveVarArgs Upon looking into the NetBeans hints settings, I find it says this: A primitive array passed to variable-argument method will not be unwrapped and its items will not be seen as items of the variable-length argument in the called method. Instead, the array will be passed as a single item. However, when I run the file (since it's just a warning and not an error), I get exactly the output I expect: 1 2 3 4 5 so, why doesn't NetBeans like me passing a native array to a varargs method?
has comment: http://stackoverflow.com/comment/39643946
downvote count: 3
has answer: http://stackoverflow.com/a/25414727
has title: Why does NetBeans warn about passing int[] to vararg?
accepted answer: http://stackoverflow.com/a/25414727
has comment: http://stackoverflow.com/comment/39634190
tagged with: java
has comment: http://stackoverflow.com/comment/39643870
has comment: http://stackoverflow.com/comment/39634279
tagged with: variadic-functions
favorite count: 0
tagged with: primitive-types
linked to: http://stackoverflow.com/q/25394998
has comment: http://stackoverflow.com/comment/39634382
linked to: http://stackoverflow.com/q/2426455
has comment: http://stackoverflow.com/comment/39634564
has comment: http://stackoverflow.com/comment/39634303
has comment: http://stackoverflow.com/comment/39647448
answer count: 1
tagged with: arrays
score: 6
has comment: http://stackoverflow.com/comment/39643079
has comment: http://stackoverflow.com/comment/39647684
has comment: http://stackoverflow.com/comment/39791059
has comment: http://stackoverflow.com/comment/39634490
type: Question
tagged with: netbeans-8
upvote count: 9
type: AnsweredQuestion

http://stackoverflow.com/q/25442098
type: Question
has comment: http://stackoverflow.com/comment/39700230
tagged with: processing
answer count: 0
type: UnansweredQuestion
tagged with: sockets
has title: Java Socket for multiplayergame server can't read data from a player
has body: for an exam i have to make a synchronous multiplayergame, to practice with the serverside, i decided to make a little sketch in processing where two clients exchange the mouse's positions. The idea is when two client are connected to the server, the server spawn a thread with the two connections, in the thread client send his data to server and server turn the data to the client, so the server is a simple bridge for the clients. This is the Java server code: import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class ProvaServerGioco { public final static int PORT = 31946; public final static int MAXPARTITE = 50; private Socket player1; private Socket player2; public final static char separatore = '\n'; public static final String INDIRIZZOHAMACHI = "25.166.111.50"; public static final String INDIRIZZOLAN = "192.168.1.65"; public void start() throws UnknownHostException { ExecutorService pool = Executors.newFixedThreadPool(MAXPARTITE); StringBuilder mouse=new StringBuilder(); InetAddress addr = InetAddress.getByName(INDIRIZZOHAMACHI); try (ServerSocket server = new ServerSocket(PORT, 0, addr)) { while (true) { { if (player1 == null) { try { player1 = server.accept(); System.out.println("Ryu"); Writer out = new OutputStreamWriter( player1.getOutputStream()); out.write("in attesa di giocatore 2" + separatore); out.flush(); } catch (IOException ex) { player1.close(); player1 = null; } } if (player2 == null) { try { player2 = server.accept(); System.out.println("Ken"); Writer out = new OutputStreamWriter( player2.getOutputStream()); out.write("in attesa di giocatore 2" + separatore); out.flush(); } catch (IOException ex) { player2.close(); player2 = null; } } if(!che…
tagged with: serversocket
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39698279

http://stackoverflow.com/q/25404403
has body: I have found many questions relating to dynamically creating buttons and at the same time, setting the OnClickListener for each but I have a different problem. I am making a game which uses buttons (77 of them to be exact) and I have created all of them in the XML page. Having all of them already created, I am looking for a working way to set all of the OnClickListeners for these buttons. So far I have tried using this method, and it crashes while "Traversing" the ViewGroup root in this code: private void setupMap() { LayoutTraverser.build(new LayoutTraverser.Processor() { @Override public void process(View v) { Log.e("c.getTag()", v.getTag().toString()); if(v.getTag()!=null){ int t = Integer.parseInt(v.getTag().toString()); if (t &gt;= 1 &amp;&amp; t &lt;= 77){ v.setBackgroundResource(Integer.parseInt(callRandomTarget().toString())); v.setOnClickListener(SharpShooterActivity.this); } } } }).traverse(root); } and here is what I set root to: root = (ViewGroup) findViewById(android.R.id.content); I have Logged root.toString()+" "i+" "+root.getChildCount() in the LayoutTraverser class and this is what it returns: 08-20 08:59:54.508: E/root count(24059): android.widget.FrameLayout{42f977f8 V.E..... ........ 0,195-1920,1080 #1020002 android:id/content} 0 1 08-20 08:59:54.508: D/AndroidRuntime(24059): Shutting down VM 08-20 08:59:54.508: W/dalvikvm(24059): threadid=1: thread exiting with uncaught exception (group=0x41beeda0) 08-20 08:59:54.518: E/AndroidRuntime(24059): FATAL EXCEPTION: main 08-20 08:59:54.518: E/AndroidRuntime(24059): Process: com.killmario, PID: 24059 08-20 08:59:54.518: E/AndroidRuntime(24059): java.lang.NullPointerException 08-20 08:59:54.518: E/AndroidRuntime(24059): at com.killmario.SharpShooterActivity$1.process(SharpShooterActivity.java:76) 08-20 08:59:54.518: E/AndroidRuntime(24059): at com.killmario.LayoutTraverser.traverse(LayoutTraverser.java:28) 08-20 08:59:54.518: E/AndroidRuntime(24059): at com.killmario.SharpShooterActivity.setupMap(SharpSh…
has comment: http://stackoverflow.com/comment/39625411
has comment: http://stackoverflow.com/comment/39625332
has answer: http://stackoverflow.com/a/25406329
accepted answer: http://stackoverflow.com/a/25406329
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39627168
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39625327
type: Question
has comment: http://stackoverflow.com/comment/39625270
has title: Accessing all Buttons to Dynamically to set the OnClickListener
tagged with: onclicklistener
has comment: http://stackoverflow.com/comment/39625058
has comment: http://stackoverflow.com/comment/39625081
answer count: 1
tagged with: button

http://stackoverflow.com/comment/76738752
score: 0
comment on: http://stackoverflow.com/q/25489113
type: Comment
has text: I didn't understand the question, I was reviewing old bungeecord questions to attempt to tag them correctly. You probably already know, but bungee can disambiguate based on the domain connected from, as well as listen on multiple ports.
type: QuestionComment

http://stackoverflow.com/comment/39802670
comment on: http://stackoverflow.com/a/25499705
score: 0
type: Comment
type: AnswerComment
has text: Thank u it solved my problem but now it shows `org.hibernate.QueryParameterException: could not locate named parameter [1]`

http://stackoverflow.com/comment/39689786
has text: why use `getResources` just to find the iD?? also post the activity_main.xml
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25439095
type: Comment

http://stackoverflow.com/a/25505852
answers question: http://stackoverflow.com/q/25505720
score: 8
has comment: http://stackoverflow.com/comment/39814300
type: AcceptedAnswer
downvote count: 1
upvote count: 9
accepted answer of: http://stackoverflow.com/q/25505720
type: Answer
has body: The no arg call of integer.toString() simply calls the static method Integer.toString(int i) (using the integer variables own primitive value), which is implemented as below; public static String toString(int i) { if (i == Integer.MIN_VALUE) return "-2147483648"; int size = (i &lt; 0) ? stringSize(-i) + 1 : stringSize(i); char[] buf = new char[size]; getChars(i, size, buf); return new String(0, size, buf); } First it checks whether it's value is == the lowest possible integer, and returns that if it is equal. If not, then it checks what size the String needs to be using the stringSize() method of Integer to use as the size of an array of characters. stringSize() implementation below; static int stringSize(int x) { for (int i=0; ; i++) if (x &lt;= sizeTable[i]) return i+1; } Once it has a char[] of the correct size, it then populates that array using the getChars() method, implemented below; static void getChars(int i, int index, char[] buf) { int q, r; int charPos = index; char sign = 0; if (i &lt; 0) { sign = '-'; i = -i; } // Generate two digits per iteration while (i &gt;= 65536) { q = i / 100; // really: r = i - (q * 100); r = i - ((q &lt;&lt; 6) + (q &lt;&lt; 5) + (q &lt;&lt; 2)); i = q; buf [--charPos] = DigitOnes[r]; buf [--charPos] = DigitTens[r]; } // Fall thru to fast mode for smaller numbers // assert(i &lt;= 65536, i); for (;;) { q = (i * 52429) &gt;&gt;&gt; (16+3); r = i - ((q &lt;&lt; 3) + (q &lt;&lt; 1)); // r = i-(q*10) ... buf [--charPos] = digits [r]; i = q; if (i == 0) break; } if (sign != 0) { buf [--charPos] = sign; } } Explaining each individual step would take far too long for for a stackoverflow answer. The most pertinent section however (as pointed out in the comments) is the getChars() method which, complicated bit shifting aside, is essentially process of elimination for finding each character. I am afraid I can't go into any greater detail than that without going beyond my own understanding.

http://stackoverflow.com/comment/39883253
score: 0
type: AnswerComment
has text: @jdphenix I misunderstood your comment, you meant in the memory layout. sorry. I believe you are correct here, I'll add an indication to that in the answer.
comment on: http://stackoverflow.com/a/25543346
type: Comment

http://stackoverflow.com/a/25504193
has body: The logs says: D:\software\flex_sdk_4.6\templates\express-installation-with-history does not exist. It is thrown due to the following line in build.xml: &lt;property name="wrapper.dir" location="${FLEX_HOME}/templates/express-installation-with-history"/&gt; Solutions: Extension of the file is missing, add it in build.xml. (.exe, .swz etc) File does not exist in the location. Check it in explorer, and place the file at the location. (D:\software\flex_sdk_4.6\templates\express-installation-with-history)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39823903
has comment: http://stackoverflow.com/comment/39825193
answers question: http://stackoverflow.com/q/25503939
score: 0
has comment: http://stackoverflow.com/comment/39823852
type: Answer
has comment: http://stackoverflow.com/comment/39824816
accepted answer of: http://stackoverflow.com/q/25503939

http://stackoverflow.com/a/28348514
type: Answer
score: 20
upvote count: 20
has comment: http://stackoverflow.com/comment/61104336
downvote count: 0
has comment: http://stackoverflow.com/comment/51674765
answers question: http://stackoverflow.com/q/25403012
has body: Works for me Open Command Prompt Type netstat -noa and hit Enter Check the "PID" of process that uses your port And type taskkill /PID "PID number" and hit Enter As @Mxsky stated: You may have to force the processus to quit with the /F option.So the command becomes: taskkill /PID pid_number /F Done. Now start the server

xml-namespaces
type: Tag
tags question: http://stackoverflow.com/q/25535462
tags question: http://stackoverflow.com/q/25479797
tag name: xml-namespaces

http://stackoverflow.com/q/25539540
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39876265
has answer: http://stackoverflow.com/a/25539732
has answer: http://stackoverflow.com/a/46481826
has comment: http://stackoverflow.com/comment/39876300
has answer: http://stackoverflow.com/a/25539606
tagged with: java
has comment: http://stackoverflow.com/comment/39876238
tagged with: hour
upvote count: 10
has comment: http://stackoverflow.com/comment/39876226
tagged with: calendar
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39876725
type: Question
has body: In the Java docs, Calendar.HOUR is supposed to return the hour in the 12 hour format, and Calendar.HOUR_OF_DAY is supposed to return the hour in the 24 hour format, but both of these are returning in the 12 hour format. My Code: Calendar rightNow = Calendar.getInstance(); int hour = rightNow.get(Calendar.HOUR_OF_DAY); System.out.println("hour: " + hour); There is a question that is similar to mine already, but there's is for a specific time and I'm attempting to do this with the current time. That question is here java HOUR and HOUR_OF_DAY both returning 12-hr time EDIT: If it matters, this is happening within Eclipse on Windows, within cmd.exe on Windows, and Terminal on Ubuntu. EDIT 2 Now I feel dumb... I didn't realize that I had multiple instances of calling the current time, and I was looking at the wrong one, which was HOUR_OF_DAY, but the one I was seeing in the console were being posted by just HOUR... Thanks for the help in the comments and the edit of my own post that led me to realize my mistake
has answer: http://stackoverflow.com/a/25539724
score: 9
has answer: http://stackoverflow.com/a/39541418
possible better answer: http://stackoverflow.com/a/25539606
linked to: http://stackoverflow.com/q/38922754
has title: Java Calendar Hour of Day Returning 12 Hour Format
has comment: http://stackoverflow.com/comment/39876315
answer count: 6
has answer: http://stackoverflow.com/a/25539864
accepted answer: http://stackoverflow.com/a/25539732

http://stackoverflow.com/comment/39668854
has text: You are missing the `MimeBodyPart` class. You can find the JAR here: http://www.java2s.com/Code/Jar/j/Downloadjavamailmailapi14jar.htm
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25427913
type: Comment

http://stackoverflow.com/comment/49311093
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25449103
type: Comment
has text: Here it is :) https://www.google.co.in/search?q=FormTag+source&ie=utf-8&oe=utf-8&gws_rd=cr&ei=iApvVfPIMMmwuASP14GoCg

http://stackoverflow.com/q/25538213
has body: I have a problem in changing the location of the accessory component in a filechooser. I customized a save file dialog by putting a check box in the accessory component of the file chooser. But the position of the check box is not good, it is really ugly. Can I move the accessory component to be underneath the file pane? How to do it? Or if you have other solution to do the same thing, also welcome. Thank you guys. I using following code to add the check box: JFileChooser fc = new JFileChooser(file) JPanel accessory = new JPanel(); JCheckBox isOpenBox = new JCheckBox("Open file after saving"); accessory.setLayout(new BorderLayout()); accessory.add(isOpenBox, BorderLayout.SOUTH); fc.setAccessory(accessory); In this screenshot, the position of the check box is not good. This screenshot is the exactly effect I want.
accepted answer: http://stackoverflow.com/a/25538945
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25538945
has comment: http://stackoverflow.com/comment/39874638
has comment: http://stackoverflow.com/comment/39874180
tagged with: jfilechooser
favorite count: 0
type: Question
upvote count: 4
has title: Change the location of the accessory component in a filechooser
has comment: http://stackoverflow.com/comment/39874675
tagged with: jcheckbox
tagged with: custom-component
linked to: http://stackoverflow.com/q/6758719
downvote count: 0
has comment: http://stackoverflow.com/comment/39874621
tagged with: swing
has comment: http://stackoverflow.com/comment/39875028
score: 4
type: AnsweredQuestion

http://stackoverflow.com/a/25499605
upvote count: 4
answers question: http://stackoverflow.com/q/25499425
has body: This problem has nothing to do with computers or Java, but with a little understanding of how dates are formatted in other parts of the world. Consider that European (and most other) countries use dd/MM/yyyy. This would mean that the date format would appear as Tue 26/8/2014 2:59 AM. The format you're showing us is MM/dd/yyyy, which I've only ever noticed in the United States. Then again, if that data is coming direct from an end user, you miss the case in which they may be lying to you - at that point, there's not much you can go off of. There's no formal library for this - unless you feel up to brute forcing every locale that Oracle knows about. It's a matter of understanding internationalization more than anything.
score: 4
downvote count: 0
type: Answer

http://stackoverflow.com/a/25446878
answers question: http://stackoverflow.com/q/25440882
has comment: http://stackoverflow.com/comment/39763079
has body: When you close a Session it will automatically close the underlying connection. You should also commit the Hibernate Transaction on success and rollback on failure. This will ensure that the database transaction is properly terminated. If you don't close teh Hibernate Session, then the JDBC connection won't be released. So when all hibernate.c3p0.max_size are being in use, you'll soon get the connection acquire connection exception. One other cause might be due to very long running queries. Check your queries as well. Make sure: 30 has an enough connection acquire timeout value.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25440882
type: Answer
score: 0

http://stackoverflow.com/comment/39738211
has text: post ur xml and how r u expecting to behave?
comment on: http://stackoverflow.com/q/25464992
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39755777
type: Comment
comment on: http://stackoverflow.com/q/25474517
score: 0
has text: nope, still the same errors
type: QuestionComment

http://stackoverflow.com/q/25525132
accepted answer: http://stackoverflow.com/a/25525406
tagged with: google-maps
downvote count: 8
score: -2
has answer: http://stackoverflow.com/a/25525406
tagged with: android
has title: Title on marker in android google map is not displayed
upvote count: 6
type: AnsweredQuestion
answer count: 1
tagged with: java
linked to: http://stackoverflow.com/q/15132174
favorite count: 0
type: Question
has body: In my android application I've added setOnMarkerClickLister on GoogleMap's object to display Toast notification. However now, the marker's title is not displayed. What could be the problem? Here is my code: @SuppressLint("NewApi") private void initilizeMap() { googleMap = ((MapFragment) getFragmentManager() .findFragmentById(R.id.map)).getMap(); googleMap.setOnMarkerClickListener(new OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { Toast.makeText(getApplicationContext(), "Your current location is" + marker.getTitle(), Toast.LENGTH_LONG).show(); return true; } }); }
duplicate of: http://stackoverflow.com/q/15132174

http://stackoverflow.com/q/25502605
accepted answer: http://stackoverflow.com/a/25502911
tagged with: android
tagged with: smali
has body: I want to delete the 580th and 581th line in the java code below. this file is in system/framework/services.jar in android devices, so the steps I did are: decompile jar to smali change the smali file recompile the smali file to dex file pack it into services.jar. push services.jar into android mobile phone The question is in step2, how to change the smali file, I tried to delete :line580 and the code below it, but it doesn't work, when compiling, a nullPointerExecption was thrown...and I can see /error/ in jd-gui tool Somebody please give me some advices, I'm totally new to smali, thanks in advance. The java code is: 568 public void registerUiTestAutomationService(IBinder owner, 569 IAccessibilityServiceClient serviceClient, 570 AccessibilityServiceInfo accessibilityServiceInfo) { 571 mSecurityPolicy.enforceCallingPermission(Manifest.permission.RETRIEVE_WINDOW_CONTENT, 572 FUNCTION_REGISTER_UI_TEST_AUTOMATION_SERVICE); 573 574 accessibilityServiceInfo.setComponentName(sFakeAccessibilityServiceComponentName); 575 576 synchronized (mLock) { 577 UserState userState = getCurrentUserStateLocked(); 578 579 if (userState.mUiAutomationService != null) { 580 throw new IllegalStateException("UiAutomationService " + serviceClient 581 + "already registered!"); 582 } 583 584 try { 585 owner.linkToDeath(userState.mUiAutomationSerivceOnwerDeathRecipient, 0); 586 } catch (RemoteException re) { 587 Slog.e(LOG_TAG, "Couldn't register for the death of a" 588 + " UiTestAutomationService!", re); 589 return; 590 } 591 592 userState.mUiAutomationServiceOwner = owner; 593 userState.mUiAutomationServiceClient = serviceClient; 594 595 // Set the temporary state. 596 userState.mIsAccessibilityEnabled = true; 597 userState.mIsTouchExplorationEnabled = false; 598 userState.mIsEnhancedWebAccessibilityEnabled = false; 599 userState.mIsDisplayMagnificationEnabled = false; 600 userState.mInstalledServices.add(accessibilityServiceInfo); 601 userState.mEnabledServices.clear(); 602 userState.mEnabled…
has answer: http://stackoverflow.com/a/25502911
tagged with: compilation
has title: how to modify smali code to delete 1 line in java code
type: AnsweredQuestion
score: 3
tagged with: recompile
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/q/25519336
tagged with: multithreading
answer count: 1
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/25519488
tagged with: swing
favorite count: 0
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8099098
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25519488
type: Question
has body: Is the tableChanged() call on a JTable thread safe, so that i am allowed to call it from another Thread, which for example finished downloading something? I imagine tableChanged() to just put a new Event into the Event queue, so that the Event-Dispatcher-Thread will update the JTable at some point in the future, but is this adding thread safe?
tagged with: jtable
tagged with: tablemodel
has title: JTableModelListener.tableChanged() thread safe?
has comment: http://stackoverflow.com/comment/39839540

http://stackoverflow.com/comment/39660023
has text: The error mentions a class foo.bar.fnorb.ServiceSupport, is this the class where you try to do the instantiation?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25423132

http://stackoverflow.com/q/25480011
has comment: http://stackoverflow.com/comment/39766214
has answer: http://stackoverflow.com/a/25488551
has title: Removing combobox as the cell editor of a jtable cell
answer count: 1
tagged with: tablecelleditor
has comment: http://stackoverflow.com/comment/39766255
tagged with: swing
has body: I have made a combobox as cell editor of a column. I want when i create a new row the cell in that column should not have the combobox as the cell editor and should retain JTextField as the cell editor. Here is what i have done so far. addRow(mainWindow.salesTable); final TableColumn items = mainWindow.salesTable.getColumnModel().getColumn(0); final JTextField tfield = new JTextField(); DefaultCellEditor editorqty = new DefaultCellEditor(tfield); items.setCellEditor(editorqty); private static void addRow(JTable table) { DefaultTableModel model = (DefaultTableModel) table.getModel(); Vector row = new Vector(); row.add(""); row.add(""); row.add(""); row.add(""); row.add(""); row.add(""); row.add(""); row.add(""); model.addRow(row); }
has comment: http://stackoverflow.com/comment/39766323
tagged with: jtable
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39768914
tagged with: java
has comment: http://stackoverflow.com/comment/39774987
accepted answer: http://stackoverflow.com/a/25488551
tagged with: jcombobox
type: Question

http://stackoverflow.com/q/25482833
has comment: http://stackoverflow.com/comment/39770964
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/39778731
has body: I have a stored procedure in SQL Server Database. I am trying to invoke it from java code. I am using hibernate SQLQuery to invoke the procedure. I am able to invoke and get the result properly. However, if I try to map the results to an entity, I am getting Hibernate Exception. I tried with different types for the id. Tried with long, Long, String. But everything is giving the same error. org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.myapp.reports.service.ProcBean.id Here is how I am invoking the procedure. List list = sessionFactory.getCurrentSession().createSQLQuery("{CALL SummaryReport(:ids, :EventDescriptionId, :DateFrom, :DateTo)}") .setParameter("ids","155") .setParameter("EventDescriptionId","299") .setParameter("DateFrom","2014-04-01") .setParameter("DateTo", "2014-05-01") .setResultTransformer(Transformers.aliasToBean(ProcBean.class)) .list(); Entity: public class ProcBean { private Long id; private Long total; private Double average; private Long minimum; private Long maximum; private Long startVal; private Long endVal; //and the setters }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39772295
has comment: http://stackoverflow.com/comment/39771309
linked to: http://stackoverflow.com/q/8302663
has comment: http://stackoverflow.com/comment/39771011
has comment: http://stackoverflow.com/comment/39771415
tagged with: stored-procedures
score: 0
answer count: 0
has title: Execute stored procedure from hibernate fails with PropertyAccessException

http://stackoverflow.com/comment/39712653
has text: @user3218114 @ortis, `color` is supposed to be a **Processing** primitive type, according to its reference doc, but actually it is none other than a simple 32-bit integer (see Swapnil answer below). The comparison with `int` in my post was just to give an example. Finally, I'm working with Processing, not just Java, so that's why I want to use `color` and not `java.awt.Color`. Thank you anyway!
score: 0
comment on: http://stackoverflow.com/q/25450916
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39870046
type: AnswerComment
comment on: http://stackoverflow.com/a/25501352
has text: You're welcome. Your problem is one argument against inheritance and towards composition. When inheriting large complex classes, there's always a danger of inadvertent method overrides that can lead to pernicious hard to detect errors. I ran into this in the past by giving a JPanel-extending class `getX()` and `getY()` methods. As an aside, you will want to avoid use of null layouts. You can easily center a component inside of another by giving the container a GridBagLayout, and then adding the component to the container in a default way, without GridBagConstraints.
score: 1
type: Comment

http://stackoverflow.com/a/25505637
score: 6
upvote count: 7
accepted answer of: http://stackoverflow.com/q/25463356
downvote count: 1
has comment: http://stackoverflow.com/comment/44317475
has comment: http://stackoverflow.com/comment/39816368
has comment: http://stackoverflow.com/comment/62543022
type: Answer
has comment: http://stackoverflow.com/comment/62542507
has comment: http://stackoverflow.com/comment/39818714
answers question: http://stackoverflow.com/q/25463356
has body: This is one way of putting together a suitable test. Firstly define an empty Camel Context with just a ProducerTemplate in it: &lt;camel:camelContext id="camelContext"&gt; &lt;camel:template id="producerTemplate" /&gt; &lt;/camel:camelContext&gt; I do this so that when I execute the test, I can control which routes actually start as I don't want all my routes starting during a test. Now in the test class itself, you'll need references to the producer template and Camel Context. In my case, I'm using Spring and I autowire them in: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:/spring/spring-test-camel.xml" }) public class MyTest { @Autowired private ProducerTemplate producerTemplate; @Autowired private CamelContext camelContext; In the test itself, replace the RabbitMQ/ActiveMQ/JMS component in the context with the seda or direct component. eg replace all JMS calls with a seda queue. camelContext.removeComponent("jms"); camelContext.addComponent("jms", this.camelContext.getComponent("seda")); camelContext.addRoutes(this.documentBatchRouting); Now whenever you are reading or writing to a JMS URI, it is actually going to a seda queue. This is similar to injecting a new URI into the component but take less configuration and allows you to add new endpoints to the route without worrying about remembering to inject all the URIs. Finally in the test, use the the producer template to send a test message: producerTemplate.sendBody("jms:MyQueue", 2); You're route should then execute and you can test your expectations. Two things to note are: Your transaction boundaries may change, especially if you replace JMS queues with a direct component If you are testing several routes, you'll have to be careful to remove the route from the Camel Context at the end of the tests for that route.
type: AcceptedAnswer

http://stackoverflow.com/a/25390345
score: 1
has comment: http://stackoverflow.com/comment/39599086
type: Answer
has comment: http://stackoverflow.com/comment/39599103
answers question: http://stackoverflow.com/q/25390294
downvote count: 0
upvote count: 1
has body: You have"jdbcqlserver" is your database URI. I don't know SQLServer, but i'm guessing you want "jdbcsqlserver" instead.

http://stackoverflow.com/comment/39616493
type: QuestionComment
score: 0
has text: Does it work from command line? e.g. `mysql -h X.X.60.X -u user dbname`?
comment on: http://stackoverflow.com/q/25399674
type: Comment

http://stackoverflow.com/comment/40133376
score: 0
type: QuestionComment
has text: I made some investigation with help of jet brains developers and it seems to be idea bug or some project misconfiguration which we were unable to identify.
type: Comment
comment on: http://stackoverflow.com/q/25547825

http://stackoverflow.com/a/25471361
downvote count: 0
type: AcceptedAnswer
has body: Using Gson, you can turn your Map into a JsonElement, which you can then parse in exactly the same way using fromJson: JsonElement jsonElement = gson.toJsonTree(map); MyPojo pojo = gson.fromJson(jsonElement, MyPojo.class); This is similar to the toJson method that you are already using, except that it avoids writing the JSON String representation and then parsing that JSON String back into a JsonElement before converting it to your class.
upvote count: 37
accepted answer of: http://stackoverflow.com/q/25447611
has comment: http://stackoverflow.com/comment/39753927
answers question: http://stackoverflow.com/q/25447611
type: Answer
score: 37

http://stackoverflow.com/q/25506006
has title: Facebook, gmail, twitter login with JSP
upvote count: 0
answer count: 2
tagged with: oauth
linked to: http://stackoverflow.com/q/23569036
type: UnansweredQuestion
score: -2
downvote count: 2
tagged with: jsp
has answer: http://stackoverflow.com/a/25506168
has answer: http://stackoverflow.com/a/77942510
tagged with: java
tagged with: facebook-oauth
has body: I followed this quesion How to authenticate users with facebook login in java but its hard to follow it. The Web application is dependent on Ejb application and therefore I am unable to run it on netbeans.
tagged with: servlets
favorite count: 0
type: Question

http://stackoverflow.com/comment/39856639
type: QuestionComment
comment on: http://stackoverflow.com/q/25529012
has text: It's hard to say. You measure the time for the response to start, but you aren't measuring the transmission time. I would suggest writing a TimingServlet then you can setup a [chain](http://docstore.mik.ua/orelly/java-ent/servlet/ch02_05.htm).
score: 2
type: Comment

http://stackoverflow.com/comment/39822598
type: AnswerComment
comment on: http://stackoverflow.com/a/25473836
has text: @user3664308 I have edited my question. look at the end. Thnankyou :)
type: Comment
score: 0

http://stackoverflow.com/q/25428780
has comment: http://stackoverflow.com/comment/39670392
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/25429100
has title: Java Find lowest value in 2d array of string
tagged with: arrays
has comment: http://stackoverflow.com/comment/39670503
has comment: http://stackoverflow.com/comment/39670793
score: -1
has comment: http://stackoverflow.com/comment/39670852
has body: I have an assignment in which I am using 2d array of string which contains student name, course/ subject and marks each student got in each course. I want to find the lowest value in each course e.g In Maths Student a got 78, Student b got 98, Student C got 55 and Student D got 81. I want my program to check the array and find the lowest marks in the array which is 55. Here is my program code I am working but it is not giving me exact results which I am expecting: String[][] resultCard = new String[][]{ { "", "A", "B", "C", "D", "E"}, { "Maths", "78", "98","55","81","65" }, { "Physics", "55", "65", "88", "80", "64"}, { "Java", "73", "66", "69", "79", "79"}, { "C#", "74", "78", "45", "73", "85"}, { "Ethics", "80", "90", "60", "70", "80"} }; double intresultCard=0; double resultCardAvg=0; int highest = 0; int temp=0; int lowest=0; for(row=1;row&lt;2;row++){ for(col=1;col&lt;resultCard.length;col++){ intresultCard += Integer.parseInt(resultCard[row][col]); resultCardAvg=intresultCard/5; } } for(row=1;row&lt;2;row++){ for(col=1;col&lt;resultCard.length-1;col++){ temp = Integer.parseInt(resultCard[row][col]); if(highest&lt;temp){ highest=temp; } } } for(row=1;row&lt;2;row++){ for(col=1;col&lt;resultCard.length-1;col++){ temp = Integer.parseInt(resultCard[row][col]); lowest = Integer.parseInt(resultCard[row][col+1]); if(lowest&gt;temp){ lowest=temp; } System.out.println("The marks in temp are "+temp+ " &amp; marks in lowest are "+lowest); } }
has answer: http://stackoverflow.com/a/25429082
possible better answer: http://stackoverflow.com/a/25429082
has comment: http://stackoverflow.com/comment/39670382
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/39670406
has comment: http://stackoverflow.com/comment/39672703
accepted answer: http://stackoverflow.com/a/25429100
upvote count: 1
tagged with: java
downvote count: 2
favorite count: 0
type: Question

http://stackoverflow.com/comment/39927461
comment on: http://stackoverflow.com/q/25526562
type: Comment
type: QuestionComment
has text: Yes I think I will try to go that way for now and try to load it when needed and remove it afterwards. It seems to be best. But the whole thing is very complex.
score: 0

http://stackoverflow.com/a/25548732
type: Answer
has body: The items can be requested first for measure/layout purposes, and then later again to be actually attached to the list view. If your listview is in a layout that requires multiple measure/layout passes, such as LinearLayout with weights, you'll get even more requests for views in your adapter. To learn why the getView() method is called, put a debugger breakpoint there and examine the call stack.
answers question: http://stackoverflow.com/q/25548586
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25456924
has answer: http://stackoverflow.com/a/25456964
has answer: http://stackoverflow.com/a/25456944
has comment: http://stackoverflow.com/comment/39723322
downvote count: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/218384
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/218384
score: -1
has title: What is the reason for this Java NullPointerException?
has answer: http://stackoverflow.com/a/25457503
has body: I seem to get a NullPointerException in my code at line 15, but I just cannot understand why. I have been stuck on this for some hour now, and I don't know how to fix it. I have read up on what NullPointerException is, and I think I have a clear grasp of what it is, but I thought my if-statement would fix it, but apparently not. Here is the code: package learning; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Scanner; public class Index{ public static void main(String args[]){ Index indexObject = new Index(); String filePath = "C:\\Users\\Edvin\\Desktop\\inputPrices.txt"; Scanner inputScanner = new Scanner(System.in); int average = 0; if(indexObject != null){ average = indexObject.findAverage(getFileInfo(filePath).split(",")); } else{ System.out.println("Object instance is null. Terminating program."); } int currentItemInput = inputScanner.nextInt(); if(currentItemInput&lt;average &amp;&amp; currentItemInput != 0){ } } private static String getFileInfo(String x){ File listOfPrices = new File(x); String error = "An error occurred"; try{ BufferedReader getInfo = new BufferedReader(new FileReader(listOfPrices)); String prices = getInfo.readLine(); while(prices != null){ prices = getInfo.readLine(); } return prices; } catch(FileNotFoundException e){ System.out.println("Couldn't find File"); System.exit(0); return error; } catch(IOException e){ System.out.println("An I/O error occurred"); System.exit(0); return error; } } public int findAverage(String[] tempIndivPrices){ int x = 0; int y = 0; int total; int [] indivIntPrices = null; for(String i : tempIndivPrices){ indivIntPrices[x] = Integer.parseInt(tempIndivPrices[x]); x++; } for (int element : indivIntPrices){ total =+ indivIntPrices[element]; if(element==indivIntPrices.length-1){ int result = total / indivIntPrices.length; System.out.println(result); return result; } } return 0; } }
has comment: http://stackoverflow.com/comment/39723333
has comment: http://stackoverflow.com/comment/39723274
upvote count: 0
tagged with: nullpointerexception
answer count: 3
has comment: http://stackoverflow.com/comment/39723304
tagged with: java

http://stackoverflow.com/a/25448376
has body: An idiomatic solution with Java 8 streams: import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; public class SplitWordCount { public static void main(String[] args) { List&lt;String&gt; terms = Arrays.asList( "Coding is great", "Search Engines are great", "Google is a nice search engine"); Map&lt;String, Integer&gt; result = terms.parallelStream(). flatMap(s -&gt; Arrays.asList(s.split(" ")).stream()). collect(Collectors.toConcurrentMap( w -&gt; w.toLowerCase(), w -&gt; 1, Integer::sum)); System.out.println(result); } } Note that you may have to think about whether upper/lower case of the strings should play a role. This one onverts the strings to lower case, and uses them as the keys for the final map. The result is then: {coding=1, a=1, search=2, are=1, engine=1, engines=1, is=2, google=1, great=2, nice=1}
score: 10
type: Answer
accepted answer of: http://stackoverflow.com/q/25448145
has comment: http://stackoverflow.com/comment/39706465
answers question: http://stackoverflow.com/q/25448145
has comment: http://stackoverflow.com/comment/39706418
has comment: http://stackoverflow.com/comment/39706779
type: AcceptedAnswer
downvote count: 0
upvote count: 10
has comment: http://stackoverflow.com/comment/39706713

http://stackoverflow.com/comment/39712627
score: 2
has text: Well, calling `getItemCount()` isn't going to give you the selected food or beverage.
comment on: http://stackoverflow.com/q/25451481
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40007486
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25505138
has text: I am using the most recent CometD V 3.0.1 and the Jetty that comes with it (I believe it's Jetty 9?) What configurations should I provide?
score: 0

http://stackoverflow.com/comment/39882305
type: Comment
comment on: http://stackoverflow.com/q/25542849
type: QuestionComment
score: 0
has text: @Squonk, Oh, ok... I always saw it (not only in Android but for J2EE website and other things) so I assumed it was mandatory... At least in C# the override keyword is mandatory, I think.

http://stackoverflow.com/comment/39737162
type: Comment
comment on: http://stackoverflow.com/q/25464257
type: QuestionComment
has text: Yes, but holding a reference to the IBinder isn't going to accomplish much, AudioPlayerBinder should have a getService() method that retrieves the enclosing Service instance, and a reference to the Service instance is typically stored as a member variable in the Activity.
score: 0

http://stackoverflow.com/comment/39807997
score: 0
type: Comment
type: AnswerComment
has text: I'd recommend running the code and putting a breakpoint in at the start of the `mapPcm16bitLittleEndian2Float` method, and depending on your IDE you should be able to see the size of the array. If you're not using one, you could just print the values to console.
comment on: http://stackoverflow.com/a/25502648

http://stackoverflow.com/q/25392781
upvote count: 0
answer count: 1
has body: I just started learning Java and now i got stuck with a Problem i can´t solve. I installed Eclipse and when i try to create a new java Project i get an Error: Could not load any rescource Bundle by: "com.sun.org.apache.xerces.internal.impl.msg.DOMMessages". Dont know whats wrong here. I tried to install another Version of Java, but that didn´t help. I am using Eclipse 4.4 for Win 64bit and Java Version 8 for Win 64bit too. Hope youn can help Thanks. Felix
downvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: project
tagged with: java
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/25392827
has title: How to solve this error when creating a Java Project

http://stackoverflow.com/comment/39609547
score: 1
type: Comment
has text: Try Apache's countMatches https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html#countMatches(java.lang.String, java.lang.String)
type: AnswerComment
comment on: http://stackoverflow.com/a/25395636

http://stackoverflow.com/comment/39687509
has text: Turn on tracing, then run TKPROF.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25435849
score: 1

generator
type: Tag
tag name: generator
tags question: http://stackoverflow.com/q/25539525

http://stackoverflow.com/comment/39680491
has text: so, the only solution is a custom converter?
comment on: http://stackoverflow.com/q/25433862
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39880383
has text: you need to post your json
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25542004
type: Comment

http://stackoverflow.com/comment/39606645
comment on: http://stackoverflow.com/q/25392025
score: 0
type: Comment
type: QuestionComment
has text: What version of Jersey are you using and what serializer? There were bugs in Jersey prior to 2.6 using MOXy with the very scenario.

http://stackoverflow.com/a/25463498
accepted answer of: http://stackoverflow.com/q/25463427
type: Answer
has body: Your code doesn't work because you have misspelled NaN; NaN is spelled with a little a. In your code you have var a=isNAN(mo); at line 16. Change it to var a=isNaN(mo);.
has comment: http://stackoverflow.com/comment/39735944
score: 0
answers question: http://stackoverflow.com/q/25463427
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39735990
has comment: http://stackoverflow.com/comment/39736167
has comment: http://stackoverflow.com/comment/39735897

http://stackoverflow.com/comment/39858072
type: QuestionComment
comment on: http://stackoverflow.com/q/25509366
type: Comment
score: 0
has text: it's not the server's job to tell the client how fast/slow things are going. and yes, normally a server SHOULD know how big the file it's sending is, but it's not required information. e.g. a webserver dynamically building a pdf or a zip won't know how big the file is because the file's being constructed and sent out on the wire on-the-fly.

http://stackoverflow.com/a/25541108
upvote count: 1
answers question: http://stackoverflow.com/q/25541053
downvote count: 0
score: 1
type: Answer
has body: when you are using writeChars you are not writing A string you are writing a series of primitives. Use writeObject instead. As per javaDocs public void writeChars(String str) throws IOException Writes a String as a sequence of chars.

http://stackoverflow.com/comment/39806533
score: 0
has text: You can accept your answer or, if you post the Property class, I can write one with @JsonCreator used.
type: AnswerComment
comment on: http://stackoverflow.com/a/25493206
type: Comment

http://stackoverflow.com/q/25502169
has answer: http://stackoverflow.com/a/25518474
accepted answer: http://stackoverflow.com/a/25518474
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25520395
possible better answer: http://stackoverflow.com/a/25520395
has title: Not able to write output in the excel file using poi in selenium code
tagged with: selenium-webdriver
has body: I am writing a code to fetch data from an excel sheet and run selenium tests on it and write the output in a different excel file. But I am not able to view the output in the output file. I am getting error as excel found unreadable content in .xlsx message after java code. package new_excel_package; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Date; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.eclipse.debug.core.model.MemoryByte; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class PoiReadExcelFile { public static void main(String[] args) { try { WebDriver driver = new FirefoxDriver(); FileInputStream fileInputStream = new FileInputStream("D://new.xlsx"); XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream); XSSFSheet worksheet = workbook.getSheet("check"); FileOutputStream fileOut = new FileOutputStream("D://test.xlsx",true); XSSFWorkbook workbook_out = new XSSFWorkbook(); XSSFSheet worksheet_out = workbook_out.createSheet("Worksheet"); MemoryByte ms = new MemoryByte(); for(int i = 0; i &lt; worksheet.getLastRowNum()+1;i++) { XSSFRow row = worksheet.getRow(i); //System.out.println(row.toString()); int r = worksheet_out.getLastRowNum(); XSSFRow row1 = worksheet_out.createRow(r+1); XSSFCell cell_user = row.getCell(0); String user_names = cell_user.getStringCellValue(); CharSequence[] user_name = {cell_user.getStringCellValue()}; System.out.println("fetched username"); XSSFCell cell_mail = row.getCell(1); String e_mails = cell_mail.getStrin…
type: AnsweredQuestion
score: 0
answer count: 2

http://stackoverflow.com/comment/39656671
type: AnswerComment
comment on: http://stackoverflow.com/a/25420476
type: Comment
score: 0
has text: I'm against everything implicit in the code. Preprocessing is making code complex, is modifying the program flows in not predicted way. It is hard to maintain. It is hard to navigate and follow code especially if you're in eclipse

http://stackoverflow.com/comment/39610958
comment on: http://stackoverflow.com/a/25395328
type: Comment
score: 0
has text: ``SwingWorker#get` is a block method, it blocks the current thread until the `doInBackground` method has completed. Because this is called from within the EDT, it's blocking the EDT and preventing it from performing any updates...
type: AnswerComment

http://stackoverflow.com/comment/39685373
has text: If I use: `Runtime.getRuntime.exec()` without `Process` does work, but create `reg.exe` on task monitor and doesn't close this task.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25435106
score: 0

http://stackoverflow.com/comment/39613918
comment on: http://stackoverflow.com/q/25397377
score: 0
type: Comment
type: QuestionComment
has text: Ok, so I understand the problem is with the parsing done with Apache POI. Unfortunately I do not use it, and won't be able to help you :-( But I've proposed you an edit to your post. Feel free to edit it again if what I wrote is not exactly what you would have said.

http://stackoverflow.com/q/25406278
tagged with: udp
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29760019
tagged with: java
tagged with: jce
has answer: http://stackoverflow.com/a/25406438
has title: DTLS vs encrypting UDP datagrams with JKS/JCE
tagged with: datagram
accepted answer: http://stackoverflow.com/a/29760019
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25406438
has body: I need an encrypted UDP connection in Java. I know about DTLS, but it is problematic in Java. So I would much prefer to do my own encryption using JKS or JCE. Why UDP? Some lost packets or reordering doesn't concern me, but latency does. So far I have this concept: The server creates a temporary symmetric encryption key (unique for the session), encrypts it with the public key of the client (asymmetric encryption) and sends it to the him. The rest of the session they communicate with datagrams encrypted using the symmetric key only. What are the disadvantages of using this approach as opposed to DTLS? Speed? Security?
tagged with: dtls

http://stackoverflow.com/q/25422084
type: Question
tagged with: jakarta-ee
has title: HeadlessException thrown by Apache Batik 1.7 WMFTranscoder
score: 0
has answer: http://stackoverflow.com/a/25532674
has comment: http://stackoverflow.com/comment/39862318
tagged with: exception
has comment: http://stackoverflow.com/comment/39860265
tagged with: java
has body: I use this code successfully in a Java desktop application (JUnit tests in NetBeans) to generate SVG from WMF data: InputStream wmfStream = new ByteArrayInputStream(wmfBytes); WMFTranscoder transcoder = new WMFTranscoder(); TranscoderInput wmf = new TranscoderInput(wmfStream); ByteArrayOutputStream bos = new ByteArrayOutputStream(); TranscoderOutput svg = new TranscoderOutput(new OutputStreamWriter(bos, "UTF-8")); transcoder.transcode(wmf, svg); return bos.toByteArray(); If I execute the conversion in GlassFish, a headless exception is thrown: java.awt.HeadlessException at sun.awt.HeadlessToolkit.getScreenResolution(HeadlessToolkit.java:224) at org.apache.batik.transcoder.ToSVGAbstractTranscoder.(ToSVGAbstractTranscoder.java:96) ... 33 more How can I use Apache Batik WMF to SVG conversion in a 'headless' Java runtime environment? The accepted answer Having problems with Apache Batik library on AWS ElasticBeanstalk Instance suggests to use a Sun JDK. However, I am already running GlassFish 4.0.1 on Oracle JDK 1.7 u 65.
linked to: http://stackoverflow.com/q/7940455
answer count: 2
has answer: http://stackoverflow.com/a/25531212
has comment: http://stackoverflow.com/comment/39862802
type: UnansweredQuestion
tagged with: batik
tagged with: awt

http://stackoverflow.com/a/25454688
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25454673
answers question: http://stackoverflow.com/q/25454673
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/39718911
upvote count: 4
has body: The sub-class can't access the private members of the super-class, unless you have getters for them. What you could you is : @Override public String toString() { return super.toString() + " " + numberOfDoors + " doors"; }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39718875

http://stackoverflow.com/q/25460410
answer count: 1
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/25460584
has comment: http://stackoverflow.com/comment/39732236
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39730067
has body: Is it possible that i run a mysql insert query and it doesn't give any exception , and still it doesn't entry to my sql. and the query is ok. if still it happens then what are the conditions when this can be happen?
score: 0
has title: Insert query neither executed or neither gives exception
tagged with: scala
tagged with: java

http://stackoverflow.com/q/25492586
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/19209650
has title: Drawing multiple images with Graphics in Java
score: 0
has comment: http://stackoverflow.com/comment/39791740
tagged with: java
has comment: http://stackoverflow.com/comment/39791611
has comment: http://stackoverflow.com/comment/39789779
has body: I want to create a test project to improve my Graphics in Java. What my goal is, is to do a simple Tic Tac Toe game wich the player can input using Numpad where they want their next move. What I am doing now is I am drawing the Background to the frame / layout for Tic Tac Toe. When I try to draw the X or the O on top of the background/layout it won't show up. I also tried to paint the X and O next to the background but it just won't work. Should I update it and if so how do I update it or is it just not possible. I just can't figure it out. I have 4 separate classes for this. The first class is Frame. Second Background. Third InputHandler. Fourth Turn. Here is the code: Frame package Game; import java.awt.GridLayout; import javax.swing.JFrame; public class Frame extends JFrame { private Background bg; private Turn trn; private InputHandler in; public Frame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(500, 500); setResizable(false); setTitle("Hi"); init(); } public void init() { setLocationRelativeTo(null); setLayout(new GridLayout(1, 1, 0, 0)); bg = new Background(); add(bg); trn = new Turn(); add(trn); setVisible(true); in = new InputHandler(); addKeyListener(in); } public static void main(String[] args) { new Frame(); } } Background package Game; import java.awt.Graphics; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import javax.swing.JPanel; public class Background extends JPanel { private BufferedImage image; public Background() { try { image = ImageIO.read(getClass().getResourceAsStream("/tiles/tile_TicTacToeGrid.png")); } catch (Exception e) { System.out.println("File not found.\n\n" + e); } repaint(); } public void paint(Graphics g) { // Drawing to screen g.drawImage(image, 0, 0, null); } } InputHandler package Game; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.image.BufferedImage; public class InputHandler implements KeyListener { private Turn turn; public InputHandler() { turn = new …
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/39790303
answer count: 0

http://stackoverflow.com/comment/39724880
type: QuestionComment
has text: Where are lines 14, 23 and 27?
type: Comment
comment on: http://stackoverflow.com/q/25457767
score: 0

http://stackoverflow.com/q/25533908
tagged with: multithreading
has answer: http://stackoverflow.com/a/25533952
has answer: http://stackoverflow.com/a/25534237
has comment: http://stackoverflow.com/comment/39865471
tagged with: synchronized
answer count: 4
score: 0
has title: Multiple Threads accessing a non synchronised Map
tagged with: java
tagged with: synchronization
has body: I am facing this issue, I have two classes A and B , 'class A' has two Threads t1 and t2 and its trying to access 'Class B' map as below now the problem is, I can not make any changes on class B' map hence I can not use synchronised keyword or I can not put it in synchronised method. So my doubt is, is there any other way to synchronise this map. public class A{ static B b = new B(); public static void main(String[] args) { Thread t1 = new Thread(new Runnable() { @Override public void run() { Map&lt;Integer,String&gt; map = Collections.synchronizedMap(b.getMap()); map.put(1, "one"); map.put(2, "two"); map.put(3, "three"); b.setMap(map); } }); Thread t2 = new Thread(new Runnable() { @Override public void run() { Map&lt;Integer,String&gt; map = Collections.synchronizedMap(b.getMap()); map.put(4, "four"); map.put(5, "five"); map.put(6, "six"); b.setMap(map); } }); t1.start(); t2.start(); try { t1.join(); t2.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } for(Map.Entry&lt;Integer, String&gt; entry : b.getMap().entrySet()){ System.out.println(entry.getKey() + ":" + entry.getValue()); } } I am using LinkedHashMap, only to track the order of insertion (ignore performance issues) public class B{ private Map&lt;Integer,String&gt; map = new LinkedHashMap&lt;Integer,String&gt;(); public Map&lt;Integer,String&gt; getMap() { return map; } public void setMap(Map&lt;Integer,String&gt; map) { this.map = map; } }
type: Question
has answer: http://stackoverflow.com/a/25534135
has answer: http://stackoverflow.com/a/25534326
type: UnansweredQuestion

http://stackoverflow.com/comment/39602497
type: AnswerComment
has text: ok got it, sorry about that error. but can one of you tell my why is last set to null and not first instead?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25392059

http://stackoverflow.com/a/25469943
type: AcceptedAnswer
has body: Add the following line after Server, LINE 68: os.flush() the client will show the expected "Enter your name". Both server and client are waiting for input, thus sitting in a deadlock. You must call os.flush() to actually sed your data to the server. Your server code writes to output but doesn't send it: Server, LINE 68: os.println("Enter Your Name:"); Then the client hangs because the server didnt send it via os.flush() at: Client, LINE 37: response = is.readLine(); while your server is also waiting for the clients answer at Server, LINE 69: Name = is.readLine(); Source for the os.flush command was this sample code: https://stackoverflow.com/a/5680427/3738721
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25469552
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25469552

http://stackoverflow.com/comment/39775498
score: 0
type: AnswerComment
has text: what if i want to override that class in AllTest? at that time it makes some problem.
type: Comment
comment on: http://stackoverflow.com/a/25485176

http://stackoverflow.com/comment/39705037
type: QuestionComment
comment on: http://stackoverflow.com/q/25447702
score: 0
has text: Of course that is the case. That's not the question you want to ask. The question you want to ask is: can the conversion of 5000 records to entity objects be the source of the extra overhead. The answer to that is: no. The difference is not going to be minutes.
type: Comment

http://stackoverflow.com/q/25465186
upvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25468446
tagged with: spring
type: AnsweredQuestion
has title: Error message is not displayed in the Spring MVC validator
has body: My code is as below, when I enter input field as wrong value then validator invalidates the input bean values, but in view error message is not displayed. COntroller @RequestMapping(value = "/AddInventory.html", method = RequestMethod.POST) public ModelAndView inventorymgmt(@Valid Itemtype itemTypeForm, BindingResult result, Map<String, Object> model) throws Exception { logger.log(Level.OFF, "Add Inventory called with inventory details ####### ." + itemTypeForm); if (result.hasErrors()) { logger.log(Level.OFF, "Error occured while inserting the reconrd for the item type." + result.getAllErrors()); ModelAndView modelAndView = new ModelAndView("add-item_category"); modelAndView.addAllObjects(model); return modelAndView; } else { logger.log(Level.OFF, "Insert result ####### ." + itemTypeDAO.insert(itemTypeForm)); return new ModelAndView("redirect://item_category.html"); } } View <form:form action="AddInventory.html" method="POST" commandName="itemTypeForm"> <form:errors path="*" cssClass="errorblock" element="div" /> Item Category Name: <form:input type="text" class="form-control" path="name" placeholder="Name"/> <form:errors path="name" cssClass="error" /> Description: <form:input type="text" class="form-control" path="description" placeholder="Description"/> <form:errors path="description" cssClass="error" /> <form:input type="text" class="form-control" path="name" placeholder="Name"/> <form:errors path="name" cssClass="error" /> <form:input type="text" class="form-control" path="description" placeholder="Description"/> Save Cancel Save Cancel </form:form> Bean package com.tss.ocean.pojo; // Generated 4 Aug, 2014 6:30:10 PM by Hibernate Tools 3.2.1.GA import javax.validation.constraints.Size; import org.hibernate.validator.constraints.NotEmpty; /** * Itemtype generated by hbm2java * * @author Bhavik Ambani */ public class Itemtype implements java.io.Serializable { private Integer id; @NotEmpty(message = "Please enter item name.") @Size(min = 10, max = 45, message = "…
score: 1
tagged with: validation
has answer: http://stackoverflow.com/a/25468446
tagged with: java
tagged with: hibernate
downvote count: 0
answer count: 1
tagged with: error-handling

http://stackoverflow.com/q/25472446
has title: How to simplify java code by moving from inheritance to composition
tagged with: enums
has body: I wrote the bottom level classes of multilevel inherited class but confused how to combine them to a single program. Someone suggested me to use composition instead of inheritance, and someone suggested to use enum to create anonymous subclass instead of complex inheritance structure. How can we use composition in place of inheritance or use enum instead of the inheritance that I used? What Should I do to simplify problem and How should it be done? I am using Java to write a code to calculate tax. I am having base class TaxPayer. Taxpayer can have multiple incomeSource. There can be many types of TaxPayer or IncomeSource. There can be many income headings for each income source which is used to calculate taxableIncome. taxRate will be different for different type of taxPayer and taxableIncome. Final result will be taxRate applied to taxableIncome. Base class Taxpayer is defined as public abstract class TaxPayer { private List&lt;IncomeSource&gt; incomeSource; double taxRate; Address address; other attributes here; public Double getTaxRate(){ return 0.25; //default tax rate } } public abstract class IncomeSource { private String incomeSourceName; private Double incomeHeading1, incomeHeading2, incomeHeading3, ...; private Double taxableIncome = incomeHeading1 + incomeHeading2 - incomeHeading3; } There can be some subclass of IncomeSource with different income headings. Similarly tax payer type can be modeled into following inheritance structure Base Class: Taxpayer * IndividualPerson * Male, Female, OldAge * Business * Bank, ITIndustry, HydroElectricIndustry * TaxFree * SocialOrganization, ReligiousOrganization, PoliticalParty etc. The subclasses of TaxPayer generally modifies the taxRate to be applied to taxableIncome and sometimes changes taxableIncome with some logic. For an example: abstract class IndividualPerson extends TaxPayer{ if (incomeSource.taxableIncome &gt; 250000) taxRate = ratex; if (incomeSource.taxableIncome &gt; 500000) taxRate = ratey; @override pu…
tagged with: composition
tagged with: inheritance
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39755148
score: 2
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25569248
accepted answer: http://stackoverflow.com/a/25569248
tagged with: java
possible better answer: http://stackoverflow.com/a/25832848
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25832848
has comment: http://stackoverflow.com/comment/39931776

http://stackoverflow.com/comment/39828961
comment on: http://stackoverflow.com/q/25494507
has text: @geoand Added a small representation of the structure: 4 maven projects separated as Parent POM with two modules and a separate project which depends on the service module.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25534631
accepted answer: http://stackoverflow.com/a/25610821
has answer: http://stackoverflow.com/a/25610821
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39867606
tagged with: java
has comment: http://stackoverflow.com/comment/39866841
has answer: http://stackoverflow.com/a/25535432
has comment: http://stackoverflow.com/comment/39891919
score: -6
favorite count: 0
type: Question
has title: Given the parameter cipher as the cipher to be decoded
answer count: 2
upvote count: 0
possible better answer: http://stackoverflow.com/a/25535432
has body: A cipher is a secret text that represents a message. In this question, each character in the original message is represented by a String of 6 characters in the cipher. For example, the text "java", which consists of 4 characters, is represented as a 24-character string in the cipher: kjdktizldzaecvyrvwaaemgk In this question, you are tasked to complete the method decipher(String) for decoding the cipher by using the method decipherChar(String) given below. /** * This method decodes a 6-character input String into a single character. * The first and second halves of the input String are compared lexicographically. * The middle character of the smaller half is then returned. * In case of equal halves, a space character is returned. * * @param inputStr The 6-character String to be decoded. * @return The decoded character. */ public static char decipherChar(String inputStr) { // implementation not shown here } Instructions Given the parameter cipher as the cipher to be decoded. Check if the cipher is valid. If the cipher is an empty String, return the String message "no cipher". If the cipher does not have a length divisible by 6, return the String message "invalid cipher". If the cipher is valid, decode each 6-character sub-string of the cipher into a character of the original message by using the given method decipherChar(String). The decipherChar(String) method takes in a String of length 6 and returns the decoded character. Concatenate all the decoded characters and return the original message.

http://stackoverflow.com/comment/39703099
type: Comment
score: 0
type: AnswerComment
has text: The getProp/setProp method should work. However It doesn't sound like a good idea to code some path in java classes. If you really want to do that define at least your own property to update the lib path. I also read that something like that can be done -Djava.library.path=${system_property:java.library.path} However I don't manage to make it work.
comment on: http://stackoverflow.com/a/25419865

http://stackoverflow.com/comment/39800248
score: 0
has text: @Raghu The problem you have asked is actually answered. You need to figure out other problems by yourself or post new questions.
type: Comment
comment on: http://stackoverflow.com/a/25498140
type: AnswerComment

http://stackoverflow.com/q/25501746
has comment: http://stackoverflow.com/comment/39806271
has comment: http://stackoverflow.com/comment/39806442
has answer: http://stackoverflow.com/a/25501929
answer count: 1
has body: as you can see in the picture I'm setting up a table which shows all files from a specific path (later I'll implement a filter for pdf files only). First, all files are simultaneously shown, but I want to see each single file of the path during the build up of the table. So I've changed it to a array list, but there a two errors which I really couldn't resolve... Hope that you can help me ;-) class FileModel extends AbstractTableModel implements FilenameFilter { String titles[] = new String[] { "Path" }; Class&lt;?&gt; types[] = new Class[] { String.class, String.class }; private List&lt;Object[]&gt; data = new ArrayList&lt;&gt;(); public FileModel() { this("C:\\"); } public FileModel(String dir) { File pwd = new File(dir); setFileStats(pwd); } // Implement the methods of the TableModel interface we're interested // in. Only getRowCount(), getColumnCount() and getValueAt() are // required. The other methods tailor the look of the table. @Override public int getRowCount() { return this.data.size(); } @Override public int getColumnCount() { return this.titles.length; } @Override public String getColumnName(int c) { return this.titles[c]; } @Override public Class&lt;?&gt; getColumnClass(int c) { return this.types[c]; } @Override public Object getValueAt(int r, int c) { return this.data.get(r)[c]; } // Our own method for setting/changing the current directory // being displayed. This method fills the data set with file info // from the given directory. It also fires an update event so this // method could also be called after the table is on display. public void setFileStats(File dir) { System.out.println("SET MY DIR " + dir); this.data = new ArrayList&lt;&gt;(); this.fireTableDataChanged(); String files[] = dir.list(); this.data = new Object[files.length][this.titles.length]; **// Here error #1** for (int i = 0; i &lt; files.length; i++) { File tmp = new File(files[i]); this.data[i][0] = tmp.getAbsolutePath(); **// Here error #2** } this.fireTableDataChanged(); } @Over…
has title: How to use a variable which is used in an ActionListener?
tagged with: swing
has comment: http://stackoverflow.com/comment/39806261
tagged with: arraylist
tagged with: jtable
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25501929
tagged with: java
has comment: http://stackoverflow.com/comment/39806489
has comment: http://stackoverflow.com/comment/39806516
type: Question

http://stackoverflow.com/a/26158390
downvote count: 0
has body: FYI: Perhaps there are also webservices to do this. For example: http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/default.aspx shows if there are entries for domain xy. Perhaps you can parse and use them. But please check out if you are allowed to use this webservices.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41042230
answers question: http://stackoverflow.com/q/25521287
type: Answer

http://stackoverflow.com/q/25501777
has title: Why the numeric promotion of integer and double operands not happen?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25501859
possible better answer: http://stackoverflow.com/a/25502108
has answer: http://stackoverflow.com/a/25502108
type: AnsweredQuestion
answer count: 2
has body: In my recent work, I met a question, which is about the numeric promotion of some operands. The following is the demo code: int num1 = 9999999; int num2 = 65536; double result = num1*num2*1.0; In my opinion, I thought both of num1 and num2 will be automatically promotion to double and then calculate the result as one of the operands is a double, while the result shocked me. I got a negative number. And then I look into the JLS, it also says it should do the numeric promotion, see below: "If at least one of the operands to a binary operator is of floating-point type, then the operation is a floating-point operation, even if the other is integral. If at least one of the operands to a numerical operator is of type double, then the operation is carried out using 64-bit floating-point arithmetic, and the result of the numerical operator is a value of type double. If the other operand is not a double, it is first widened (§5.1.5) to type double by numeric promotion (§5.6). Otherwise, the operation is carried out using 32-bit floating-point arithmetic, and the result of the numerical operator is a value of type float. (If the other operand is not a float, it is first widened to type float by numeric promotion.)" And if I change the result to 1.0*num1*num2, it will give me the right answer. Could anybody tell me what the hell is this.
score: 1
tagged with: java
downvote count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/25501859

http://stackoverflow.com/a/25478478
upvote count: 1
downvote count: 1
has body: you overrided the value of type in class Cougar. Doing this: this.type = "c "; If you want have difference between super.type and this.type add field whith name type to Cougar too. public class Cougar extends Feline { public String type = ""; //add this public void hh(){ super.hh(); this.type = "c "; System.out.print("CCCCC "+this.type + super.type); } public static void main(String[] args) { new Cougar().hh(); } }
answers question: http://stackoverflow.com/q/25478444
type: Answer
score: 0

http://stackoverflow.com/q/25431380
has body: Is there a way to capture browser logs while running automated test cases with Selenium? I found an article on how to capture JavaScript errors in Selenium. But that is just for Firefox and only for errors. I would like to get all the console logs.
score: 80
has answer: http://stackoverflow.com/a/61348813
type: Question
upvote count: 80
has answer: http://stackoverflow.com/a/40940167
tagged with: selenium
has answer: http://stackoverflow.com/a/60589897
downvote count: 0
possible better answer: http://stackoverflow.com/a/26488661
accepted answer: http://stackoverflow.com/a/25431419
has title: Capturing browser logs with Selenium WebDriver using Java
has answer: http://stackoverflow.com/a/25431419
has answer: http://stackoverflow.com/a/26488661
has answer: http://stackoverflow.com/a/76087785
favorite count: 0
tagged with: selenium-webdriver
linked to: http://stackoverflow.com/q/18261338
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/37925681
has answer: http://stackoverflow.com/a/62385646
linked to: http://stackoverflow.com/q/20907180
tagged with: java
has answer: http://stackoverflow.com/a/54416080
has answer: http://stackoverflow.com/a/62328658
answer count: 10

http://stackoverflow.com/comment/39842381
has text: IT is compiled code.IT will not say ambiguous method call.Please check it.
comment on: http://stackoverflow.com/q/25520980
type: Comment
type: QuestionComment
score: 0

xcode
tag name: xcode
type: Tag
tags question: http://stackoverflow.com/q/25522793

http://stackoverflow.com/q/25403012
tagged with: java-6
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/38539143
linked to: http://stackoverflow.com/q/7139338
has comment: http://stackoverflow.com/comment/82775396
tagged with: jboss
upvote count: 13
has comment: http://stackoverflow.com/comment/64580752
has answer: http://stackoverflow.com/a/25895762
has answer: http://stackoverflow.com/a/72159807
has title: Jboss Server Error:Server already running on localhost
has answer: http://stackoverflow.com/a/34129934
tagged with: java
has comment: http://stackoverflow.com/comment/39622366
downvote count: 0
has body: I am working on web project where jboss application server is required. After configured the jboss server, I was running my application. It is showing error like:Server already running on local host.Web found a running server at URL //localhost:8080.
has answer: http://stackoverflow.com/a/28348514
has answer: http://stackoverflow.com/a/53553119
answer count: 7
score: 13
favorite count: 0
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/51197270

http://stackoverflow.com/q/25455638
type: AnsweredQuestion
score: 3
answer count: 2
linked to: http://stackoverflow.com/q/23264662
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25456112
downvote count: 0
has answer: http://stackoverflow.com/a/25456112
tagged with: strophe
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25465305
tagged with: smack
has answer: http://stackoverflow.com/a/25465305
linked to: http://stackoverflow.com/q/25384939
has title: When to disconnect bosh connection establish from app server to use prebinding in strophe?
tagged with: servlets
has body: This question is Extension of my previous question on this SO question "How to connect XMPP bosh server using java smack library?" I am using Java as server side language. I have successfully implement xmpp BOSH connection using smach-jbosh thanks to @Deuteu for helping me to achieve this, so far I have modify jbosh's BOSHClient.java file and added two getter method for extracting RID and SID. Now I have RID and SID on my app server (I am using Apache Tomcat). I need to pass this credential to Strophe (web client) so that it can attach to connection. Here I have some doubt. When to disconnect bosh Connection establish from the app server? before passing sid, rid and jid to strophe or after passing sid, rid and jid to strophe? As per my observation during implementation for the same, I have observed that once bosh connection from the app server has been disconnected, session is expired and SID and RID is no longer useful!!! I have implemented this logic (Establishing bosh connection and Extracting sid and rid) on a Servlet, here once response has been send from Servlet, Thread will get expired and end BOSH connection will get terminated, so I am not able perform `Attach()` on strophe as session is expired. Can somebody help me with that problem?

http://stackoverflow.com/q/25494703
score: 1
upvote count: 1
tagged with: java
answer count: 1
downvote count: 0
tagged with: hadoop-streaming
tagged with: mapreduce
favorite count: 0
type: Question
tagged with: hadoop
has body: I have a requirement stating that C++ and Matlab algorithm execution should be triggered from Hadoop mapreduce programming. Will this map the executing algorithm to be distributed. As we have to no plan to rewrite the algorithm using entire mapreduce program
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30115424
has title: How to run a non java program(C++/Matlab preferred) using Hadoop Mapreduce
tagged with: c++

http://stackoverflow.com/a/25412420
score: 1
has body: It might be easier to look at it like this, by replacing the function with the code from it. class IO { public static void main(String [] args) { try { //4 Now goes to the outer try try //2 Checks this try for the catch, but doesn't find it { throw new Exception(); //1 Hits the exception } finally{ //3 Executes this because there is no catch for this try System.out.println("finally"); } } catch (Exception ex) { //5 Finds the catch System.out.println("catch"); } //6 Continues as if nothing happened System.out.println("finish"); } }
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25412227

http://stackoverflow.com/comment/39883147
type: QuestionComment
comment on: http://stackoverflow.com/q/25542825
score: 0
has text: just use crquery.addOrder(Order.desc("documentId"));
type: Comment

http://stackoverflow.com/q/25515345
tagged with: spring-boot
answer count: 2
has comment: http://stackoverflow.com/comment/39855702
upvote count: 37
has body: For a Spring Boot application, I successfully configured a Spring LdapTemplate using annotations, including the LdapContextSource dependency with @Values from application.properties. (Woot! I couldn't find an example, so maybe this will help others.) The snippets (below) setup the context source, inject it into an LdapTemplate, and autowire that into my DirectoryService. Is there a better/cleaner way to setup the ContextSource in a Spring Boot app? application.properties (on the classpath): ldap.url=ldap://server.domain.com:389 ldap.base:OU=Employees,OU=Users,DC=domain,DC=com ldap.username:CN=myuserid,OU=employees,OU=Users,DC=domain,DC=com ldap.password:secretthingy MyLdapContextSource.java : @Component public class MyLdapContextSource extends LdapContextSource implements ContextSource { @Value("${ldap.url}") @Override public void setUrl(String url) { super.setUrl(url); } @Value("${ldap.base}") @Override public void setBase(String base) {super.setBase(base); } @Value("${ldap.username}") @Override public void setUserDn(String userDn) {super.setUserDn(userDn); } @Value("${ldap.password}") @Override public void setPassword(String password) { super.setPassword(password); } } MyLdapTemplate.java: @Component public class MyLdapTemplate extends LdapTemplate { @Autowired public MyLdapTemplate(ContextSource contextSource) { super(contextSource); } } DirectoryService.java: @Service public class DirectoryService { private final LdapTemplate ldapTemplate; @Value("${ldap.base}") private String BASE_DN; @Autowired public DirectoryService(LdapTemplate ldapTemplate) { this.ldapTemplate = ldapTemplate; } public Person lookupPerson(String username) { return (Person) ldapTemplate.lookup("cn=" + username, new PersonAttributesMapper()); } public List&lt;Person&gt; searchDirectory(String searchterm) { SearchControls searchControls = new SearchControls(); searchControls.setCountLimit(25); searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); List&lt;Person&gt; people = (List&lt;Per…
downvote count: 0
tagged with: spring-ldap
has title: Best practice for configuring Spring LdapTemplate via annotations instead of XML?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25519951
has answer: http://stackoverflow.com/a/53474188
has comment: http://stackoverflow.com/comment/39840086
has answer: http://stackoverflow.com/a/25519951
tagged with: java
tagged with: annotations
linked to: http://stackoverflow.com/q/39890849
possible better answer: http://stackoverflow.com/a/53474188
favorite count: 0
type: Question
score: 37

http://stackoverflow.com/comment/39734691
type: Comment
has text: Thanks. Carre to post for credit? Also could you post a docs link reference with your answer?
type: QuestionComment
comment on: http://stackoverflow.com/q/25462526
score: 0

netty
tags question: http://stackoverflow.com/q/25539491
tags question: http://stackoverflow.com/q/25457364
tag name: netty
tags question: http://stackoverflow.com/q/25430238
tags question: http://stackoverflow.com/q/25392716
tags question: http://stackoverflow.com/q/25484436
type: Tag
tags question: http://stackoverflow.com/q/25467408

sleep
tags question: http://stackoverflow.com/q/25462932
type: Tag
tag name: sleep

http://stackoverflow.com/comment/39803266
score: 0
comment on: http://stackoverflow.com/q/25497590
type: Comment
type: QuestionComment
has text: if there is no significant IO in those tasks try running them on your GPU using jCUDA or OpenCL.

http://stackoverflow.com/a/25509600
answers question: http://stackoverflow.com/q/25508281
has body: Although I would not call this "validation", the preferred method for supplying deafult if null is similar to #2 (if not #2 itself) - using Guava's Objects.firstNonNull (since Guava 18 it's placed in MoreObjects): String value = Objects.firstNonNull(input, "empty"); // MoreObjects since 18.0 which internally does: return first != null ? first : checkNotNull(second); With static import it's just: String nonNullValue = firstNonNull(input, "empty"); but which one will you use is just a matter of preference. P.S. I'd use Optional only in one case - if you want lazy evaluated default, but with strings it isn't a case. Private method only for null check is overkill, but if you have other assumptions about value, it's generally considered a good practice to use small private methods with meaningful names for this (see Clean Code by Uncle Bob).
type: AcceptedAnswer
score: 3
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25508281
has comment: http://stackoverflow.com/comment/39821826
type: Answer

http://stackoverflow.com/comment/39672157
has text: Does swing require a desktop environment / window manager?
type: Comment
comment on: http://stackoverflow.com/a/25428690
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39747551
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25447487
type: Comment
has text: not the answer to particular question, because now I don't develop for blackberry platform. But when I was I gave up eclipse because of its strange and buggy behaviour and used Netbeans + [BlackBerry Ant Tools](http://bb-ant-tools.sourceforge.net/) + [Antenna Preprocessor](http://antenna.sourceforge.net/wtkpreprocess.php). Check these tools combination if you did not resolve your issue.

http://stackoverflow.com/q/25393298
score: 43
has comment: http://stackoverflow.com/comment/39604970
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39604998
has body: Recently sonatype enabled maven central to support https (background information). I've now added the following snippet to my pom.xml to force using https everywhere: central https://repo1.maven.org/maven2 false central https://repo1.maven.org/maven2 false Questions: Is this sufficient? Or will there be still http involved somewhere? Is this the correct way of doing it? As I've read that I should do this in the settings.xml instead. But then others using my (open source) project won't use the secure connection. Update It does not look sufficient as for e.g. the assembly plugin still HTTP is used: [INFO] --- maven-assembly-plugin:2.4:single (make-assembly) @ graphhopper-web --- Downloading: http://repo.maven.apache.org/maven2/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
has answer: http://stackoverflow.com/a/25393435
tagged with: java
has answer: http://stackoverflow.com/a/69200638
has answer: http://stackoverflow.com/a/25411658
downvote count: 1
upvote count: 44
has answer: http://stackoverflow.com/a/62229890
has comment: http://stackoverflow.com/comment/39604945
has title: What is the correct way of forcing maven to use HTTPS for maven central?
favorite count: 0
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/59897594
possible better answer: http://stackoverflow.com/a/59784045
linked to: http://stackoverflow.com/q/69200179
has answer: http://stackoverflow.com/a/61910461
has comment: http://stackoverflow.com/comment/109321041
accepted answer: http://stackoverflow.com/a/25411658
has comment: http://stackoverflow.com/comment/106013573
has answer: http://stackoverflow.com/a/59784045
tagged with: maven
has answer: http://stackoverflow.com/a/61970394

http://stackoverflow.com/comment/39692551
type: AnswerComment
has text: This might be a bit inconvenient in Java context as `dateTime.setAnyDate(); dateTime.setAnyTime(); Date date = dateTime.toJavaDate();` throws a NotesException at .toJavaDate().
score: 0
comment on: http://stackoverflow.com/a/25438006
type: Comment

http://stackoverflow.com/comment/39836015
has text: ah I see what you mean, so what can I do then? should I just create another method for the color changing then and if so how can I get paint in onDraw to call it? sorry if I'm asking a lot
comment on: http://stackoverflow.com/a/25517139
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39897481
score: 0
has text: @user3923424 The heap will behave pretty much the same no matter which of the two approaches, because a new string is likely to be created every time you run the `readLine()` method. In the stack, you will still just keep a single reference to that string, it will just point to a different string in every iteration. Previous strings references might be elegible for garbage collection depending on what you did on your loop.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25548464

http://stackoverflow.com/q/25412734
has answer: http://stackoverflow.com/a/25412811
answer count: 2
has comment: http://stackoverflow.com/comment/39641413
upvote count: 1
has body: This is my whole program public class Test { }
downvote count: 1
has answer: http://stackoverflow.com/a/25413637
has comment: http://stackoverflow.com/comment/39641416
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: JSON not getting created Properly
possible better answer: http://stackoverflow.com/a/25413637
accepted answer: http://stackoverflow.com/a/25412811
favorite count: 0
type: Question

http://stackoverflow.com/comment/95825329
has text: guys. any idea for this issue? i face same problem :(
comment on: http://stackoverflow.com/q/25438624
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39660895
comment on: http://stackoverflow.com/q/25423124
has text: Well if you're not writing it's fine. If you do try to write the DB might act up.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39881294
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25542198
type: AnswerComment
has text: Niko Sir It Works But For Only one itraetion for second itration it not work

http://stackoverflow.com/comment/39765262
comment on: http://stackoverflow.com/a/25479301
has text: So the it.next() is returning the element before the first actual element? But if the for loop initializer of it is the `size()` of list, wouldn't that mean it is intializing `size() + 1`? and the next is getting the next value, essentially `list.size()`?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39658850
type: Comment
type: QuestionComment
has text: dat empty catch block, at least if there was something like `Log.(getClass().getSimpleName(), "Caught IOException in button_import onClick", e);` or something similar.
comment on: http://stackoverflow.com/q/25422544
score: 0

http://stackoverflow.com/comment/39740113
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25465969
has text: refer this http://developer.android.com/training/basics/network-ops/xml.html

http://stackoverflow.com/a/25495802
has comment: http://stackoverflow.com/comment/39801935
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39796340
answers question: http://stackoverflow.com/q/25495550
has body: Maybe the images resources there aren't big enough to fit completely the screen. Are you sure the resources images have the right dimensions and proportions?

http://stackoverflow.com/a/25500972
answers question: http://stackoverflow.com/q/25500690
type: Answer
score: 0
has body: Whenever possible use UTF-8, often one can pass StandardCharsets.UTF_8. For Swedish ISO-8859-4 is more suitable than the mentioned ISO-8859-1. However one problem with Unicode is that an accented letter occurs as one Unicode code point (letter inclusive the accent), and as separate Unicode code points: ASCII letter and "combining diacritical mark" (the accent). For a text normalisation one might use java.text.Normalizer. Usage of encodings in java suffer from many method and constructor signatures having an overloaded version without encoding defaulting to the operating system (or set) encoding. In your case it looks like the latter. A Scanner without specified encoding, a FileReader/FileWriter, InputStreamReader, new String.

http://stackoverflow.com/comment/39728651
score: 1
type: Comment
has text: Thanks a lot for your answer. You find the problem but I had to modify the path of the select and not the one of the label ;-) `<form:select path="referent.id" items="${employes} "itemValue="id" itemLabel="nomPrenom" > </form:select>`
type: AnswerComment
comment on: http://stackoverflow.com/a/25451346

http://stackoverflow.com/a/25506063
type: Answer
accepted answer of: http://stackoverflow.com/q/25505987
type: AcceptedAnswer
has body: Normally it's impossible to access one application session from another. If you're redirecting you can pass required attributes in the url (but maybe it's not the best idea, conisder security for this approach). Some servers may have some magic tricks to share sessions between applications deployed on the same server (I think it's possible in weblogic)
answers question: http://stackoverflow.com/q/25505987
score: 0

http://stackoverflow.com/q/25483256
has body: String s="a"; System.out.println(s.replaceAll(".*","1")); Why the output of the code above is "11", not "1"?
has answer: http://stackoverflow.com/a/25483332
accepted answer: http://stackoverflow.com/a/25483332
has answer: http://stackoverflow.com/a/25483325
possible better answer: http://stackoverflow.com/a/25483325
upvote count: 2
downvote count: 0
has title: What's the principle of 'replaceAll' method?
score: 2
type: AnsweredQuestion
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25483490
has comment: http://stackoverflow.com/comment/39771679
tagged with: regex
favorite count: 0
type: Question

http://stackoverflow.com/q/25418607
has body: I created a eclipse plugin project. I am new to this &amp; i wanted to know after installing this project by user through update site - how can i make a change so the user get the update for the existing plugin.
has answer: http://stackoverflow.com/a/25463639
tagged with: java
has title: Eclipse plugin update to downloaded user
has answer: http://stackoverflow.com/a/25673732
type: Question
answer count: 2
type: UnansweredQuestion
tagged with: update-site
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/39654537
score: 0

http://stackoverflow.com/a/26111639
has body: I'll start from bottom to top. Which is better to import (in ActionBarActivity)? (android.app.Fragment or android.support.v4.app.Fragment) Answer: Neither. It depends on what your doing and the API level you wish to conform with. I tend to use android.support.v4.app.Fragment more than the standard android.app.fragment but that's just preference more than anything. How can I display it after user click button(in First's layout) and will not see last Fragment's layout? (if it can change to Fragment or ListFragment) continue2 , How to Transfer data to other fragments? Answer: A listfragment is a type of a fragment with a few extra methods. To replace a standard fragment with a listfragment you'll do the same thing. FragmentTransaction ft = getFragmentManager.beginTransaction; ft.replace(containerId, new MyListFragment or Fragment) .commit(); As per moving data between fragments, the simplest way is to use a Bundle. Bundle data = new Bundle(); data.putInt("myInt", 1); data.putString("myString" "hello java") myFragment.setArguments(data); and in your Fragment class you'll get the data out of the bundle like this. Bundle data = getArguments(); int myInt = data.getInt("myInt"); String myString = data.getString("myString"); and How to change FileChooser from ListActivity to Fragment or ListFragment?(If someone has other methods, please tell me) Are you looking at implementing the FileChooser class in a Fragment class or what exactly are you trying to say by this? My selectFragment method would look like this: public Fragment getFragment(int pos){ switch(pos) { case 1: return new FragmentOne(); case 2: return new FragmentTwo(); case 3: return new FragmentThree(); default: return FragmentOne(); } }
has comment: http://stackoverflow.com/comment/41352565
type: Answer
accepted answer of: http://stackoverflow.com/q/25426296
has comment: http://stackoverflow.com/comment/41345314
answers question: http://stackoverflow.com/q/25426296
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39812316
score: 0
has text: php convert the json into this using JSON_decode method
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25504999

http://stackoverflow.com/comment/39732111
score: 0
comment on: http://stackoverflow.com/q/25461640
type: QuestionComment
type: Comment
has text: Also, why are you counting mil. sec? why not just to compare dates and modify?

http://stackoverflow.com/comment/39757527
has text: Well, then, none of the other answers will work either. I'll work on adding more info.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25468697

http://stackoverflow.com/q/25427730
downvote count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/25427832
has comment: http://stackoverflow.com/comment/39668521
favorite count: 0
type: Question
has title: Loading a class from an external jar
has answer: http://stackoverflow.com/a/25427832
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25427884
has answer: http://stackoverflow.com/a/25427964
has comment: http://stackoverflow.com/comment/39668720
has comment: http://stackoverflow.com/comment/39669257
accepted answer: http://stackoverflow.com/a/25427964
answer count: 3
has body: This is my first java program, so please excuse me if its too naive. I have a 3rd party jar. I want to instantiate a class in the jar and be able to use its methods. Some details about the class in the jar: Class File: rediff.inecom.catalog.product.CSVAPI Constructor: CSVAPI() Method: UpdateCSVAPI(key, csvpath) Return: String I have written the following program: import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.io.IOException; class MyLoaderClass{ public void myLoaderFunction(){ File file = new File("vendorcatalogapi.jar"); try { URL url = file.toURI().toURL(); URL[] urls = new URL[]{url}; ClassLoader cl = new URLClassLoader(urls); Class cls = cl.loadClass("rediff.inecom.catalog.product.CSVAPI"); Object cls_object = cls.newInstance(); System.out.println(cls_object); String output = cls_object.UpdateCSVAPI(12345,"myfile.csv"); System.out.println(output); System.out.println("try"); } catch (Exception e) { System.out.println("catch"); e.printStackTrace(); } } public static void main(String args[]){ new MyLoaderClass().myLoaderFunction(); } } I am trying to compile it using: javac -cp vendorcatalogapi.jar temp.java But I am getting the following error: temp.java:17: error: cannot find symbol String output = cls_object.UpdateCSVAPI(12345,"myfile.csv"); ^ symbol: method UpdateCSVAPI(int,String) location: variable cls_object of type Object 1 error Looks like the object is not correctly initialized. Please can someone help me with the correct way of doing it
score: 1
tagged with: java

http://stackoverflow.com/comment/39869637
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25535931
type: AnswerComment
has text: Thank you for your help, It is faster now, but still getting some lag, it shouldn't be happening. How can I close the drawer and then show the activity? Can you help me on that?

http://stackoverflow.com/comment/39791410
comment on: http://stackoverflow.com/a/25493435
score: 0
type: Comment
has text: As you suggest, here is the problem as I see it: In a system there are multiple Accounts. When someone logs in, we would probably instantiate that person's Account in order to determine what privileges that person has. What if a system admin wanted to access that same Account, perhaps changing the privileges while the owner of the Account is still using it? Is there a way to prevent this or is there a way to notify the system admin that the Account has been instantiated?
type: AnswerComment

http://stackoverflow.com/comment/39605534
comment on: http://stackoverflow.com/q/25393489
score: 0
has text: When I print the values I am reading from the file, all are coming up as null when I execute from command line. In eclipse it works fine. I am building the jar fine as far as I know. For the record, I changed the name of the file to an obscure name. That didn't help either.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25401627
type: Answer
accepted answer of: http://stackoverflow.com/q/25401293
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25401293
score: 1
downvote count: 1
has body: I don't think that decision is that important you think it is. You can go either way, what you feel more comfortable with. Here's why in my opinion: 1) If you're tests are running 6 or 8 hours your tests are slow. It's not the language that makes them slow but what they do. Neither java nor python will magically make the tests run faster or slower (on this scale). If there is a performance impact from the choice of your languages, I would suspect it to be like +- 1 minute... 2) Sorry, I can't answer. I don't know pythons test frameworks. (But the whole rest of the answer doesn't rely on that) 3) Regarding WebDriver, do you know how it works? It's an extension in the webbrowser. You talk to it via a JSON protocol in your code. Your test code is just a client, generating that JSON commands and sending it to the browser. The webdriver core doesn't care if the JSON is generated by python or java. The sole thing that can go wrong is the client code and I would suspect both to be stable and well used. 4) See answer 3. It is only the client part you switch here, but yes, it is well maintained in my opinion. 5) Isn't that the job of the container (e.g. Jenkins / Hudson). All the test frameworks do is normally generate a report of the failed / passed tests. Most likely in ANT / JUnit XML Format. For details see this question. That may depend on the plugin you're using to generate the diagrams though. But not on the test framework generating the resulting report. If you feel more comfortable with Java just use it. In favor of python is the shorter syntax. You can write the tests a bit shorter with less boilerplate code. But that wouldn't let me learn python just for the sake of shorter (in the sense of source code) tests.

http://stackoverflow.com/comment/39626910
has text: Did as you said. The server Stopped. and Still upon execution the error remains the same `Launching Tomcat v7.0 Server at localhost (2) has encountered a problem. Several Ports(8005, 8080, 8009) required by Tomcat v7.0 Server at localhost (2) are already in use.`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25403911

http://stackoverflow.com/q/25531489
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25531547
has title: Decode json returns null in Java
type: Question
has body: I have the following JSONArray: [ { "Lng":17.908817, "name":"S1", "id":1, "sensor:":[ "Temperature", "Wind" ], "Lat":47.089492 }, { "Lng":17.908458, "name":"S2", "id":2, "sensor:":[ "Temperature", "Wind", "Humidity" ], "Lat":47.089246 }, { "Lng":17.908222, "name":"S3", "id":3, "sensor:":[ "Wind" ], "Lat":47.089662 } ] I can split it to JSONObject but if I try to split the Object it returns null. My code: Object object = JSONValue.parse(result); JSONArray array = (JSONArray)object; for(int i = 0 ; i &lt; array.size(); i++){ System.out.println(array.get(i)); JSONObject jsonObject = (JSONObject)array.get(i); for(int j = 0 ; j &lt; jsonObject.size(); j++){ System.out.println(jsonObject.get(j)); } } Result: {"Lng":17.908817,"name":"S1","sensor:":["Temperature","Wind"],"id":1,"Lat":47.089492} null null null null null {"Lng":17.908458,"name":"S2","sensor:":["Temperature","Wind","Humidity"],"id":2,"Lat":47.089246} null null null null null {"Lng":17.908222,"name":"S3","sensor:":["Wind"],"id":3,"Lat":47.089662} null null null null null
possible better answer: http://stackoverflow.com/a/25531618
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25531831
has answer: http://stackoverflow.com/a/25531618
answer count: 3
accepted answer: http://stackoverflow.com/a/25531547

http://stackoverflow.com/a/25517012
has comment: http://stackoverflow.com/comment/39915697
has body: You need to do: ca.setParent(parent); as well. If you specify a two sided relationship then you must assign both sides in Java code, just as you would if it was pure Java. Secondly, your declaration of a 'parentId' column is redundant. Hibernate will create that for you automatically.
type: Answer
has comment: http://stackoverflow.com/comment/39835762
has comment: http://stackoverflow.com/comment/39861961
score: 0
answers question: http://stackoverflow.com/q/25516980
has comment: http://stackoverflow.com/comment/39835804

http://stackoverflow.com/a/25439922
has body: Don't know about a single lib to do that all but it should be fairly trivial to: read the property file into a java Map (this should be fairly straightforward?) use the above and convert it to your POJO using either http://commons.apache.org/proper/commons-beanutils/ or using https://github.com/FasterXML/jackson (usin ObjectMapper)
score: 0
answers question: http://stackoverflow.com/q/25439827
type: Answer

http://stackoverflow.com/q/25488996
has comment: http://stackoverflow.com/comment/39785177
has title: File can not be copied to response steam
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39783003
tagged with: response
has answer: http://stackoverflow.com/a/25489341
type: Question
has body: There is an interesting error on a page. I wonder if you have any idea about it. In order to download a file, we write the file to responseStream but if file is less than 8,3KB, we get file not found error although file is there. If i increase the file size (using some dummy values), it works I suspect it has something to do with the contentLength of response but it seems fine to me file = new File(ef.getPath()); response.setContentLength((int) file.length()); fileIs = new FileInputStream(file); FileCopyUtils.copy(fileIs, response.getOutputStream()); Please help me if you have any idea?
tagged with: fileinputstream
type: UnansweredQuestion
tagged with: request
tagged with: spring
score: 0

http://stackoverflow.com/comment/39858755
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25530004
score: 1
has text: If you want to get the table's visible row count see @kleopatra's answer in this thread: [How many rows is a JTable currently displaying?](http://stackoverflow.com/questions/11887642/how-many-rows-is-a-jtable-currently-displaying). If you want to get a list of all rows that are visible, that answer will help you too.

http://stackoverflow.com/comment/39633133
comment on: http://stackoverflow.com/q/25400773
has text: If I were you,I would do 'A' rather than 'B' because it would reduce the overall jar file size. Moreover,I've seen some [games which are seperated into several jar files](http://www.java.mob.org/game/farm_fenzy.html) depending upon the platform.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25488239
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39783306
tagged with: java
has title: EnumMap with LuaJava (attempt to call a nil value)
answer count: 1
tagged with: enum-map
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25489557
upvote count: 2
has comment: http://stackoverflow.com/comment/39783077
has answer: http://stackoverflow.com/a/25489557
downvote count: 0
has body: As the title says, I have problem with LuaJava and EnumMap. I'm trying to do a RPG Library, so we have a Character with some Attributes and a list of them. In the code below, I'll report only important things. I have a class called ConcreteAttribute that extends AbstractAttribute, that has a constructor with a String and two int. public abstract class AbstractAttribute { protected String name; protected int baseValue; protected double baseMolt; public AbstractAttribute(String name, int valoreBase, double moltBase){ this.name = name; this.baseValue = valoreBase; this.baseMolt = moltBase; } /*Getters and Setters*/ } Then I have an Enum called StatType, that represents the stat you have in RPG games: public enum StatType { HP, MP, Attack, Defense; } I have also a class called PlayableCharacter, that has (I'll report only important things): public abstract class PlayableCharacter extends Character{ protected EnumMap&lt;StatType, ConcreteAttribute&gt; statistiche; //Constructor public EnumMap&lt;StatType, ConcreteAttribute&gt; getStatistiche(){ return statistiche; } and a "put" method from Map. To create a new character, I'm currently doing this ("Eroe" extends PlayableCharacter): public static void main(String[] args) { PlayableCharacter pers = new Eroe("Eroe 1"); ConcreteAttribute atk = new ConcreteAttribute("Attacco", 20, 0); pers.getStatistiche().put(StatType.Attacco_Fisico, atk); } and works fine, but I don't think it is the best solution when you have a lot of ConcreteAttribute and a lot of Character. So I was thinking to use Lua to create "concrete" istance of Character, this way (little example): -- Eroe 1.lua function create(eroe) eroe:setName("Eroe 1") attributes = luajava.bindClass("personaggi.attributi.StatType") attacco = luajava.newInstance("personaggi.attributi.ConcreteAttribute", "Attacco", 20, 0) eroe:getStatistiche():put(attributes.Attacco_Fisico, attacco) end but I get this error: PANIC: unprotected error in call to Lua API (attempt to call a nil value…
tagged with: luajava
has comment: http://stackoverflow.com/comment/39783607

http://stackoverflow.com/comment/39777157
score: 0
comment on: http://stackoverflow.com/a/25485710
type: Comment
type: AnswerComment
has text: The problem was obvious. I had a local variable called Jlabel_imagen that was used as the global one. Thank you every one

http://stackoverflow.com/a/69825628
has body: THIS: Timer timer = new Timer(500,new ActionListener() { @Override public void actionPerformed(ActionEvent ae){ if (a == true){ System.out.println("Hello"); a = false; } if (a == false){ System.out.println("ByeBye"); a = true; } } } boolean a = true; public MyFrame(){ initComponents(); a = true; timer.start(); }
answers question: http://stackoverflow.com/q/25487472
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/123428415

http://stackoverflow.com/a/25493297
score: 0
answers question: http://stackoverflow.com/q/25493215
has comment: http://stackoverflow.com/comment/39791587
has body: Like this: public class CheckDigit { public static void main(String[] args) { if (args.length &gt; 0) { for (String arg : args) { System.out.println(CheckDigit.checkdigit(arg)); } } else { System.out.println("Please give some values on the command line"); } } public static int checkdigit(String idWithoutCheckdigit) { String validChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVYWXZ_"; idWithoutCheckdigit = idWithoutCheckdigit.trim().toUpperCase(); int sum = 0; for (int i = 0; i &lt; idWithoutCheckdigit.length(); i++) { char ch = idWithoutCheckdigit.charAt(idWithoutCheckdigit.length() - i - 1); if (validChars.indexOf(ch) == -1) throw new RuntimeException("\"" + ch + "\" is an invalid character"); int digit = ch - 48; int weight; if (i % 2 == 0) { weight = (2 * digit) - (digit / 5) * 9; } else { weight = digit; } sum += weight; } sum = Math.abs(sum) + 10; return (10 - (sum % 10)) % 10; } }
has comment: http://stackoverflow.com/comment/39791458
type: Answer

http://stackoverflow.com/q/25546936
score: 2
tagged with: bindy
upvote count: 2
has title: Is there a way to automatically detect FIELD / COLUMN order when loading CSV file with headers in first line?
has answer: http://stackoverflow.com/a/25612392
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39958590
has comment: http://stackoverflow.com/comment/39994029
has body: I have CSV files that always contain the same fields, or a subset of the same fields. However they come from different providers, and each provider has a different ordering. Also some providers include the field if it's empty, others remove it. Sample: Provider 1.txt: id,name,address,url 3,ruth,ruth address,ruth.com B,sonia,sonia's street, thisissonia.eu Provider 2.txt: id,url,name 3,shutupmag.com,maggie B,khaleesi.org,Mother of Dragons The first line is ALWAYS the headers, and the headers are always the same (with possibility of one or more being omitted). I'm using a Camel Route to do the processing, using Bindy and an annotated class to do the marshalling/unmarshalling. I'm pretty happy with my solution, but right now I have to manually edit the order of the fields in my Bean when I want to process a different provider. I have something like this in my Bean: @DataField(pos = 4, defaultValue = "") //for provider Stark //@DataField(pos = 2, defaultValue = "") //for provider Lannister //@DataField(pos = 3, defaultValue = "") //for provider Targaryen public String url = ""; It feels bad, and I think there probably is a way to infer the fields from the first line. At least it makes sense. I could do this in a processor, but I like Bindy, it's awesome and I would like to keep using it. I guess I could use a different folder for each provider and have a different bean for each folder, but that's not what I want either. A provider can change the order or fields without notice. But they are always required to send the fields in the first line. So final question: Can I auto-detect the CSV field names in Camel with Bindy (or other component, I'm open to suggestions, I just prefer to keep using Bindy)?
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
tagged with: apache-camel

jce
tags question: http://stackoverflow.com/q/25406278
type: Tag
tag name: jce

http://stackoverflow.com/comment/39763373
comment on: http://stackoverflow.com/q/25478541
score: 0
type: Comment
has text: Also, is the problem when searching normal text or selected text? Keep the code simple and get the searching for normal text first. Then move on to getting the search for selected text.
type: QuestionComment

http://stackoverflow.com/comment/39894646
type: QuestionComment
type: Comment
has text: I just want to navigate thorugh all those sub-pages and if the files are existing, I want to download them into my local PC. Thats all. I thought I can navigate through webpages via parsing or patching with Jsoup. I have nothing to do with Ajax.
comment on: http://stackoverflow.com/q/25483061
score: 0

http://stackoverflow.com/comment/39792971
type: QuestionComment
comment on: http://stackoverflow.com/q/25492353
score: 0
has text: @Rudy dev I posted my answer lemme know it helps
type: Comment

datetimepicker
type: Tag
tags question: http://stackoverflow.com/q/25420244
tag name: datetimepicker

http://stackoverflow.com/comment/39900573
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25550920
has text: The USING syntax tip was a brilliant direction.

http://stackoverflow.com/a/25506005
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25505974
score: 3
has body: Correct approach would be passing some configuration option to the application, by configuration file or just environment variable. Then you can easily distinguish between different environments. As trivial example: you can run production application with -DConfig=PRO, and development with -DConfig=DEV. Then you can distinguish them by checking System.getProperty("Config")
answers question: http://stackoverflow.com/q/25505974
type: Answer

http://stackoverflow.com/comment/39921850
comment on: http://stackoverflow.com/q/25524126
score: 0
has text: @AlonAmir You can add as many Java classes as you need to your proyect, ONLY if you made a custom plugin should you need to include it in the xml.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25416393
downvote count: 0
answers question: http://stackoverflow.com/q/25416336
has body: The problem is, the property setStringPainted is already defined within by the component and has a predefined functionality...which you know seem to want to change... You will either, need to define a new property of your own which you can control OR change the way the UI delegate works, which is a lot of work as you will need to provide one for each look and feel you might want to support... Instead of doing custom painting, you could cheat (a little)... and use a JLabel instead, for example... class CustomProgressBar extends JProgressBar { private static final long serialVersionUID = 1L; private boolean isStringToBePainted = false; private JLabel progress; public CustomProgressBar() { super(JProgressBar.VERTICAL, 0, 100); progress = new JLabel("0%"); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.weighty = 1; gbc.weightx = 1; gbc.anchor = GridBagConstraints.SOUTH; add(progress, gbc); } @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); Dimension labelSize = progress.getPreferredSize(); Insets insets = getInsets(); if (size.width &lt; labelSize.width) { size.width = insets.left + insets.right + labelSize.width; } return size; } } You're still going to need to provide your own property to turn it on or off, but it's an idea... (ps- I had a quick look at trying to implement my own UI delegate, after I copy and pasted my third method, I gave up, as it would just be more work then the reward would provide)
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/25404464
tagged with: tesseract
type: AnsweredQuestion
tagged with: java
score: 0
has body: On linux server tesseract 3.0.2 libraries were correctly installed: [root@XXX as]# rpm -qa | grep ".*tess.*" tesseract-3.02-alt1.r723 When trying to run tess4j wrapper, got this exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'TessBaseAPICreate': /usr/lib64/libtesseract.so.3.0.2: undefined symbol: TessBaseAPICreate at com.sun.jna.Function.&lt;init&gt;(Function.java:208) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:536) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:513) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:499) at com.sun.jna.Library$Handler.invoke(Library.java:199) at com.sun.proxy.$Proxy0.TessBaseAPICreate(Unknown Source) at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:284) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:219) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:200) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:184) (... private code ...) Mentioned in exception file exists: [root@XXX as]# test -e /usr/lib64/libtesseract.so.3.0.2 &amp;&amp; echo "Found" || echo "Not found" Found The place in tess4j code, which throws the exception looks like: /** * Initializes Tesseract engine. */ private void init() { pageNum = 0; api = TessAPI.INSTANCE; handle = api.TessBaseAPICreate(); // ERROR HERE, line #184 api.TessBaseAPIInit2(handle, datapath, language, ocrEngineMode); api.TessBaseAPISetPageSegMode(handle, psm); } I have no idea, how to solve it, because all libraries versions are same, it works perfectly under windows.
has title: Running tess4j (tessreact java wrapper) under Linux
tagged with: linux
type: Question
accepted answer: http://stackoverflow.com/a/25449302
has comment: http://stackoverflow.com/comment/39647002
tagged with: tess4j
has comment: http://stackoverflow.com/comment/39656008
has answer: http://stackoverflow.com/a/25449302
answer count: 1

http://stackoverflow.com/a/25438557
has comment: http://stackoverflow.com/comment/39691028
downvote count: 1
has comment: http://stackoverflow.com/comment/39726980
type: Answer
has comment: http://stackoverflow.com/comment/39726985
has comment: http://stackoverflow.com/comment/39690980
has comment: http://stackoverflow.com/comment/39735812
score: 2
has body: (x+25)/50*50 My answer is too short because I actually posted the simplest way to do this, so you also get this sentence. Edit: I'm answering the question you asked, not what your examples illustrate. Leaving this answer in case anyone else has your question and tries to read the answers.
has comment: http://stackoverflow.com/comment/39688874
upvote count: 3
answers question: http://stackoverflow.com/q/25438203

http://stackoverflow.com/comment/39699094
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25419494
score: 0
has text: @TedBigham - I have edited my OP.Please lemme know if you need any further clarification. I need to know how to exit the while loop as soon as the clock reaches the time specified by the user.

http://stackoverflow.com/comment/39608494
has text: @PM7 Getting stack trace now, will edit question.
comment on: http://stackoverflow.com/q/25395095
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/39737388
has text: The key to doing this: First index of substring is the start string (example: <car><car_id>) plus the length of that string (because you originally get the index of it's first character). As for the end index, you just specify the end string
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25464586

http://stackoverflow.com/comment/39890608
score: 0
comment on: http://stackoverflow.com/q/25547680
has text: check whether the response from the server is valid JSON or not. You can also use online tools for that. Eg. http://jsonlint.com
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39786752
type: Comment
type: QuestionComment
has text: I suggest you to use `wait()` and `notify()` to achieve your desired output.
score: 0
comment on: http://stackoverflow.com/q/25490766

http://stackoverflow.com/a/25459374
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25459112
has body: You can use a BitSet: BitSet composites = new BitSet(n + 1); for (int i = 2; i &lt;= n; ++i) if (!composites.get(i)) { ... /* It's prime. */ for (int multiple = 2*i; multiple &gt; 0 &amp;&amp; multiple &lt;= n; multiple+=i) composites.set(multiple); /* Strike out every i-th number. */ }
type: Answer

awt
tags question: http://stackoverflow.com/q/25394296
tags question: http://stackoverflow.com/q/25398074
tags question: http://stackoverflow.com/q/25510052
tags question: http://stackoverflow.com/q/25549733
tags question: http://stackoverflow.com/q/25422084
tags question: http://stackoverflow.com/q/25548962
tags question: http://stackoverflow.com/q/25403077
tags question: http://stackoverflow.com/q/25500265
tags question: http://stackoverflow.com/q/25418479
tag name: awt
type: Tag
tags question: http://stackoverflow.com/q/25433704
tags question: http://stackoverflow.com/q/25517034

http://stackoverflow.com/q/25432408
downvote count: 0
score: 1
upvote count: 1
favorite count: 0
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/25432539
type: Question
has body: I have one function who check if emails in Array are correct or not. If emails are valid return true and send emails to server. My problem comes when emails are invalid. I put every email in ArrayList and show them in AlertDialog. But in AlerDialog only one invalid email is shown because return false. I tried to move this return but everything comes wrong. I want to go trough Array with loop and when loop ends then it should return false and show ArrayList(I think this should do the job ), but when I move return false after the loop, AlertDialog didn't work This is my function boolean checkedMails(String[] mails) { for (int i = 0; i &lt; mails.length; i++) { if (!isEmailValid(mails[i])) { wrongEmails.add(mails[i]); Log.d("WRONGEMAILS", wrongEmails.toString()); return false; } } return true; } And here i send emails or show alerDialog sendButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String IRegEmail = waitingForAdd.getText().toString(); String[] mails = getAnswers(); try { if (checkedMails(mails)) { sendEmails(mails); } else { alertDialogThis = new AlertDialog.Builder( ReferFriend.this); timer = new Timer(); alertDialogThis.setMessage("Wrong emails are:" + wrongEmails); dlg = alertDialogThis.create(); dlg.show(); // dialog.dismiss(); timer.schedule(new TimerTask() { public void run() { dlg.dismiss(); timer.cancel(); } }, 2000); wrongEmails.clear(); } } catch (Exception e) { Toast.makeText(getApplicationContext(), "Please add e-mails", Toast.LENGTH_LONG).show(); } } }); }
has answer: http://stackoverflow.com/a/25432539
tagged with: android
tagged with: java
possible better answer: http://stackoverflow.com/a/25432520
has answer: http://stackoverflow.com/a/25432520
has title: How to show all values in arraylist android
type: AnsweredQuestion
answer count: 2

http://stackoverflow.com/q/25426654
linked to: http://stackoverflow.com/q/21972603
type: Question
tagged with: nfc
has answer: http://stackoverflow.com/a/25443270
accepted answer: http://stackoverflow.com/a/25443270
tagged with: java
tagged with: apdu
type: AnsweredQuestion
has body: I've been using the ACR122 card reader for a while which had no trouble reading either Mifare 1K or Mifare Ultralight NFC cards. After upgrading the card reader to the newest version (ACR1251), my program can't read the UID from the Mifare 1K cards. This is the snippet I use for reading: CardTerminal terminal = terminalWithCardPresent.get(0); terminal.waitForCardPresent(0); Card card = terminal.connect("T=1"); if (card != null) { CommandAPDU command = new CommandAPDU((byte) 0xFF, (byte) 0xCA, (byte) 0x00, (byte) 0x00, (byte) 0x07); CardChannel channel = card.getBasicChannel(); ResponseAPDU response = channel.transmit(command); StringBuilder sb = new StringBuilder(); if (response.getSW1() == 0x90 &amp;&amp; response.getSW2() == 0x00) { byte[] data = response.getData(); String code = decoder.apply(data); sb.append(code); } cardIdRead.recieve(sb.toString()); } terminal.waitForCardAbsent(0); With the new version of the rad reader: the ResponseAPDU.getSW1() function returns 98 while getSW2() returns 130 I've tried searching both the web and the card readers documentation for an explanation for the response codes with no luck. Anyone else had simular problems, and know how to read the UID from a card returnon sw1 sw2 98 130?
score: 0
answer count: 2
has title: Need help understanding APDU response
has answer: http://stackoverflow.com/a/26052652
possible better answer: http://stackoverflow.com/a/26052652

http://stackoverflow.com/q/25485716
score: 0
has comment: http://stackoverflow.com/comment/39776355
accepted answer: http://stackoverflow.com/a/25486109
tagged with: java
has body: I am making a class in my game engine were it will check for key inputs and I have all the keys set up in an enum where the I will select the ordinal int value from the list when I need it and it looks like it works, no warnings no errors and it starts however, when I try to check for the input in my main it crashes for some reason. Could someone please help me. From my main class: private void OnGameUpdate() { KeyManager key = new KeyManager(); if(key.KeyPressed(Keys.KEY_W)) { JOptionPane.showMessageDialog(null, "Hello, it works!", "Test", JFrame.ERROR); } } Key Manager class: public class KeyManager { private int CurrentKey; public enum Keys { KEY_0, KEY_1, KEY_2, //[...]all the other keys... KEY_Y, KEY_YEN, KEY_Z, KEYBOARD_SIZE } public boolean KeyPressed(Keys key) { this.CurrentKey = key.ordinal(); return Keyboard.isKeyDown(CurrentKey); } }
tagged with: lwjgl
answer count: 1
has comment: http://stackoverflow.com/comment/39776469
has comment: http://stackoverflow.com/comment/39776447
type: Question
has answer: http://stackoverflow.com/a/25486109
has comment: http://stackoverflow.com/comment/39776420
tagged with: key
tagged with: keyboard
has title: LWJGL Key issue
type: AnsweredQuestion

http://stackoverflow.com/comment/39779872
comment on: http://stackoverflow.com/q/25487521
type: QuestionComment
score: 0
has text: I think the best method is like you said - add overlaps method to BoundingVolume interface. You have to do a bit more work at this time (adding method for every implementation) but it will profit in future. Just like u said - if you will create new implementation in the future will you remember that you must go back to OverlapTester and add another if? What if this implementation will create someone else that does not know about OverlapTester? If you have overlap method in BoundingVolume interface then you have to implement that and I think that is the best solution.
type: Comment

http://stackoverflow.com/comment/39807154
comment on: http://stackoverflow.com/q/25502025
score: 3
type: Comment
has text: Please don't change the question after people have answered. If you have a new question, post it as a new question.
type: QuestionComment

http://stackoverflow.com/a/25549746
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25549572
type: Answer
downvote count: 0
has body: If you evaluate (a==10) || (b == 9) (which is an OR operation), if the first clause is true, then the entire expression must be true (because it's OR) and the second clause will not be executed for reasons of optimization. Code is executed from left to right, so you'll hit the first TRUE therefore your entire statement will be TRUE, and the remainder of your statement will not be executed If your first clause is false, then only will the second clause be evaluated. If you use (a==10) | (b == 9) both clauses will be evaluated. If you want to be certain of the precedence of your operators, you should use brackets

http://stackoverflow.com/comment/39876786
has text: [`LocalTime#getHour`](http://docs.oracle.com/javase/8/docs/api/java/time/LocalTime.html#getHour--)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25539891
score: 1

grid-layout
tags question: http://stackoverflow.com/q/25513711
type: Tag
tag name: grid-layout

http://stackoverflow.com/q/25550225
has answer: http://stackoverflow.com/a/25550357
type: Question
tagged with: android
possible better answer: http://stackoverflow.com/a/25550357
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/25550280
score: 0
tagged with: java
has body: Here is my example of inheritance activity. As the log shows I fail to get the correct data from my super class. My super class public class MainActivity extends Activity { public String exampleString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.NewButton); button.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ exampleString = "Test and test"; Log.e("Mytag", "here "+ exampleString); Intent intent = new Intent(); intent.setClass(getBaseContext(), Activity2.class); startActivity(intent); } }); } } My sub class public class Activity2 extends MainActivity { @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.layout2); Log.e("Mytag", "here "+ exampleString); } } My log 08-28 13:27:05.908: D/gralloc_goldfish(889): Emulator without GPU emulation detected. 08-28 13:27:08.677: E/Mytag(889): here Test and test 08-28 13:27:09.408: E/Mytag(889): here null Why does the sub class get the null value for exampleString? Can any body help? Thanks
has answer: http://stackoverflow.com/a/25550280
upvote count: 1
has title: Inherit data from super class in android
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39701741
type: Comment
has text: @Sankumarsingh : I have shared this method as well. Since i have tried in many ways , so may be u wonder by seeing code . Anyway if u get any idea ,please share.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25419147

http://stackoverflow.com/comment/39763413
type: AnswerComment
comment on: http://stackoverflow.com/a/25478581
has text: Thanks bud fixed the problem
type: Comment
score: 0

http://stackoverflow.com/a/25538727
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25538581
type: Answer
has body: For Android, the tool to use is the Native Development Kit. You can read about it (and get it) here. Note that they make the point: you should understand that the NDK will not benefit most apps. (Emphasis in the original.) As @jdphenix points out in a comment, you need to be familiar with the Java Native Interface spec to integrate C/C++ code with Java. The NDK is a tool to support using JNI with Android apps. EDIT (in response to comment): Using two languages because you need to use one (Java in the case of Android) and you like the other (C/C++) strikes me as counterproductive unless you have strong performance reasons to do so. As the docs for the NDK say: [U]sing native code on Android generally does not result in a noticable (sic) performance improvement, but it always increases your app complexity. In general, you should only use the NDK if it is essential to your app—never because you simply prefer to program in C/C++. Typical good candidates for the NDK are CPU-intensive workloads such as game engines, signal processing, physics simulation, and so on. In addition, using two languages will make maintenance of your app much harder. Not only is JNI a difficult technology, the app will require maintaining skills in two languages. If you do need to use the NDK for performance reasons, I would strive to limit it to the bare minimum. Most of the Java framework is quite efficient, particularly with the Dalvik JIT compiler appearing on many devices. Incidentally, if you are interested in Android game development in particular, you might also want to check out the Google Play Games C++ SDK. It's a companion to the NDK. P.S. As of Android 4.4, there is an option to replace the Dalvik runtime with a new Android Runtime (ART). (Read about it here.) This compiles your app's bytecode into native code at the time the app is installed. The result is that much of the performance benefit of using JNI disappears when ART is enabled. I expect that future versions of Android will…

http://stackoverflow.com/q/25480675
tagged with: java
tagged with: servlets
favorite count: 0
type: Question
tagged with: web.xml
has title: Accessing URL mappings of a servlet in Tomcat with only static functions
answer count: 1
downvote count: 0
has body: I need to use URL-mapping for my servlet which is set in web.xml. Currently I can read the mappings with the following code in the processRequest function. Iterator&lt;String&gt; urlMappings = this.getServletContext().getServletRegistration(MyServletClass.class.getSimpleName()).getMappings().iterator(); while (urlMappings.hasNext()) { System.out.println(urlMappings.next()); } However getServletContext function is not static and therefore I cannot read it without an instance of the servlet. That is also OK but if there is a way to do this with only static functions I will prefer that solution. Any help? I am using Tomcat 8.0.3 and JDK 1.8
upvote count: 1
accepted answer: http://stackoverflow.com/a/25480806
tagged with: tomcat
tagged with: servlet-mapping
has answer: http://stackoverflow.com/a/25480806
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/25495877
answers question: http://stackoverflow.com/q/25495622
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/39797342
downvote count: 0
upvote count: 1
has body: Code: List&lt;String&gt; list = Arrays.asList("Apple www.apple.com", "Bing www.bing.com", "Google www.google.com", "Hilton www.hiltonhotels.com ", "Ink www.ink.com"); List&lt;String&gt; list2 = new ArrayList&lt;&gt;(); int index = 0; for (int i = 0; i &lt; list.size()-1; i++) { if (list.get(i).contains("Hilton") ) { index = i; String s = list.get(i); list2.add(list.get(i+1)); } else { list2.add(list.get(i)); } } list2.add(index+1, list.get(index)); for (String st : list2) { System.out.println(st + " "); } output: Apple www.apple.com Bing www.bing.com Google www.google.com Ink www.ink.com Hilton www.hiltonhotels.com If you do not want to use copy of your list you can do this Code: List&lt;String&gt; list = Arrays.asList("Apple www.apple.com", "Bing www.bing.com", "Google www.google.com", "Hilton www.hiltonhotels.com ", "Ink www.ink.com"); List&lt;String&gt; list2 = new ArrayList&lt;&gt;(); int index = 0; for (int i = 0; i &lt; list.size()-1; i++) { if (list.get(i).contains("Hilton") ) { index = i; String s = list.get(i); System.out.println(list.get(i+1)); } else { System.out.println(list.get(i)); } } System.out.println(list.get(index)); output: Apple www.apple.com Bing www.bing.com Google www.google.com Ink www.ink.com Hilton www.hiltonhotels.com
has comment: http://stackoverflow.com/comment/39796483

http://stackoverflow.com/comment/39854435
has text: Great thanks and I actually ended up hitting the second issue you brought up so you sorted that for me as well, can't thank you enough.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25516104

http://stackoverflow.com/a/25418742
type: Answer
has body: try { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); Date dob = null; dob = sdf.parse(txtToday.getText()); java.sql.Date sqlDate = new java.sql.Date(dob.getTime()); c1.setDOB(sqlDate); //use this sqlDate for inserting into Database } catch (ParseException e) { System.out.println("Parse exception,incorrect input in the textbox"); e.printStackTrace(); }
answers question: http://stackoverflow.com/q/25418711
has comment: http://stackoverflow.com/comment/39679701
downvote count: 0
has comment: http://stackoverflow.com/comment/39677084
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39679781

http://stackoverflow.com/a/25446559
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25418925
has body: I got my answer . Actually we can try event API using a callback url, that receives POST request having every details about the email delivered, bounced in json format. Whenever some event is triggered we get a request from Sendgrid. Thats cool. We can keep these details for further Filtering. Anyway , thanks jacobmovingfwd
type: Answer

http://stackoverflow.com/a/58243515
type: Answer
upvote count: 3
downvote count: 0
has body: The Answer by Andrew T. is correct: integer overflow. But the example code is now outmoded. java.time The modern approach uses the java.time classes. The Instant class represents a moment. Like java.util.Date, Instant counts from the epoch reference of first moment of 1970 in UTC, 1970-01-01T00:00Z. But Instant uses a finer resolution of nanoseconds rather than milliseconds. Append an L to the end of your numeric literal to indicate long type. Use underscores wherever you like to group your digits, with no meaning added (ignored by compiler). long input = 1_409_012_824L ; Instant instant = Instant.ofEpochSecond( input ) ; Generate a textual representation of the value in standard ISO 8601 format. String output = instant.toString() ; 2014-08-26T00:27:04Z For more flexibility in generating text, convert to a OffsetDateTime. OffsetDateTime odt = instant.atOffset( ZoneOffset.UTC ) ; Automatically localize the output using a DateTimeFormatter. Locale locale = Locale.US ; DateTimeFormatter f = DateTimeFormatter.ofLocalizedDateTime( FormatStyle.MEDIUM ).withLocale( locale ) ; String output2 = odt.format( f ) ; Aug 26, 2014, 12:27:04 AM See this code run live at IdeOne.com. About java.time The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, &amp; SimpleDateFormat. To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310. The Joda-Time project, now in maintenance mode, advises migration to the java.time classes. You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.* classes. Where to obtain the java.time classes? Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later - Part of the standard Java API with a bundled implementation. Java 9 adds some minor features and fixes. Java SE 6 and Java SE 7 Mos…
score: 3
answers question: http://stackoverflow.com/q/25496568

http://stackoverflow.com/a/25417412
type: Answer
answers question: http://stackoverflow.com/q/25417363
upvote count: 2
score: 2
downvote count: 0
has body: I want the subterm to exactly match one of the words in term Then you can't use contains(). You could split the term into words and check equality (with or without case sensitivity). boolean hasTerm = false; for (String word : term.split("\\s+") { if (word.equals("engine")) { hasTerm = true; break; } }

http://stackoverflow.com/q/25519560
has comment: http://stackoverflow.com/comment/39839637
has answer: http://stackoverflow.com/a/25519613
has body: How to identify the issue when java OutOfMemoryError or stackoverflow comes in production. By which reason it is coming or why the server is down. For example I am developing an application which is lived on production and UAT. Instantly on production java OutOfMemoryError or stackoverflow. Then how can we track this issue, by which reason it has happened ? Is there any technique that can tell me by which code flow this is happening ? Please explain it. I have faced this issue many times.
tagged with: out-of-memory
downvote count: 0
has answer: http://stackoverflow.com/a/25530980
has comment: http://stackoverflow.com/comment/39839676
has answer: http://stackoverflow.com/a/25520245
has comment: http://stackoverflow.com/comment/39847033
answer count: 6
possible better answer: http://stackoverflow.com/a/25519613
has answer: http://stackoverflow.com/a/25520380
has answer: http://stackoverflow.com/a/25520497
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39969948
has title: How to identify the issue when Java OutOfMemoryError?
has answer: http://stackoverflow.com/a/25519652
score: 21
tagged with: java
linked to: http://stackoverflow.com/q/24510188
upvote count: 21
accepted answer: http://stackoverflow.com/a/25520497
favorite count: 0
type: Question

http://stackoverflow.com/a/25468953
has comment: http://stackoverflow.com/comment/39745511
has comment: http://stackoverflow.com/comment/39745501
type: Answer
answers question: http://stackoverflow.com/q/25468938
has body: RadioGroup group is the RadioGroup that originates the click event. However, in your particular case, I think it would be much more clear to have two separate event handlers because there is absolutely no code reuse between the two different radio groups.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25468938

http://stackoverflow.com/comment/39797010
has text: @Fildor: the `ByteBuffer` in this question *is* a memory mapped file. It's the conversion to a `CharBuffer` that's blowing his heap.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25484164
score: 1

http://stackoverflow.com/comment/39665251
type: Comment
type: QuestionComment
has text: You can try to use a `Scanner` to read the file line by line, and store them in an `ArrayList` as you read them. Is you use java 7 or 8, you can use `Files.readAllLines()`.
score: 0
comment on: http://stackoverflow.com/q/25426100

http://stackoverflow.com/comment/39713979
has text: Oh, it's not going to stop me from using it. The caveat was for people who come later and don't try it out in unit tests.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25424801

http://stackoverflow.com/q/25497053
has answer: http://stackoverflow.com/a/36647152
answer count: 5
upvote count: 32
has title: Why is try-with-resources catch block selectively optional?
has answer: http://stackoverflow.com/a/25497108
accepted answer: http://stackoverflow.com/a/25497108
has answer: http://stackoverflow.com/a/25497112
has answer: http://stackoverflow.com/a/25497096
score: 31
possible better answer: http://stackoverflow.com/a/25497112
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39798235
has comment: http://stackoverflow.com/comment/39800792
has comment: http://stackoverflow.com/comment/39798060
has answer: http://stackoverflow.com/a/56901767
tagged with: java
has body: I read that the catch block in try-with-resources is optional. I've tried creating a Connection object in a try-with-resources block, with no subsequent catch block, only to get compiler error from eclipse: "Unhandled exception type SQLException thrown by automatic close() invocation." Since every resource that can be used in try-with-resources implements AutoCloseable, and so potentially throws an exception upon invocation of the close() method, I don't understand how the catch clause is optional, given that it's not allowing me to skip catching the exception from close(). Is there some special requirement that the specific implementation of AutoCloseable not directly declare any exception thrown in its close() method? (e.g. override AutoCloseable's close() throws Exception with a close() which does not throw any Exception)? ..or is this possibly just an eclipse issue? Edit: Here's the simplest code fragment that still triggers the problem: try (Connection con = dataSource.getConnection()) { /*...*/ } Thoughts on whether or not this is related to the use of a JNDI DataSource? Thanks in advance.
downvote count: 1
tagged with: try-with-resources
tagged with: autocloseable
favorite count: 0
type: Question

http://stackoverflow.com/comment/125927032
type: AnswerComment
comment on: http://stackoverflow.com/a/25434492
score: 0
type: Comment
has text: @JonathanCole I'd say that's a _bad_ practice, unless `null` is _specifically the expected, valid value_ in those cases. Otherwise, if the IDE says the variable might not be initialized, then there is likely a code path where it _doesn't_ get initialized, and you should fix _that_ problem.

http://stackoverflow.com/a/25466907
has body: Change your ScaleType from CENTER_CROP to CENTER_INSIDE @Override public Object instantiateItem(ViewGroup container, int position) { ImageView imageView = new ImageView(context); int padding = context.getResources().getDimensionPixelSize(R.dimen.padding_small); imageView.setPadding(padding, padding, padding, padding); imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE ); imageView.setImageResource(GalImages[position]); ((ViewPager) container).addView(imageView, 0); return imageView; }
score: 0
has comment: http://stackoverflow.com/comment/39741998
answers question: http://stackoverflow.com/q/25466846
type: Answer

http://stackoverflow.com/a/25567151
accepted answer of: http://stackoverflow.com/q/25423133
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25423133
type: AcceptedAnswer
has body: Your starting point is the MPPReader class. The method setPreserveNoteFormatting allows you to control whether you get plain text or the RTF. You will need to retrieve the RTF in order to extract any embedded onjects: MPPReader reader = new MPPReader(); reader.setPreserveNoteFormatting(true); ProjectFile file = reader.read("/path/to/my/file.mpp"); There is a class distributed with MPXJ called RTFEmbeddedObject which implements a mechanism to extract the raw data for any objects embedded in the RTF produced by MS Project. Let's assume we have some notes attached to task 1, which contain embedded objects. Task task = file.getTaskByID(1); String notes = file.getNotes(); List&lt;List&lt;RTFEmbeddedObject&gt;&gt; list = RTFEmbeddedObject.getEmbeddedObjects(notes); The data returned is a list of lists... not great, but it works. The first list contains one entry per embedded object in the notes. Each list entry is composed of a list of blocks with a couple of flags (of unknown significance) and a block of binary data. In the examples I've come across so far, you can expect to see pairs of blocks. The first block will contain a text label, detailing the type of the data that follows, and the second block will contain the raw data for the embedded object. Typically there are four blocks per embedded object, two blocks to hold the raw data for the object itself, and two blocks representing the metafile preview image of the embedded object. Have a look at the unit test MppEmbededTest with a debugger - you'll be able to see the embedded object data being read from an example file.
has comment: http://stackoverflow.com/comment/40017667

http://stackoverflow.com/comment/39715584
type: Comment
comment on: http://stackoverflow.com/q/25453011
has text: Hmmm, it comes from LibGDX. Let me try to to put the elements in another kind of list.
score: 0
type: QuestionComment

http://stackoverflow.com/a/25416421
accepted answer of: http://stackoverflow.com/q/25414660
has body: There is a configuration option in Play which controls whether or not to trust the X-Forwarded-For header sent by Nginx. You need to add trustxforwarded=true to your application.conf. Have you done that? It's in the docs under the heading Advanced proxy settings: https://www.playframework.com/documentation/2.3.x/HTTPServer
type: Answer
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39663824
has comment: http://stackoverflow.com/comment/39691010
answers question: http://stackoverflow.com/q/25414660
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39602105
has text: This question appears to be off-topic because it is directly asking for code.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25391863
type: Comment

http://stackoverflow.com/q/25521690
has comment: http://stackoverflow.com/comment/39846380
has comment: http://stackoverflow.com/comment/39843943
tagged with: java
linked to: http://stackoverflow.com/q/9361538
has comment: http://stackoverflow.com/comment/39843707
has comment: http://stackoverflow.com/comment/39843752
type: Question
has title: Getting exception while calling procedure through JDBCTemplate
has comment: http://stackoverflow.com/comment/39843478
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/39847686
has comment: http://stackoverflow.com/comment/39843326
tagged with: spring
has body: I am working on an application that requires getting data from the stored procedures written in Oracle db. I am using JdbcTemplate of Spring to call the procedure. But calling the procedure results the following exception Stack trace :- &gt; org.springframework.jdbc.BadSqlGrammarException: &gt; CallableStatementCallback; bad SQL grammar [{call &gt; V2_tl.PKG_TECH_LINKING.p_get_model_list_intl_ctry(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}]; &gt; nested exception is java.sql.SQLSyntaxErrorException: ORA-00942: table &gt; or view does not exist Please tell me the solution
score: 0
has comment: http://stackoverflow.com/comment/39848605
answer count: 0

http://stackoverflow.com/comment/39705833
type: QuestionComment
comment on: http://stackoverflow.com/q/25447485
type: Comment
has text: It's an usability problem.. The users are used to type "space bar" to finish an operation like payment in a cashier..
score: 0

http://stackoverflow.com/q/25463569
type: Question
has comment: http://stackoverflow.com/comment/39735756
tagged with: while-loop
tagged with: java
has comment: http://stackoverflow.com/comment/39735644
has comment: http://stackoverflow.com/comment/39735703
has body: I am currently trying to make a program that opens, closes, turns on, and turns off a "Dishwasher". When I run this program once, i get my intended result of: Welcome to SiriWash What would you like to do? Open Door | Close Door | Turn on | Turn Off open door opening door The Dishwasher is Open and Off What would you like to do? Open Door | Close Door | Turn on | Turn Off Thouugh if I do this again, I get: Welcome to SiriWash What would you like to do? Open Door | Close Door | Turn on | Turn Off open door opening door The Dishwasher is Open and Off What would you like to do? Open Door | Close Door | Turn on | Turn Off close door What would you like to do? Open Door | Close Door | Turn on | Turn Off Here is the Runner Code: import java.util.Scanner; public class Runner { public static void main(String[] args) { Scanner reader = new Scanner(System.in); boolean gameRunning = true; Dishwasher washer1 = new Dishwasher(false,false); washer1.open(); washer1.turnOff(); //System.out.println(washer1); System.out.println("Welcome to SiriWash"); String answer = ""; //String answer = ""; while (gameRunning) { System.out.println("What would you like to do?"); System.out.println("Open Door | Close Door | Turn on | Turn Off "); answer = reader.nextLine(); if (answer.equalsIgnoreCase("open door")) { washer1.open(); System.out.println("opening door"); System.out.println(washer1); answer = ""; if (answer.equalsIgnoreCase("close door")) { washer1.close(); System.out.println("Closing door"); System.out.println(washer1); answer = ""; if (answer.equalsIgnoreCase("turn on")) { washer1.turnOn(); System.out.println("turning on"); System.out.println(washer1); answer = ""; if (answer.equalsIgnoreCase("turn off")){ washer1.turnOff(); System.out.println("turning off"); System.out.println(washer1); answer = ""; } } } } } } } It would seem that the if statements are skipped during a second input, how would I fix this?
upvote count: 0
type: UnansweredQuestion
score: -3
answer count: 1
downvote count: 3
has title: If Statements in While Loop
tagged with: loops
has answer: http://stackoverflow.com/a/25464538
favorite count: 0

http://stackoverflow.com/comment/39638580
type: QuestionComment
comment on: http://stackoverflow.com/q/25411158
has text: It gives back HTTPError 500, 'cause the code on the server can't get the data from the request, it want...
score: 0
type: Comment

http://stackoverflow.com/comment/39849126
has text: the foreign key in this instance actually represents a 1:1 model - one personal card can be owned by one user, one user can own one personal card
type: Comment
comment on: http://stackoverflow.com/a/25525007
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39693427
has text: @laune I was focused on the return if statement and missed the `i`...I have no idea how it compiles, cause I don't have a runnable example ;)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25441240

xsd
tags question: http://stackoverflow.com/q/25404502
tags question: http://stackoverflow.com/q/25508845
tags question: http://stackoverflow.com/q/25393252
tags question: http://stackoverflow.com/q/25515024
type: Tag
tags question: http://stackoverflow.com/q/25549248
tags question: http://stackoverflow.com/q/25547096
tag name: xsd
tags question: http://stackoverflow.com/q/25417048
tags question: http://stackoverflow.com/q/25512026

http://stackoverflow.com/a/25550280
accepted answer of: http://stackoverflow.com/q/25550225
has comment: http://stackoverflow.com/comment/39896274
score: 0
answers question: http://stackoverflow.com/q/25550225
has body: Because when you instantiate your superclass or any of its subclasses, you get a new instance of exampleString. Make the variable static and then the classes will share it. public static String exampleString; However in your example it looks like you only want to send a string to another activity like this: Intent intent = new Intent(); intent.putExtra("myString", "my example argument"); intent.setClass(getBaseContext(), Activity2.class); startActivity(intent); and receive it in your other class: public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.layout2); Bundle args = getIntent().getExtras(); String example = args.getString("myString"); Log.e("Mytag", "here " + example); } Activity2 will output: here my example argument
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39896209
has comment: http://stackoverflow.com/comment/39895651
type: Answer

http://stackoverflow.com/a/25487228
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/39977294
type: Answer
accepted answer of: http://stackoverflow.com/q/25476291
has comment: http://stackoverflow.com/comment/39801162
has comment: http://stackoverflow.com/comment/39789040
answers question: http://stackoverflow.com/q/25476291
upvote count: 2
has body: Just provide the type as a parameter to body, as shown: mockOutboundEndpoint.message(0).body(String.class).isEqualTo("Blah");
has comment: http://stackoverflow.com/comment/39804214
type: AcceptedAnswer

http://stackoverflow.com/comment/39803687
has text: If it is fixed, you can first write response not to `response.getWriter()`, but to `StringBuilder` object, then remove your tag substring from it using `indexOf()` and `delete()`, then write resulting object to `response.getWrtiter()`.
comment on: http://stackoverflow.com/q/25499361
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39797903
comment on: http://stackoverflow.com/q/25496881
score: 0
has text: @RobbyCornelissen no this problem is a bit more complex since he wants all permutations, all substrings and their permutations. Similar but woulnd't call it a duplicate. P.S. hey from Tamachi station.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25411340
has body: You can take a look here: Android - Change app Theme on onClick I am sorry it's not a comment but I don't have enough reputation :( EDIT - You can't use the setTheme before the superoncreate, if you will call it before the superoncreate it will work, like here: Change Activity&#39;s theme programmatically public void onCreate(Bundle savedInstanceState) { setTheme(android.R.style.Theme); super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); }
answers question: http://stackoverflow.com/q/25411283
score: 0
type: Answer

http://stackoverflow.com/a/25423537
score: 0
has body: I think you are a bit confused in what NVL function is for. Pratically it is useful when the query returns a NULL value and you are doing some kind of operation or aggregate function in it. Instead you are using it to create the request. Probably you should change the GET_PRODUCTS query in something like GET_PRODUCTS= SELECT * FROM table WHERE ProductId = ? AND prd_id = ? When you substitute the ? values with the new Object[]{ 0 == ProductId? null : ProductId, SKUCode} and values ProductId = null, SKUCode = 61334a the query becomes: GET_PRODUCTS= SELECT * FROM table WHERE ProductId = null AND prd_id = 61334a returning an empty result set, which should be correct if ProductId is not nullable (I assume is a primary key). If you instead have NULL ProductIds in your table the result set may not be empty.
has comment: http://stackoverflow.com/comment/39660713
type: Answer
answers question: http://stackoverflow.com/q/25422898

http://stackoverflow.com/comment/39833398
score: 0
type: Comment
type: AnswerComment
has text: +1 for `userLocale` as it indeed depends *only* on The Current User's Locale.
comment on: http://stackoverflow.com/a/25449715

http://stackoverflow.com/comment/39604181
type: QuestionComment
comment on: http://stackoverflow.com/q/25392656
score: 0
has text: Well, on the try statement I put a finally block then I close the connection and it can't access the variable conn. So reusing is probably my best move.
type: Comment

http://stackoverflow.com/comment/39761381
type: Comment
comment on: http://stackoverflow.com/q/25477428
type: QuestionComment
has text: @Hovercraft Full Of Eels This is the code from the book that I was reading(typed up by me). The book does not consider any threading issues ?
score: 0

http://stackoverflow.com/a/25519444
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25519363
has comment: http://stackoverflow.com/comment/39839652
has body: I am very new to web apps as well but I am working with Meteor and have found it very good. It runs on JavaScript not java but it would not take long to learn if you know java.
answers question: http://stackoverflow.com/q/25519363
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39839895

ms-project
type: Tag
tags question: http://stackoverflow.com/q/25423133
tag name: ms-project

http://stackoverflow.com/comment/52680023
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/32405562
has text: Good to know. I believe I originally worked around this by just using a new filename.

http://stackoverflow.com/q/25407433
tagged with: parsing
type: Question
has comment: http://stackoverflow.com/comment/39631385
has comment: http://stackoverflow.com/comment/39670485
tagged with: encode
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/994331
score: 0
has body: English text and numbers are displayed in result string correctly, but other letters i wish to display are not. Instead of them there are a sequences of symbols like &amp;-#-1080; ... I tried to set UTF-8 on my InputStreamReader, but it has no effect. Appreciate any help. Here's the code: public class HttpClient { private static String BASE_URL = "here url"; public String getData(String number) { HttpURLConnection con = null ; InputStream is = null; try { con = (HttpURLConnection) ( new URL(BASE_URL + number)).openConnection(); con.setRequestMethod("GET"); con.setDoInput(true); con.setDoOutput(true); con.connect(); // Let's read the response StringBuffer buffer = new StringBuffer(); is = con.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"), 8); String line = null; while ( (line = br.readLine()) != null ) buffer.append(line + "\r\n"); is.close(); con.disconnect(); return buffer.toString(); } catch(Throwable t) { t.printStackTrace(); } finally { try { is.close(); } catch(Throwable t) {} try { con.disconnect(); } catch(Throwable t) {} } return null; } } ------------ JSONObject jb = new JSONObject(data); JSONArray jr = jb.getJSONArray("items"); JSONObject c = jr.getJSONObject(0); String id = c.getString(TAG_ID); String images = c.getString(TAG_IMAGES); String title = new String(c.getString(TAG_TITLE).getBytes("ISO-8859-1"), "UTF- 8");//tried this - didn't help String text = c.getString(TAG_TEXT);`
answer count: 2
has comment: http://stackoverflow.com/comment/42713279
has answer: http://stackoverflow.com/a/25407601
has answer: http://stackoverflow.com/a/25407552
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: utf-8
has title: After json parse i have symbols instead letters

http://stackoverflow.com/comment/39696892
has text: Just to reiterate, because the connection between the list and the first snippet might be lost: Jon's example sets the date of the Calendar object to 5th _September_ 2014. 0-based months.
comment on: http://stackoverflow.com/a/25443126
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39630324
type: Comment
type: QuestionComment
has text: @FrankN.Stein I tried it at both locations i.e in `/data/data/your.app.name/databases/your.db` and `Environment.getExternalStorageDirectory().getAbsolutePath()+"/Android/data/"+databaseName` but nothing changed
score: 0
comment on: http://stackoverflow.com/q/25405382

http://stackoverflow.com/comment/39764310
comment on: http://stackoverflow.com/a/25476534
score: 0
type: Comment
has text: I'm not sure I understand your question but it will be a public solution. Not sure if I can call it a framework :)
type: AnswerComment

http://stackoverflow.com/a/25448959
has body: Base64 != Hex. You can use Base64 from apache commons-codec, import org.apache.commons.codec.binary.Base64; // ... public static String hashValue(String value) { String digest = null; try { MessageDigest md = MessageDigest.getInstance("MD5"); byte[] hash = md.digest(value.getBytes("UTF-16LE")); // &lt;-- note encoding return new String(Base64.encodeBase64(hash)); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; }
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39709682
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39710954
accepted answer of: http://stackoverflow.com/q/25448586
has comment: http://stackoverflow.com/comment/39707993
has comment: http://stackoverflow.com/comment/39707812
has comment: http://stackoverflow.com/comment/39781566
answers question: http://stackoverflow.com/q/25448586
has comment: http://stackoverflow.com/comment/39708574
has comment: http://stackoverflow.com/comment/39708486
has comment: http://stackoverflow.com/comment/39708156
has comment: http://stackoverflow.com/comment/39707982
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39707761

http://stackoverflow.com/a/25459083
score: 0
has body: No you can't do what you want with the Completion Suggester. You would need to post filter the results yourself. EDIT You could change the way you index your completions suggestions, each genre could have its own field. The mapping would look something like: { "movie_drama_suggest":{ "type":"completion" }, "movie_comedy_suggest":{ "type":"completion" }, "movie_horror_suggest":{ "type":"completion" } } You'll need to have have logic in you application that will determine what suggestion field to use during indexing based on the genre of the movie. Then in your query you can reference the suggestions for a specific genre. CompletionSuggestionBuilder compBuilder = new CompletionSuggestionBuilder("suggestapi"); compBuilder.field("movie_horror_suggest"); compBuilder.text("Ham");
has comment: http://stackoverflow.com/comment/39934893
has comment: http://stackoverflow.com/comment/39934804
has comment: http://stackoverflow.com/comment/39916694
type: Answer
answers question: http://stackoverflow.com/q/25453010

http://stackoverflow.com/a/25460850
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25460810
has comment: http://stackoverflow.com/comment/39730851
has body: There is byteValue() method available in Number class. Number is extended by Integer, Double, Float etc. List&lt;Integer&gt; list = getNumbers(); Iterator&lt;Integer&gt; iterator = list.iterator(); while(iterator.hasNext()) { Integer i = iterator.next() byteArray[index] = i.byteValue(); } You can also use java.nio.MappedByteBuffer class for block copy. see http://docs.oracle.com/javase/7/docs/api/java/nio/MappedByteBuffer.html. MappedByteBuffer is equivalent to Buffer.BlockCopy() in .NET
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25460810
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39730867
has comment: http://stackoverflow.com/comment/39730759
has comment: http://stackoverflow.com/comment/39730836
downvote count: 0

http://stackoverflow.com/comment/39692332
comment on: http://stackoverflow.com/q/25440547
score: 0
type: Comment
has text: Provided Code is of same file...The error line is as......JSONArray item=new JSONArray(Jsondata);
type: QuestionComment

ubuntu-13.04
tag name: ubuntu-13.04
type: Tag
tags question: http://stackoverflow.com/q/25471597

http://stackoverflow.com/comment/39868267
score: 0
has text: I don't see `javax.xml.bind.annotation` which is the package for `@XmlSchema`.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25511783

http://stackoverflow.com/comment/39695632
type: Comment
type: QuestionComment
has text: Do you want it to jump to next line automatically when no more space is available?
score: 0
comment on: http://stackoverflow.com/q/25442287

mongo-jackson-mapper
tags question: http://stackoverflow.com/q/25545984
tag name: mongo-jackson-mapper
type: Tag

process
tags question: http://stackoverflow.com/q/25550000
tags question: http://stackoverflow.com/q/25524601
tags question: http://stackoverflow.com/q/25400332
tags question: http://stackoverflow.com/q/25502812
type: Tag
tag name: process
tags question: http://stackoverflow.com/q/25518875

http://stackoverflow.com/a/25497282
has comment: http://stackoverflow.com/comment/39838580
has comment: http://stackoverflow.com/comment/44405170
has comment: http://stackoverflow.com/comment/39829305
has comment: http://stackoverflow.com/comment/65547825
has comment: http://stackoverflow.com/comment/65570814
type: Answer
has comment: http://stackoverflow.com/comment/39828975
has comment: http://stackoverflow.com/comment/39862149
has comment: http://stackoverflow.com/comment/39820409
has body: How are you creating the HTTP request? If you can create a reproducible test case, please file a bug with OkHttp and we'll fix.
score: 0
answers question: http://stackoverflow.com/q/25493288
has comment: http://stackoverflow.com/comment/39827693
has comment: http://stackoverflow.com/comment/62166629

http://stackoverflow.com/comment/39630348
type: Comment
type: QuestionComment
has text: @ldce In my SomeFragment method I setTag to SomeFragment. `mRootview.setTag("SomeFragment");` In my main Activity I tried access it like this `Fragment frag2 = getFragmentManager().findFragmentByTag("SomeTag");` frag2 is null
score: 0
comment on: http://stackoverflow.com/q/25405463

http://stackoverflow.com/q/25468992
accepted answer: http://stackoverflow.com/a/25953145
tagged with: amazon-web-services
linked to: http://stackoverflow.com/q/24884568
tagged with: struts2
has body: My second question is based on my the code given in my first query... Struts 2/ Foundation 5 - ModelDriven class and File upload I have tried to use Struts 2 for uploading file and form data and sending an email to the admin. There are 2 problems I am now facing: If I do not choose an attachment for file upload. I receive a NullPointerException `DEBUG2014-08-24 01:59:04,094 [http-bio-8080-exec-10] com.opensymphony.xwork2.conversion.impl.XWorkConverter - falling back to default type converter [com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@413518] DEBUG2014-08-24 01:59:04,096 [http-bio-8080-exec-10] org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor - Validating //submitAssign with method execute. DEBUG2014-08-24 01:59:04,096 [http-bio-8080-exec-10] com.opensymphony.xwork2.validator.ValidationInterceptor - Invoking validate() on action com.assignupload.actions.SubmitAssignment@d4eea DEBUG2014-08-24 01:59:04,097 [http-bio-8080-exec-10] com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil - cannot find method [validateExecute] in action [com.assignupload.actions.SubmitAssignment@d4eea] DEBUG2014-08-24 01:59:04,097 [http-bio-8080-exec-10] com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil - cannot find method [validateDoExecute] in action [com.assignupload.actions.SubmitAssignment@d4eea] DEBUG2014-08-24 01:59:04,097 [http-bio-8080-exec-10] com.opensymphony.xwork2.DefaultActionInvocation - Executing action method = null AssignmentInfo [email=amxxxxxxxxxxx@gmail.com, phoneNum=9700000000, custName=Axxxx Mxxxx, assignSubject=English, noOfPages=12, noOfWords=5000, lastDate=2014-08-31, descAssign=asdasdasdasd] ERROR2014-08-24 01:59:04,098 [http-bio-8080-exec-10] org.apache.struts2.dispatcher.Dispatcher - Exception occurred during processing request: null java.lang.NullPointerException at com.assignupload.actions.SubmitAssignment.execute(SubmitAssignment.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Me…
type: AnsweredQuestion
downvote count: 0
score: 1
upvote count: 1
tagged with: java
answer count: 1
tagged with: forms
tagged with: file-upload
has title: Struts 2 File Upload and AWS
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25953145

http://stackoverflow.com/q/25516850
favorite count: 0
type: Question
tagged with: jvmti
tagged with: java
has comment: http://stackoverflow.com/comment/39835350
linked to: http://stackoverflow.com/q/23810714
type: UnansweredQuestion
has body: A Java class file format supports an attribute called "source debug extension" (see Java language specification &sect;4.7.11 "TheSourceDebugExtension attribute"). In JVMs that support this aspect of JVMTI, you can query for this string using jvmtiError GetSourceDebugExtension(jvmtiEnv *, jclass, char **). My question is whether there's a way to use ordinary javac and the Java language to embed "source debug extension" information in a .class file. There doesn't appear to be an annotation in the core Java language that would do this (no obvious candidates in the "All Known Implementing Classes" list in the javadoc for java.lang.Annotation).
has comment: http://stackoverflow.com/comment/39836147
has title: Can javac supply a class' "source debug extension information" attribute?
downvote count: 0
tagged with: annotations
answer count: 1
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/39835506
has answer: http://stackoverflow.com/a/48008562

http://stackoverflow.com/q/25442272
score: 8
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25442712
linked to: http://stackoverflow.com/q/16774744
accepted answer: http://stackoverflow.com/a/25442488
upvote count: 8
has body: This is actually not about decompiling, I don't want to see the source, instead I want to see JVM instructions like invoke some/package/method()V. Is there a tool for this purpose?
has answer: http://stackoverflow.com/a/25442488
duplicate of: http://stackoverflow.com/q/24622856
downvote count: 0
duplicate of: http://stackoverflow.com/q/16774744
type: AnsweredQuestion
answer count: 3
has title: Is it possible to see JVM opcodes from class file?
tagged with: java
has answer: http://stackoverflow.com/a/25442567
possible better answer: http://stackoverflow.com/a/25442712
linked to: http://stackoverflow.com/q/24622856
has comment: http://stackoverflow.com/comment/39695369

http://stackoverflow.com/q/25415624
downvote count: 0
has title: XStream fromXML for moved property
has comment: http://stackoverflow.com/comment/39646774
has body: Given a class Parent, which has been serialized to XML. class Parent { Object A; Child child; } class Child { Object C; ... } If the property C is moved from the Child object to the parent, as follows class Parent { Object A; Object C; Child child; } class Child { ... } For XML files made before the change, how do you make sure the child c tag populates the new property in the parent when deserializing with xstream?
has answer: http://stackoverflow.com/a/25415756
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25415783
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25415783
favorite count: 0
possible better answer: http://stackoverflow.com/a/25415756
tagged with: xml-serialization
tagged with: xstream
type: Question
answer count: 2

http://stackoverflow.com/comment/39801022
type: Comment
comment on: http://stackoverflow.com/a/25498509
has text: The names of the Run Configurations are independent of the definitions of the servers that you have in the Servers tabs (also visibles in the Servers *project*).
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39721255
score: 3
has text: I think you misunderstand the concept of event driven programming
type: QuestionComment
comment on: http://stackoverflow.com/q/25455771
type: Comment

http://stackoverflow.com/comment/39771267
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25483061
score: 0
has text: Try `doc.select("id=groups_list")`

http://stackoverflow.com/comment/39612034
has text: Inspect will show all the elements, but in order to click the element through selenium, the element needs to be visible (check the property of the element after it is initialized). In your post you mentioned it is not visible?
type: QuestionComment
comment on: http://stackoverflow.com/q/25397122
score: 0
type: Comment

http://stackoverflow.com/comment/39865600
comment on: http://stackoverflow.com/q/25533978
score: 2
has text: what is the datatype of `str[j]`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25460448
answer count: 0
has comment: http://stackoverflow.com/comment/39732955
tagged with: tomcat
type: Question
has comment: http://stackoverflow.com/comment/39737466
has comment: http://stackoverflow.com/comment/39732670
has body: I tried to get Spring-MVC, Hibernate, JTA with a Postgres Server to work. I got most of the stuff working (Read from Db through EntityManager without JTA), but I can't get the transactions to work with JTA. <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> org.hibernate.jpa.HibernatePersistenceProvider ??? net.test.test.database.UsersEntity <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" /> <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/mydb" /> <property name="javax.persistence.jdbc.user" value="postgres"/> <property name="javax.persistence.jdbc.password" value="validpw"/> If I provide my datasource from my servlet I get an Exception like DataSourceLookupFailureException: Failed to look up JNDI DataSource with name 'dataSource' I also found resources saying the datasource should be defined in the application-server (but I am not sure about this one). If it is important I use a Tomcat-server.
has comment: http://stackoverflow.com/comment/39736469
has comment: http://stackoverflow.com/comment/39735566
type: UnansweredQuestion
tagged with: spring
tagged with: jta
has title: Don't know exactly what jta-data-source should be
has comment: http://stackoverflow.com/comment/39736350
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39730227

http://stackoverflow.com/a/25493276
answers question: http://stackoverflow.com/q/25493215
score: 0
type: Answer
has body: Main methods in java look like this (having a main method makes a class the main class). public static void main(String[] args) { //code... } Perhaps then you want to then call your method public static void main(String[] args) { // print the results of your method System.out.println(checkdigit("This is the string i'm giving to my method.")); }

http://stackoverflow.com/q/25461253
answer count: 2
linked to: http://stackoverflow.com/q/3295496
has body: I'm building a small webapp with some global variables (some are application-scoped, some are session-scoped). There are multiple JSPs, servlets and HTML files, all of which need access. How do I initialize such a variable from my class myObject? I would need to use the appropriate constructor from the class definition. According to an answer here, I shouldn't/can't use &lt;%! %&gt; in a JSP page. Is it possible to use &lt;c:set &gt; from JSTL? One possible way to use the global variable in a servlet is to use request.getSession().getAttribute("myObjectName"). But since this always returns an Object, I'll have to cast it every time before I can use myObject's methods. Is it possible to do this in a simpler fashion?
accepted answer: http://stackoverflow.com/a/25461555
possible better answer: http://stackoverflow.com/a/25462686
has answer: http://stackoverflow.com/a/25462686
type: AnsweredQuestion
score: 0
has title: How do you create and use variables of custom classes for a webapp?
tagged with: java
has answer: http://stackoverflow.com/a/25461555
tagged with: servlets
type: Question
linked to: http://stackoverflow.com/q/5397285

http://stackoverflow.com/comment/39747939
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25454047
has text: Thank you for the answer. With that change, now it doesn`t add the value when I uncheck the item, only remain the same. I would like that when I uncheck an Item, the value were remove from the total... I don´t know if i am explaining myself properly, sorry for my english
score: 0

http://stackoverflow.com/a/25442686
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25442580
has body: For result 1, dump the contents of your 4 lists into a TreeSet. This will sort and remove duplicates from the set at the same time. Then get the array of the set. For result 2, use array copy to copy all the numbers into 1 array and then sort that array using Arrays.sort(...). There is no need to try to merge them on your own due to the nature of the sorting algorithm which is O(nlog(n)). Quadrupling the size results in a multiplying factor of only 2.

http://stackoverflow.com/a/25549781
has body: If you used the gdx project generator (this: https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle), you should be able to create your runnable jar using this command: gradlew desktop:dist
has comment: http://stackoverflow.com/comment/60234355
accepted answer of: http://stackoverflow.com/q/25505790
answers question: http://stackoverflow.com/q/25505790
upvote count: 6
type: Answer
downvote count: 0
type: AcceptedAnswer
score: 6

http://stackoverflow.com/comment/39720487
type: Comment
comment on: http://stackoverflow.com/a/25455169
type: AnswerComment
has text: put your main code here.where you create your adapter
score: 0

http://stackoverflow.com/comment/39830570
comment on: http://stackoverflow.com/a/25481938
type: Comment
score: 0
type: AnswerComment
has text: I had to devide the full stack trace to 3 parts. If you add a constructor `public MerlinDevice(boolean loadCACerts, String cacertsPasswd)` a different error comes.

http://stackoverflow.com/a/25550293
has comment: http://stackoverflow.com/comment/39899621
has body: I think what you are looking for is the addProjection method on AuditQuery. You can add a projection on the revision number and date.
type: Answer
answers question: http://stackoverflow.com/q/25542231
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25542231

http://stackoverflow.com/comment/39763576
type: QuestionComment
type: Comment
has text: @camickr when searching normal text sir.
score: 0
comment on: http://stackoverflow.com/q/25478541

http://stackoverflow.com/comment/39702355
comment on: http://stackoverflow.com/q/25444221
score: 0
type: Comment
type: QuestionComment
has text: Nope, all depends on your rules. For example, if someone writes in `1.25` to a cell, then formats that to be an integer so it displays as just `1`, do you count that as an integer or not? Your business rules are likely too specific for a general case, so you just need to write 3 lines of code!

http://stackoverflow.com/a/25399864
downvote count: 0
has comment: http://stackoverflow.com/comment/39617116
has body: (?:.*?{"tag":)"(.*?)",.*?} This will match all the required groups.See Demo http://regex101.com/r/aN1bX5/1
type: Answer
has comment: http://stackoverflow.com/comment/39617533
has comment: http://stackoverflow.com/comment/39616935
answers question: http://stackoverflow.com/q/25399798
score: 3
has comment: http://stackoverflow.com/comment/39617037
upvote count: 3

http://stackoverflow.com/a/25546799
accepted answer of: http://stackoverflow.com/q/25546781
score: 3
answers question: http://stackoverflow.com/q/25546781
upvote count: 3
has body: Move the mImageView=(ImageView) findViewById(R.id.gallery); to onCreate() after setContentView(), leaving just the member variable declaration at the class level: private ImageView mImageView; Before onCreate() there's no window yet for the activity and you'll get the NPE. Before setContentView() there's no view hierarchy to search from and a null is returned.
type: Answer
has comment: http://stackoverflow.com/comment/39888744
downvote count: 0
has comment: http://stackoverflow.com/comment/39888867
type: AcceptedAnswer

filenotfoundexception
type: Tag
tag name: filenotfoundexception
tags question: http://stackoverflow.com/q/25504565
tags question: http://stackoverflow.com/q/25532266

http://stackoverflow.com/a/25423508
has comment: http://stackoverflow.com/comment/39667740
answers question: http://stackoverflow.com/q/25417721
has comment: http://stackoverflow.com/comment/39667929
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39667355
type: Answer
has body: @AleksiYrttiaho is right insofar as if you want to match subpackages you should use net.prc.sales.web.controller..* instead of net.prc.sales.web.controller.*.*. But that is not your problem here because the sample code shows that class CustomerInfoController is right in that package. Furthermore you need to specify a return type in your pointcut's method signature, specify a fully qualified class name for the annotation and make sure that your advice's return type matches the intercepted methods' type. Your advice cannot return void if the intercepted method returns something else (in your example ModelAndView). I would also recommend to re-throw the caught Throwable and not just swallow it. Try something like this: @Around("execution(* net.prc.sales.web.controller..*(..)) &amp;&amp; @annotation(net.prc.foo.bar.RequestMapping)") public Object ourAroundAdvice(ProceedingJoinPoint thisJoinPoint) throws Throwable { System.out.println("Before " + thisJoinPoint); Object result = null; try { result = thisJoinPoint.proceed(); System.out.println("After returning " + thisJoinPoint); return result; } catch (Throwable t) { System.out.println("After throwing " + thisJoinPoint); throw t; } } My recommendation is to learn AspectJ basics before doing complicated things. You could use native syntax instead of annotation style because Eclipse gives you great feedback via syntax highlighting and error messages. Then, if you have your pointcut ready, you can still convert it into @AspectJ syntax later. Update: As for binding the annotation to an advice parameter in order to be able to access its properties, this can also be done, I just read that part of your question. First get the advice executing at all, then continue here (code untested): @Around("execution(* net.prc.sales.web.controller..*(..)) &amp;&amp; @annotation(requestMapping)") public Object ourAroundAdvice(ProceedingJoinPoint thisJoinPoint, RequestMapping requestMapping) throws Throwable { System.out.println("Before " + th…
accepted answer of: http://stackoverflow.com/q/25417721
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/39667217

http://stackoverflow.com/comment/39764503
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25479177
has text: You forgot to add break in the end of your case switch

http://stackoverflow.com/a/25411089
downvote count: 0
upvote count: 1
has body: You are calling the wrong constructor. public GameTableFrame() Initialization is done in a parameterized constructor. public GameTableFrame(Dealer dealer, Player player) Use the parameterised one.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25410591

http://stackoverflow.com/comment/39847063
type: Comment
comment on: http://stackoverflow.com/q/25522542
score: 0
has text: Well, I saw this topic but I got scared away by 'Tomcat' term. Anyways I used that solution and it worked. Thanks!
type: QuestionComment

http://stackoverflow.com/comment/39880249
has text: @MadProgrammer , I tried JOptionPane.showMessageDialog(null, padRight(chinese1,m)+"end\n"+padRight(chinese2,n)+"end"); and it is still not aligned
comment on: http://stackoverflow.com/a/25541775
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25484726
has comment: http://stackoverflow.com/comment/39774230
type: UnansweredQuestion
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/39774485
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39774147
tagged with: spinner
has comment: http://stackoverflow.com/comment/39774536
has body: When we select the spinner the internally we use the id in this spinner stringArray = new ArrayList&lt;String&gt;(); myList = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); for(int i=0; i&lt;createdtrs_array.length(); i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("id", createdtrs_array.getJSONObject(i).getString("id")); map.put("name", createdtrs_array.getJSONObject(i).getString("name")); myList.add(map); stringArray.add(createdtrs_array.getJSONObject(i).getString("id")); } ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(BusTickets.this,android.R.layout.simple_spinner_item, stringArray); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); destnation.setAdapter(adapter);
score: 0
has comment: http://stackoverflow.com/comment/39774665
has comment: http://stackoverflow.com/comment/39774190
has title: How can we get the data from map in a spinner when we select the city and internally select the value of that filed
answer count: 0

http://stackoverflow.com/comment/105072056
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25425131
has text: @Boann, I have decompiled the code above, and don't find any hoisting `pizzaArrived == false` outside the loop, what's wrong?

http://stackoverflow.com/q/25496692
has body: I'm trying to open multiple windows with JavaFX, I have an eventlistener that opens a new window when a button is clicked it looks like this: @FXML private void joinAction() { Parent root; try { Stage stage = (Stage) joinButton.getScene().getWindow(); stage.close(); root = FXMLLoader.load(getClass().getResource("main.fxml")); stage = new Stage(); stage.setTitle("TuneUs"); stage.setScene(new Scene(root)); stage.show(); } catch (IOException e) {e.printStackTrace();} } the first window opens and the new one opens, but my problem is getting events to work with my second window in main.fxml I have this line: &lt;TextField id="chat_bar" onAction="#sendChat" layoutX="14.0" layoutY="106.0" prefHeight="22.0" prefWidth="403.0"/&gt; Then in my controller class I have this method: @FXML private void sendChat() { System.out.println("test"); } but Intellij is telling me that; no controller specified for top level element So, my question is: Do I need to create multiple controller classes or can I use just one for multiple windows if so how?
tagged with: javafx
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/39804920
downvote count: 0
has answer: http://stackoverflow.com/a/73068983
has comment: http://stackoverflow.com/comment/39797372
has title: Opening multiple windows with JavaFX
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39808622
possible better answer: http://stackoverflow.com/a/41316587
linked to: http://stackoverflow.com/q/32868089
has comment: http://stackoverflow.com/comment/39803504
tagged with: java
has answer: http://stackoverflow.com/a/41316587
tagged with: events
accepted answer: http://stackoverflow.com/a/25503074
score: 6
upvote count: 6
linked to: http://stackoverflow.com/q/14187963
has answer: http://stackoverflow.com/a/25503074
type: AnsweredQuestion
answer count: 3

http://stackoverflow.com/q/25489564
has comment: http://stackoverflow.com/comment/39784007
accepted answer: http://stackoverflow.com/a/25489691
tagged with: http://stackoverflow.com/tag/xml
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39783961
type: AnsweredQuestion
answer count: 2
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25489691
has comment: http://stackoverflow.com/comment/39783786
has title: JSONObject JSON array length
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25489692
possible better answer: http://stackoverflow.com/a/25489692
has comment: http://stackoverflow.com/comment/39783896
has comment: http://stackoverflow.com/comment/39784011
has comment: http://stackoverflow.com/comment/39783805
has body: I am reading the below XML in java, and converting to JSONObject [org.json.JSONObject]. and appending the metadata and returning as JSON. Problem: JSONObject jsonObj = service.getMyData(); // custom methods and invocation int count = jsonObj.length(); // length is 1 How do I take the correct count from this jsonObj? . The correct count I am referring to is 2 in this case. [2 books] What I tried? (1) System.out.println(jsonObj.length()); // prints 1 API says: length() Get the number of keys stored in the JSONObject. (2) Since number of keys is returned as 1, there is no point on trying the below one, still I tried and got the error of org.json.JSONException: JSONObject["User"] not found. System.out.println(jsonObj.getJSONArray("User").length()); (3) IF I try 'Users' ie: jsonObj.getJSONArray("Users").length() , it says JSONObject["Users"] is not a JSONArray. (4) JSONObject jsonObj = service.getMyData(); JSONObject jUsers = jsonObj.getJSONObject("Users"); JSONObject jUser = jUsers.getJSONObject("User"); System.out.println(jUser.length()); Error: org.json.JSONException: JSONObject["User"] is not a JSONObject. XML: Unni book1 book2 book3 Ammu book1 book2 book4 JSON: { "Users": { "User": [ { "Name": "Unni", "Books": { "Book": [ "book1", "book2", "book3" ] } }, { "Name": "Ammu", "Books": { "Book": [ "book1", "book2", "book4" ] } } ] } }

http://stackoverflow.com/comment/39769925
type: Comment
has text: I removed the el-api-2.2.jar from the shared library folder, and everything went fine, seems there is a conflict between "el-api-2.2.jar" and "javax.j2ee.el.jar" where "javax.j2ee.el" is application server jar. Now everything is ok but I am afraid this may cause errors ! Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25434197

http://stackoverflow.com/comment/39745490
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25468152
has text: You cannot generate configurable number of parameters in XSLT2.0 at runtime. Parameters should be predefined. You can use <xsl:choose> to call templates with different number of parameters.

http://stackoverflow.com/q/25531070
has comment: http://stackoverflow.com/comment/39860433
tagged with: swing
has comment: http://stackoverflow.com/comment/39861035
has answer: http://stackoverflow.com/a/25531169
tagged with: miglayout
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39865146
accepted answer: http://stackoverflow.com/a/25535913
answer count: 2
downvote count: 0
score: 1
upvote count: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25531169
has title: Grow table larger than growx
favorite count: 0
type: Question
has body: I have configured my layout like that: panel.add(addButtons(), "wrap"); panel.add(showTable(), "growx, wrap"); So at first I am adding a button group and then I would like to grow my table as large as it can and then wrap the next component in the next "line". However, my gui looks like that: Here you clearly cannot see any values from the table. Therefore, how to grow the table so that each value can be seen? I appreciate your answer!
has answer: http://stackoverflow.com/a/25535913
has comment: http://stackoverflow.com/comment/39860553
linked to: http://stackoverflow.com/q/24976391

http://stackoverflow.com/comment/39754296
type: QuestionComment
has text: Try removing the working mapping ans see what happens.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25473192

http://stackoverflow.com/q/25409410
type: Question
tagged with: android-studio
has comment: http://stackoverflow.com/comment/39634782
has body: private EditText InputWiek; //First input private EditText InputTspocz; //Second input private TextView textout; float Wiek = InputWiek; float Tspocz = InputTspocz; int Tmax = 220-Wiek; int RT = Tmax-Tspocz; int Tburn = 70*RT/100+Tspocz; public void buttonOnClick(View v) { Button button=(Button) v; InputWiek = (EditText) findViewById(R.id.idWiek); InputTspocz = (EditText) findViewById(R.id.idTspocz) textout = (TextView) findViewById(R.id.txtOutput; textout.setText(Tburn.getText())); //A little scrap here :/ } }
answer count: 1
type: AnsweredQuestion
score: 2
upvote count: 3
has answer: http://stackoverflow.com/a/25409438
accepted answer: http://stackoverflow.com/a/25409438
has comment: http://stackoverflow.com/comment/39639023
has title: Android Studio How to print on screen a variable content (number)
tagged with: android
tagged with: java
downvote count: 1
tagged with: android-activity
tagged with: eclipse
favorite count: 0

http://stackoverflow.com/comment/39873894
type: Comment
comment on: http://stackoverflow.com/a/25530416
score: 0
has text: I just saw that you are one of the creators of jung. Im using this for a live network represented with nodes and edges. My end goal is that this should refresh after every 10 minutes to create the exact same graph with the vertices in the same positions. Only the nodes will have updated information in its objects which i can use to for example change the color of the nodes to represent an alarm when the graph prints the next time. This would be the best way to do it right?
type: AnswerComment

http://stackoverflow.com/q/25483854
has title: Using Arrays.asList with int array
upvote count: 3
accepted answer: http://stackoverflow.com/a/25483925
tagged with: arrays
downvote count: 0
linked to: http://stackoverflow.com/q/18021218
has answer: http://stackoverflow.com/a/25483925
tagged with: collections
favorite count: 0
type: Question
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/25483933
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/25483933
has comment: http://stackoverflow.com/comment/39773081
has body: Using java.util.Arrays.asList, why its shows different list size for int (Primitive type) and String array? a) With int array, whenever I execute following program the List size = 1 public static void main(String[] args) { int ar[]=new int[]{1,2,3,4,5}; List list=Arrays.asList(ar); System.out.println(list.size()); } b) But if i change from int array type to String array(like String ar[] = new String[]{"abc","klm","xyz","pqr"};) , then I am getting the list size as 4 which i think is correct. PS : With Integer (Wrapper Class) array, then result is Fine, but i am not sure why in primitive int array, the list size is 1. Please explain.
answer count: 2

http://stackoverflow.com/comment/39631915
score: 0
comment on: http://stackoverflow.com/q/25407059
has text: @HuStmpHrrr, A* gives an approximate result. OP is after optimal solution.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25417708
has comment: http://stackoverflow.com/comment/39650487
upvote count: 7
has comment: http://stackoverflow.com/comment/39650675
has body: I'm not sure why you're trying to do what you are, when JProgressBar already provides the means to display a String value... See JProgressBar#setStringPainted for more details... import java.awt.EventQueue; import java.awt.GridBagLayout; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JProgressBar; import javax.swing.SwingWorker; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class ProgressBarTest { public static void main(String[] args) { new ProgressBarTest(); } public ProgressBarTest() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridBagLayout()); JProgressBar pb = new JProgressBar(); pb.setValue(0); pb.setStringPainted(true); pb.setString("Look ma, no hands"); frame.add(pb); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { for (int index = 0; index &lt; 1000; index++) { int progress = (int)Math.round((index / 1000f) * 100); setProgress(progress); Thread.sleep(10); } return null; } }; worker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { int value = (int) evt.getNewValue(); System.out.println(value); pb.setValue(value); } } }); worker.execute(); } }); } } Updated Now, if you "really" want to put a label on top of a progress bar, there are some tricks you can do, for example... import java.awt.EventQueue;…
has comment: http://stackoverflow.com/comment/39651545
type: Answer
has comment: http://stackoverflow.com/comment/39650649
answers question: http://stackoverflow.com/q/25417168
has comment: http://stackoverflow.com/comment/39650530
has comment: http://stackoverflow.com/comment/39650632
has comment: http://stackoverflow.com/comment/39650505
has comment: http://stackoverflow.com/comment/39650648
score: 7
downvote count: 0

http://stackoverflow.com/a/31290025
has body: LWJGL is just doing the graphics part. If you need a good collision detection or physics library for Java then JBullet is an option. JBullet is a Java port of the Bullet library used by many games.
type: Answer
answers question: http://stackoverflow.com/q/25467301
score: 0

http://stackoverflow.com/q/25480619
has title: eC (Ecere) how to not worry about private data fields of a class
has answer: http://stackoverflow.com/a/25480748
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25480698
possible better answer: http://stackoverflow.com/a/25480698
has body: In exposing the C++ (or Java) interface of a library, one has to provide the "private" fields of classes, and this is understable, because the compiler needs to know the structure of the class, in order to be able to compute, for example, sizeof(). But why this is needed and how could be alleviated? Because, for me, it appears as a breach in the encapsulation concept: why the user shall worry or have access to something that is considered to be private? One solution would be to define a size() function for each object, but this will be burdensome at runtime. Still, one language (eC/ecere) claims that [1]: "Library developers don't need to worry about the private content of the class definition being seen by the end user, only what is declared public will be visible" How is that achieved in eC and how could similar be implemented in Java or C++? [1] http://www.ecere.com/technologies.html
tagged with: encapsulation
accepted answer: http://stackoverflow.com/a/25480748
has answer: http://stackoverflow.com/a/26603569
tagged with: c++
score: 2
upvote count: 2
type: AnsweredQuestion
answer count: 3
downvote count: 0
tagged with: api
tagged with: java

http://stackoverflow.com/comment/39612088
type: QuestionComment
has text: apologies, i meant it throws an error : `element is not visible`
comment on: http://stackoverflow.com/q/25397122
type: Comment
score: 0

ubuntu
tags question: http://stackoverflow.com/q/25512316
tags question: http://stackoverflow.com/q/25400930
tag name: ubuntu
tags question: http://stackoverflow.com/q/25398344
type: Tag
tags question: http://stackoverflow.com/q/25425332
tags question: http://stackoverflow.com/q/25438338
tags question: http://stackoverflow.com/q/25453467
tags question: http://stackoverflow.com/q/25549492

http://stackoverflow.com/comment/39673215
type: Comment
score: 0
type: AnswerComment
has text: Glad to know it worked out, can you mark the answer as accepted by clicking on tick mark on top-left of my answer.
comment on: http://stackoverflow.com/a/25428712

http://stackoverflow.com/a/25543410
accepted answer of: http://stackoverflow.com/q/25528634
answers question: http://stackoverflow.com/q/25528634
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: One way is to to have the Client return itself (in the Future) when done. Just need a list and then use the afterExecute method. Like this: pool =new ThreadPoolExecutor(...) { @Override protected void afterExecute(Runnable r, Throwable t) { // The future returns the Client object! client = (Client)((FutureTask)r).get(); // Remove it from list of known clients clients.remove(client); } }; while() { socket = serverSocket.accept(); Client client = new Client(socket) // Submit to pool, using client as the future return value pool.submit(client, client); // Add to list of known clients clients.add(client); } // When app is closing private shutdown() { for(Client client : clients){ client.shutdown(); } }

http://stackoverflow.com/comment/39751919
score: 0
comment on: http://stackoverflow.com/q/25469115
has text: Thanks for all your answers and replys.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39613848
type: AnswerComment
has text: @user3889926 As a developer,you won't always override the methods from Object class .It depends on the requirement. To provide a simple example,equals method works well on primitive types and not on the custom objects created.So it is the design decision from the java gurus. Please refer the page http://docs.oracle.com/javase/tutorial/java/IandI/objectclass.html for more info.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25397931

http://stackoverflow.com/q/25418859
has answer: http://stackoverflow.com/a/25418918
tagged with: c#
has answer: http://stackoverflow.com/a/25418894
has answer: http://stackoverflow.com/a/25418892
answer count: 5
type: UnansweredQuestion
has title: Are these two methods together a form of recursion?
tagged with: .net
downvote count: 0
tagged with: recursion
has comment: http://stackoverflow.com/comment/39652418
has answer: http://stackoverflow.com/a/25419035
has comment: http://stackoverflow.com/comment/39652381
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25419622
has comment: http://stackoverflow.com/comment/39652398
tagged with: loops
upvote count: 1
has body: I have two methods, the first method calls the second method from within a forloop, but the second method calls the first method back with a sub item id. Is this a form of recursion? Though the same method doesn't call itself, is there any risk of stack overflow or any others issues that may be associated with normal recursive methods? void AddItems(int id) { var items = GetItems(id); foreach (var item in items) { AddItem(item); } } void AddItem(Item item) { DoSomething(item); AddItems(item.subItemId); } EDIT: Is there a way to make this iterative? I'm using C#.
favorite count: 0
type: Question

http://stackoverflow.com/a/25428713
score: 1
answers question: http://stackoverflow.com/q/25428533
downvote count: 0
upvote count: 1
has body: You could just use jQuery UI's ThemeRoller and then include the generated css file in your header. jQuery ThemeRoller Link
type: Answer

http://stackoverflow.com/comment/39765830
has text: @Smith_61 but that would make things harder, and wouldn't respect the indications of the assignment.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25479548

http://stackoverflow.com/comment/39810301
has text: FYI : RunTimeException(s) need not be explicitly defined as `throws`. Only checked exceptions should be.
type: Comment
score: 4
comment on: http://stackoverflow.com/q/25503983
type: QuestionComment

border-layout
tags question: http://stackoverflow.com/q/25504664
tags question: http://stackoverflow.com/q/25432172
type: Tag
tag name: border-layout

http://stackoverflow.com/q/25523525
has comment: http://stackoverflow.com/comment/39846783
score: -7
has comment: http://stackoverflow.com/comment/39953132
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25526986
tagged with: groovy
has answer: http://stackoverflow.com/a/25526986
has body: I want to achieve something like this in groovy: int arr[] = new int[2]; ArrayList&lt;arr&gt; al = new ArrayList&lt;arr&gt;(); for (3times) { ar[0] = Value coming from db; ar[1] = Value coming from db; al.add(arr); } println al(1)(2)
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39846619
has title: Arrays and Collection with Groovy
downvote count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/39850717
type: Question
has comment: http://stackoverflow.com/comment/39846702
upvote count: 0
has comment: http://stackoverflow.com/comment/39846699

http://stackoverflow.com/a/25484101
score: 0
has comment: http://stackoverflow.com/comment/39776388
has comment: http://stackoverflow.com/comment/39776165
has body: You should either specify the full path to the file (because the root working directory is not the directory where ConfigUtil is located) : inputStream = new FileInputStream("src/main/java/config.properties"); or use the following (which is using the directory ConfigUtil was loaded from): inputStream = getClass().getResourceAsStream("config.properties");
type: Answer
answers question: http://stackoverflow.com/q/25483735

http://stackoverflow.com/comment/39853513
comment on: http://stackoverflow.com/q/25527412
type: Comment
score: 0
type: QuestionComment
has text: http://stackoverflow.com/questions/8678630/noclassdeffounderror-for-code-in-an-java-library-on-android http://stackoverflow.com/questions/16602640/noclassdeffounderror-android-project

http://stackoverflow.com/a/25513085
score: 1
answers question: http://stackoverflow.com/q/25512968
downvote count: 0
has comment: http://stackoverflow.com/comment/39994391
upvote count: 1
has body: Why The . dot in a char class [] means exactly a dot, not any character as it works outside character classes. Solution What you're looking for is a negated character class: RegEx: [^0-9$] live demo
type: Answer
has comment: http://stackoverflow.com/comment/39970757

http://stackoverflow.com/q/25468867
score: 0
has comment: http://stackoverflow.com/comment/39745842
has comment: http://stackoverflow.com/comment/39745893
tagged with: java
has comment: http://stackoverflow.com/comment/39746311
has body: Suppose I have 2 classes ........A Class is base class and class B is derived class and if i create a reference such as : A a=new B(); does it mean that reference a points to object of B Class ? If yes than how am i able to call overridden methods of A in B and not other methods of B ? thank you in advance class A { m1() { } } class B extends A { m1() { } m2() { } } A a=new B(); a.m1(); //it will call overridden m1() in B a.m2(); //it doesnt work if reference "a" points to object of B than why doesnt it call m2 method ?
has comment: http://stackoverflow.com/comment/39745768
has answer: http://stackoverflow.com/a/25468897
possible better answer: http://stackoverflow.com/a/25468897
tagged with: class
accepted answer: http://stackoverflow.com/a/25468880
has comment: http://stackoverflow.com/comment/39745997
has title: Dynamic Method invocation (Objects and reference in inheritance )
answer count: 2
has comment: http://stackoverflow.com/comment/39745773
tagged with: dynamic
has comment: http://stackoverflow.com/comment/39746069
has comment: http://stackoverflow.com/comment/39746077
has comment: http://stackoverflow.com/comment/39745326
has comment: http://stackoverflow.com/comment/39745754
has comment: http://stackoverflow.com/comment/39746381
has comment: http://stackoverflow.com/comment/39745651
tagged with: inheritance
has comment: http://stackoverflow.com/comment/39746007
has comment: http://stackoverflow.com/comment/39745848
type: Question
has comment: http://stackoverflow.com/comment/39745962
has comment: http://stackoverflow.com/comment/39745657
has answer: http://stackoverflow.com/a/25468880
tagged with: object
has comment: http://stackoverflow.com/comment/39746215
type: AnsweredQuestion

http://stackoverflow.com/comment/39895058
type: Comment
type: QuestionComment
score: 0
has text: @webuster there is a standard way of comparing strings, comparing collections should have same behavior
comment on: http://stackoverflow.com/q/25548594

http://stackoverflow.com/q/25501970
has body: I am currently trying to make an RSS feed reading app in android. Everything works, in the sense that it goes to the RSS feed....and pulls back the data. However, I have noticed that the first item in the list has it's first few characters cut off, and I am not sure why. I am certain it has something to do with my characters() function, but what it is I am not sure of. If anyone could help me that would be great! Thanks. UPDATE The problem has now been solved for me, thanks to Rakesh Rangani; if you are stuck on a similar problem, check out his answer below...it helped me out! The code I am referring to: package com.example.rssapplication; import java.util.ArrayList; import java.util.List; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; import android.util.Log; /** * SAX tag handler * * @author ITCuties * */ public class RssParseHandler extends DefaultHandler { private List&lt;RssItem&gt; rssItems; // Used to reference item while parsing private RssItem currentItem; // Parsing title indicator private boolean parsingTitle; // Parsing link indicator private boolean parsingLink; public RssParseHandler() { rssItems = new ArrayList&lt;RssItem&gt;(); RssItem g = null; //rssItems.add(g); } public List&lt;RssItem&gt; getItems() { return rssItems; } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ("item".equals(qName)) { currentItem = new RssItem(); } else if ("title".equals(qName)) { parsingTitle = true; } else if ("link".equals(qName)) { parsingLink = true; } } @Override public void endElement(String uri, String localName, String qName) throws SAXException { if ("item".equals(qName)) { rssItems.add(currentItem); currentItem = null; } else if ("title".equals(qName)) { parsingTitle = false; } else if ("link".equals(qName)) { parsingLink = false; } } @Override public void characters(char[] ch, int start, int length) throws SAXException { if…
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25502164
tagged with: rss
tagged with: java
answer count: 1
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/25502164
has title: First few characters are cut off from title, RSS reader app android

http://stackoverflow.com/comment/39727145
comment on: http://stackoverflow.com/a/25458686
type: AnswerComment
score: 0
has text: @alfasin There's what danger?
type: Comment

http://stackoverflow.com/q/25513711
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25516372
has answer: http://stackoverflow.com/a/25556502
linked to: http://stackoverflow.com/q/7229226
tagged with: grid-layout
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39828985
tagged with: java
has answer: http://stackoverflow.com/a/25515728
downvote count: 0
has body: i have a text field like emailid, city and address, i want to make the address textfield should be bigger as shown in image! i use BorderLayout as default and GridLayout for the selected panel top.setLayout(new GridLayout(8,4,10,10)); top.add(emailid); top.add(temailid); top.add(address); top.add(taddress); add(top, BorderLayout.CENTER);
has answer: http://stackoverflow.com/a/25514038
tagged with: layout-manager
tagged with: swing
tagged with: jtextfield
favorite count: 0
type: Question
has title: how to make my textfield bigger for GUI in java
has answer: http://stackoverflow.com/a/25513925

http://stackoverflow.com/comment/39835592
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25516391
has text: Actually, yes I would mind. I'm not a coding service, nor a debugging service. There is a logic error in your `please` method which allowing bracketing the time values (`time3`) outside of the range of `time1` and `time2`. Because I don't know what it is you are trying to achieve or why, it's impossible for more to make recommendations. Take this as an oppurtunity to flex your debugging skills. Add some `System.out.println` statements in to see what the values are and even run a debugger over it. The basic requirements to improve your code are spelled out above...

http://stackoverflow.com/comment/39876650
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25539732
score: 0
has text: In your current code, I would also inspect the `AM_PM` flag and see what's value is...

http://stackoverflow.com/q/25441838
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/25444841
tagged with: javafx-8
type: AnsweredQuestion
tagged with: java
tagged with: javafx
tagged with: treeview
has body: I have a strange checkbox selection issue with nodes that have Children in a JavaFX 8 TreeView using CheckBoxTreeItems with custom CheckBoxTreeCell. The Problem is that checkboxes of Nodes with children have to be clicked twice instead of once in order to be selected. Leaves require only a single click. My CheckBoxTreeItems take Person Objects. I override the updateItem() Method in my CheckBoxTreeCells to set the value displayed to the name of the Person in the TreeCell. If I don't call setText() in my overidden updateItem Method, the TreeCell displays the default toString() Method of my Person object (which is not what I want) and all nodes behave a expected when selecting their checkboxes. I do not want to change the default toString in class Person, so the only workaround I see is to write a Wrapper class for Person that returns the Persons name in its toString(). But I prefer resolving this issue properly rather than using a workaround! Any ideas? Help would be much appreciated! Here is the code I use: class Person { String name; int age; public Person(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } and public class TreeUtilTest extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { VBox vBox = new VBox(); TreeView&lt;Person&gt; treeView = new TreeView&lt;&gt;(); treeView.setCellFactory(p -&gt; new CheckBoxTreeCell&lt;Person&gt;() { @Override public void updateItem(Person item, boolean empty) { super.updateItem(item, empty); if (item != null) { setText(item.getName()); } } }); vBox.getChildren().add(treeView); CheckBoxTreeItem&lt;Person&gt; treeRoot = new CheckBoxTreeItem&lt;&gt;(); treeRoot.setValue(new Person("Peter", 10)); treeRoot.setIndependent(true); treeView.setRoot(treeRoot)…
downvote count: 0
answer count: 1
favorite count: 0
type: Question
has title: JavaFX 8 TreeView showing CheckBoxTreeItem with custom CheckBoxTreeCell - Checkbox Selection issue
tagged with: checkbox
accepted answer: http://stackoverflow.com/a/25444841

math
tags question: http://stackoverflow.com/q/25404088
tags question: http://stackoverflow.com/q/25506470
tags question: http://stackoverflow.com/q/25510857
tags question: http://stackoverflow.com/q/25465699
tags question: http://stackoverflow.com/q/25515113
type: Tag
tags question: http://stackoverflow.com/q/25511795
tags question: http://stackoverflow.com/q/25469731
tags question: http://stackoverflow.com/q/25539598
tags question: http://stackoverflow.com/q/25439703
tags question: http://stackoverflow.com/q/25454734
tags question: http://stackoverflow.com/q/25487597
tags question: http://stackoverflow.com/q/25467722
tag name: math
tags question: http://stackoverflow.com/q/25484616

http://stackoverflow.com/q/25489130
type: UnansweredQuestion
tagged with: artificial-intelligence
has body: I'm trying to implement the A* algorithm in Java. I followed this tutorial,in particular, this pseudocode: http://theory.stanford.edu/~amitp/GameProgramming/ImplementationNotes.html The problem is my code doesn't work. It goes into an infinite loop. I really don't know why this happens... I suspect that the problem are in F = G + H function implemented in Graph constructors. I suspect I am not calculate the neighbor F correclty. Here's my code: List&lt;Graph&gt; open; List&lt;Graph&gt; close; private void createRouteAStar(Unit u) { open = new ArrayList&lt;Graph&gt;(); close = new ArrayList&lt;Graph&gt;(); u.ai_route_endX = 11; u.ai_route_endY = 5; List&lt;Graph&gt; neigh; int index; int i; boolean finish = false; Graph current; int cost; Graph start = new Graph(u.xMap, u.yMap, 0, ManhattanDistance(u.xMap, u.yMap, u.ai_route_endX, u.ai_route_endY)); open.add(start); current = start; while(!finish) { index = findLowerF(); current = new Graph(open, index); System.out.println(current.x); System.out.println(current.y); if (current.x == u.ai_route_endX &amp;&amp; current.y == u.ai_route_endY) { finish = true; } else { close.add(current); open.remove(open.indexOf(current)); //EDITED LATER neigh = current.getNeighbors(); for (i = 0; i &lt; neigh.size(); i++) { cost = current.g + ManhattanDistance(current.x, current.y, neigh.get(i).x, neigh.get(i).y); if (open.contains(neigh.get(i)) &amp;&amp; cost &lt; neigh.get(i).g) { open.remove(open.indexOf(neigh)); } else if (close.contains(neigh.get(i)) &amp;&amp; cost &lt; neigh.get(i).g) { close.remove(close.indexOf(neigh)); } else if (!open.contains(neigh.get(i)) &amp;&amp; !close.contains(neigh.get(i))) { neigh.get(i).g = cost; neigh.get(i).f = cost + ManhattanDistance(neigh.get(i).x, neigh.get(i).y, u.ai_route_endX, u.ai_route_endY); neigh.get(i).setParent(current); open.add(neigh.get(i)); } } } } System.out.println("step"); for (i=0; i &lt; close.size(); i++) { if (close.get(i).parent != null) { System.out.println(i); System.out…
has comment: http://stackoverflow.com/comment/39782841
has comment: http://stackoverflow.com/comment/39784001
has comment: http://stackoverflow.com/comment/39783352
tagged with: a-star
score: 0
has answer: http://stackoverflow.com/a/25490152
upvote count: 1
has comment: http://stackoverflow.com/comment/39783713
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39784432
favorite count: 0
has comment: http://stackoverflow.com/comment/39783818
has title: Problems with with A* algorithm
type: Question
tagged with: algorithm
linked to: http://stackoverflow.com/q/27581
tagged with: java

http://stackoverflow.com/q/25443125
type: UnansweredQuestion
score: 0
answer count: 1
tagged with: spinner
has title: (Android) change text size of a child-view of spinner
has body: I use the following code to access the child view of spinner and then change the font size of the text. Unfortunately, I cannot change the size of the text while I can get the text of the child view of the spinner. Could anyone tell me the problem below? SpinnerAdapter temp=spinner.getAdapter();//get adapter from spinner TextView text_in_spinner=(TextView)temp.getDropDownView(1, null, null);//get all view at position 1 text_in_spinner.setTextSize(TypedValue.COMPLEX_UNIT_SP,15);//set text size Log.v("view text",(String)text_in_spinner.getText());//get text
has answer: http://stackoverflow.com/a/25443414
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39830733
type: Question

http://stackoverflow.com/a/25520962
upvote count: 2
type: AcceptedAnswer
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/25505630
has body: Still i couldn't find way to directly pass parameter using List or Map . But i got what i want through the way: I added another Class Inof which will be carry the parameters to iBATIS. Public Class Inof { private String fromDate; private String fromDate; private List<User> list; } SELECT * from myTable WHERE fromDate>= #fromDate# and toDate<=#toDate# and name IN #list[].name# and location IN #list[].location# This give me what i want, but i am not totally satisfied. If still there is some other way which is good practice or efficient please share.
answers question: http://stackoverflow.com/q/25505630
type: Answer

http://stackoverflow.com/q/25477015
has answer: http://stackoverflow.com/a/25477022
has comment: http://stackoverflow.com/comment/39760412
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39760436
answer count: 1
tagged with: methods
downvote count: 1
has body: I have written a short program that uses inheritances and interface relationships to calculate the area and the perimeter of user selected shapes. I receive a compile time error when I attempt to compile the following classes. Class Square public class Square extends Quadrilateral { double side1 =this.side1; double side2 = this.side2; double perimeter = this.perimeter; double area = this.area; Square(double instanceSide1, double instanceSide2) { side1 = instanceSide1; side2 = instanceSide2; } @Override public double area() { area = side1 *side2; return area; } @Override public double perimeter() //math equation for determing perimeter { this.perimeter = (side1 * 2) + (side2 * 2) ; return perimeter; } } Here is my Quad class public abstract class Quadrilateral implements Polygon{ } Here is the Polygon Class public interface Polygon { abstract void area(); abstract void perimeter(); } Here is the Tester Class that I've built to run the code. public static void main(String[] args) //Constructor initalizing main class { int numberSides; int length; int base; Scanner sides = new Scanner(System.in); //Initializing Scanner Class /** * Do/while loop for selecting a 3 or 4 sided object */ do { System.out.println("Do you want a 3 or 4 sided shape? (Type either " + "3 or 4)."); numberSides = sides.nextInt(); } while (numberSides &lt; 3 || numberSides &gt; 4); if (numberSides == 3) { System.out.println("How long are the sides that are the same lenth?"); length = sides.nextInt(); System.out.println("How wide is the base? (whole numbers"); base = sides.nextInt(); IsoscelesTriangle Isoc = new IsoscelesTriangle(length, base); System.out.println("The area of the isocolese triangle is: " + Isoc.area()); System.out.println("The perimeter of the isocolese triangle is: " + Isoc.perimeter()); } else { System.out.println("How long are the sides are the same?"); length = sides.nextInt(); System.out.println("How wide is the base?"); base = sides.nextInt(); if (length == base) { Square Quad …
favorite count: 0
type: Question
tagged with: object
tagged with: interface
has comment: http://stackoverflow.com/comment/39760440
score: -1
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/25477022
has title: Interface and Inheritance compile time error
type: AnsweredQuestion

http://stackoverflow.com/a/25418520
has comment: http://stackoverflow.com/comment/39664185
score: 1
has comment: http://stackoverflow.com/comment/39652960
has comment: http://stackoverflow.com/comment/39653009
has comment: http://stackoverflow.com/comment/39652996
has comment: http://stackoverflow.com/comment/39652949
type: Answer
has comment: http://stackoverflow.com/comment/39675536
has comment: http://stackoverflow.com/comment/39676656
has comment: http://stackoverflow.com/comment/39652928
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25417588
upvote count: 1
has body: create the FILE not the directory! newFile.createNewFile(); FileInputStream fistream1 = new FileInputStream(newFile1 ); // first source file FileInputStream fistream2= new FileInputStream(newFile2 );//second source file Vector&lt;FileInputStream&gt; v = new Vector&lt;FileInputStream&gt;(); v.add(fistream1); v.add(fistream2); SequenceInputStream sistream = new SequenceInputStream(fistream1, fistream2); if(!newFile.exists()){ newFile.createNewFile(); FileOutputStream fostream=new FileOutputStream(newFile, true); int temp; while( ( temp = sistream.read() ) != -1) { System.out.print( (char) temp ); // to print at DOS prompt fostream.write((byte)temp); // to write to file } fostream.close(); sistream.close(); fistream1.close(); fistream2.close(); }
has comment: http://stackoverflow.com/comment/39676612
accepted answer of: http://stackoverflow.com/q/25417588

http://stackoverflow.com/q/25497050
has body: I have been trying for hours to get a Texture in LWJGL to stretch to a quad. Here is the code I am using for the quad: private static void renderLoad() { glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); texture.bind(); glPushMatrix();{ glBegin(GL_QUADS); { glTexCoord2f(0, 1); glVertex2f(0, 0); //Upper-left glTexCoord2f(1, 1); glVertex2f(Display.getWidth(), 0); //Upper-right glTexCoord2f(1, 0); glVertex2f(Display.getWidth(), Display.getHeight()); //Bottom-right glTexCoord2f(0, 0); glVertex2f(0, Display.getHeight()); //Bottom-left } glEnd(); }glPopMatrix(); } This is what the display looks like when I run it: http://gyazo.com/376ddb0979c55226d2f63c26215a1e12 I am trying to make the image expand to the size of the window. The Quad is at the size of the window, but the texture seems to not stretch. Here is what it looks like if I do not use a texture and I simple make the quad a color: http://gyazo.com/65f21fe3efa2d3948de69b55d5c85424 If it helps here is my main loop: glMatrixMode(GL_PROJECTION); glViewport(0, 0, displaySizeX, displaySizeY); glLoadIdentity(); glOrtho(0, displaySizeX, 0, displaySizeY, 1, -1); glMatrixMode(GL_MODELVIEW); glEnable(GL_TEXTURE_2D); texture = loadLoadingImage(); //This is the main loop for the game. while(!Display.isCloseRequested()){ delta = getDelta(); updateFPS(); if(Display.wasResized()){ displaySizeX = Display.getWidth(); displaySizeY = Display.getHeight(); glViewport(0, 0, displaySizeX, displaySizeY); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, displaySizeX, 0, displaySizeY, -1, 1); } render(); checkInput(); Display.update(); Display.sync(sync); } cleanUp(); return true; How do I make the image stretch to the quad?
has comment: http://stackoverflow.com/comment/39799010
has comment: http://stackoverflow.com/comment/39824738
accepted answer: http://stackoverflow.com/a/25497950
type: AnsweredQuestion
tagged with: 2d
answer count: 2
tagged with: opengl
score: 1
tagged with: java
tagged with: lwjgl
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39798997
has comment: http://stackoverflow.com/comment/39825408
has title: LWJGL Texture not stretching to Quads
has answer: http://stackoverflow.com/a/25497950
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39798569
has answer: http://stackoverflow.com/a/25500648
possible better answer: http://stackoverflow.com/a/25500648

http://stackoverflow.com/a/25518772
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39919915
has comment: http://stackoverflow.com/comment/40047559
type: Answer
has comment: http://stackoverflow.com/comment/39949525
has body: You're doing it right. Are you sure it's hanging and not throwing an unexpected exception? If it's hanging, what's the stack trace show?
has comment: http://stackoverflow.com/comment/39981131
answers question: http://stackoverflow.com/q/25515338
downvote count: 0

http://stackoverflow.com/q/25521190
has body: i want to get a string between some given string like this.. String wholetext = "SomePlace Pin- 110065 Name and address Alias 1 ID of customer-123 SomePlace " String namerequired = ""; String textafter = "110065 Name and address"; String textbefore = "ID of customer"; //Constant part-110065 Name and address and ID of customer googled and get some thing like this doindexing and this doindexing1 i am trying to get Alias 1 and not getting idea :( ? Help please
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25521398
has comment: http://stackoverflow.com/comment/39842782
has answer: http://stackoverflow.com/a/25521482
has answer: http://stackoverflow.com/a/25521398
tagged with: java
has title: How to get name between some string?
has answer: http://stackoverflow.com/a/25521468
linked to: http://stackoverflow.com/q/11229986
linked to: http://stackoverflow.com/q/2615749
tagged with: string
type: Question
has comment: http://stackoverflow.com/comment/39842490
has comment: http://stackoverflow.com/comment/39842734
accepted answer: http://stackoverflow.com/a/25521658
tagged with: android
has comment: http://stackoverflow.com/comment/39842637
has answer: http://stackoverflow.com/a/25521658
answer count: 4
has comment: http://stackoverflow.com/comment/39842611
tagged with: indexing

http://stackoverflow.com/q/25500489
favorite count: 0
score: 8
type: Question
has title: Java StringTokenizer with empty tokens
answer count: 8
has answer: http://stackoverflow.com/a/48752331
possible better answer: http://stackoverflow.com/a/25500634
upvote count: 8
has answer: http://stackoverflow.com/a/25500542
has answer: http://stackoverflow.com/a/25500657
has answer: http://stackoverflow.com/a/25500632
accepted answer: http://stackoverflow.com/a/25500549
has answer: http://stackoverflow.com/a/25500549
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39803950
has answer: http://stackoverflow.com/a/25500634
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/73991224
has answer: http://stackoverflow.com/a/25500998
tagged with: stringtokenizer
has body: I have a string that looks some thing like - 56,0,76,0,93,,,,,,,1230. I use a StringTokenizer to split this by ','. However, it seems that this is skipping from 93 straight to 1230. Is there a way to make it return six empty strings before it moves to 1230?

http://stackoverflow.com/comment/39671256
score: 0
type: Comment
type: QuestionComment
has text: It seems The Math.random is kind of complex. If you don't find any detailed information on stackoverflow or google, you can type Math.random() in a Java application in eclipse, click on the "random()" and press the F3 button to see what code gets called. Keep pressing F3 to keep going down the rabbit hole. :)
comment on: http://stackoverflow.com/q/25429063

http://stackoverflow.com/comment/39644976
score: 0
type: Comment
has text: You mean [`Objects.hashCode()`](http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/base/Objects.html#hashCode%28java.lang.Object...%29), right? It has been created just for this job. And Java 7 has a similar functionality.
type: AnswerComment
comment on: http://stackoverflow.com/a/25414606

http://stackoverflow.com/q/25505015
tagged with: generics
has comment: http://stackoverflow.com/comment/39812851
type: Question
accepted answer: http://stackoverflow.com/a/25505702
has answer: http://stackoverflow.com/a/25506081
possible better answer: http://stackoverflow.com/a/25505364
has answer: http://stackoverflow.com/a/25505702
has title: How to implement that - generic method ro create result
has comment: http://stackoverflow.com/comment/39812345
has comment: http://stackoverflow.com/comment/39814309
has answer: http://stackoverflow.com/a/25505364
tagged with: design-patterns
answer count: 4
type: AnsweredQuestion
score: 0
tagged with: oop
has answer: http://stackoverflow.com/a/25505712
tagged with: java
has body: I have a bunch of method like these: public Result createSomething1(A a, B b, C c) {} public Result createSomethung2(B a, C c, D d) {} Always I need to create Result object with updated (or not) object above using fluent api and status like that: Result result = new Result.withA(a) .withB(b) .withC(c) ...withStatus("success"); I don't want to create separated method for each of set parameters. How I can write generic method which be able to create Result object from undefined numbers of parameters? For example: pseudo-code Result createResult(A a, B b, C c ...) { return with(a, b, c, ...) } using Result createSomething1(A a, B b) { // business processing ending error Result result = createResult(a, b); result.withStatus("error") return result; } Result createSomething2(A a, C c, M m) { // business processing ending Result result = createResult(c, m); a.setFoo("foo"); result.withA(a); return result; } ?

http://stackoverflow.com/q/25500735
favorite count: 0
tagged with: jakarta-ee
has title: Java EE show how many connections left in the connection pool
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/25500866
has answer: http://stackoverflow.com/a/25500866
tagged with: connection-pooling
type: AnsweredQuestion
score: 2
has body: My system encounter some connection leak in connection pool. I would like to list down some statistic of the connection pool regularly, how can I do that? For example, Current Capacity, Active Connections High Count, Connections Total Count, Leaked Connection Count and etc. I am using javax.sql.DataSource to retrieve the connection from connection pool. But I couldn't find any interface that can retrieve those connection pool information. Any ideas? I am using Oracle DB and Java EE as my server side script.
tagged with: java
answer count: 1
downvote count: 0
tagged with: oracle11g
tagged with: oracle10g

http://stackoverflow.com/comment/39807002
type: Comment
comment on: http://stackoverflow.com/a/25500503
score: 0
type: AnswerComment
has text: @assylias Really? I am not fluent in java8, but I figured out it will create a stream of all elements that match the filter condition, and than iterate them to yield the min. Nice to know it is optimized to do it in a single iteration. Is it implementation detail or written in specification? (Not sarcastic comment, truly am impresses)

http://stackoverflow.com/comment/40114583
has text: Can anyone help me with this?
comment on: http://stackoverflow.com/q/25486647
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39897179
type: AnswerComment
comment on: http://stackoverflow.com/a/25548682
has text: can we draw transparent layer on image according point.I have used static image that store drawable folder.
type: Comment
score: 0

http://stackoverflow.com/a/25425384
accepted answer of: http://stackoverflow.com/q/25390100
has comment: http://stackoverflow.com/comment/93853572
type: Answer
has body: ServerEndpointExporter makes some assumptions about the lifecycle of an application context that don't hold true when you're using Spring Boot. Specifically, it's assuming that when setApplicationContext is called, calling getServletContext on that ApplicationContext will return a non-null value. You can work around the problem by replacing: @Bean public ServerEndpointExporter endpointExporter() { return new ServerEndpointExporter(); } With: @Bean public ServletContextAware endpointExporterInitializer(final ApplicationContext applicationContext) { return new ServletContextAware() { @Override public void setServletContext(ServletContext servletContext) { ServerEndpointExporter serverEndpointExporter = new ServerEndpointExporter(); serverEndpointExporter.setApplicationContext(applicationContext); try { serverEndpointExporter.afterPropertiesSet(); } catch (Exception e) { throw new RuntimeException(e); } } }; } This defers the processing until the servlet context is available. Update: You may like to watch SPR-12109. Once it's fixed the workaround described above should no longer be necessary.
answers question: http://stackoverflow.com/q/25390100
type: AcceptedAnswer
downvote count: 0
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/83698362

http://stackoverflow.com/q/25417583
downvote count: 0
has body: I'm trying to pass all the value from A page to B page, but once I submit form from B page it will link to A page in the pop up window screen. Which mean it will have 2 windows show A page, one is in normal window another 1 is in pop up window. Here are the sample of the code how they works. FILE A.jsp <% String NAME_1= common.setNullToString(request.getParameter("NAME_1")); String ETYPE = common.setNullToString(request.getParameter("ETYPE")); %> --Please Select-- Apple Orange Name : <%if(ETYPE.equals("E01")){%> <input type="text" name="name" value="<%=NAME%>"> <%}else{%> <input type="text" name="name" value="<%=NAME_1%>"> <%}%> Change In file A.jsp when i click on the "link" it will pop up a window for B.jsp FILE B.jsp <% String NAME 1= ""; String ETYPE = common.setNullToString(request.getParameter("TYPE")); %> <form name="mainform" method="post" action="A.jsp?ETYPE=<%=ETYPE%>"> Name : <input type="text" name="NAME_1" id="NAME_1" value="<%=NAME_1%>" > What i aiming for is, when i click submit on submit button in B.jsp, the pop up screen B.jsp will close and all the value in B.jsp will replace A.jsp value based on the condition.
tagged with: jsp
has title: JSP Passing value from one page to another
score: 1
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39650255
has comment: http://stackoverflow.com/comment/39650754
has comment: http://stackoverflow.com/comment/39650328
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/html
tagged with: javascript
has comment: http://stackoverflow.com/comment/39650737
has comment: http://stackoverflow.com/comment/39650517
has comment: http://stackoverflow.com/comment/39650258
answer count: 0
has comment: http://stackoverflow.com/comment/39650293
has comment: http://stackoverflow.com/comment/39650610

http://stackoverflow.com/comment/40148166
comment on: http://stackoverflow.com/a/25633568
has text: I thought this was to easy to be of help, the question mark in "like this?" is not rhetorical :)
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39705375
score: 0
type: Comment
type: QuestionComment
has text: There is a core functionality library with tasks to build for android or desktop java. Android attaches the debugger automatically, java fails even when forcing OS level java console and debug. For reference it's a libgdx-based project.
comment on: http://stackoverflow.com/q/25437812

http://stackoverflow.com/a/25470418
downvote count: 1
answers question: http://stackoverflow.com/q/25470280
has body: The try block is empty, apparently because you haven't written the code that goes in it yet. The Java compiler stupidly complains if there is a catch block and [it thinks] the exception cannot be thrown. This is one of the annoying qualities of Java's checked exceptions. Simply continue to fill in the try block, and the error will go away. You can insert a dummy copy(null, null); inside it to make the compiler shut up.
has comment: http://stackoverflow.com/comment/39748376
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/39748572
upvote count: 0
has comment: http://stackoverflow.com/comment/39748646

http://stackoverflow.com/comment/39759873
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25476122
has text: I tried it out, but strangely enough this also does not work. I also think it is a bug. Thanks for your help!
type: Comment

http://stackoverflow.com/comment/39659563
type: QuestionComment
score: 0
has text: whoops, that was planning to be `Log.d`. Forgot the important letter that's the actual method call. Global variables in Java are the variables that have the `static` modifier before them. But think about whether you actually need it to be global... because you usually don't.
type: Comment
comment on: http://stackoverflow.com/q/25422544

http://stackoverflow.com/q/25534026
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/589870
has answer: http://stackoverflow.com/a/25534549
has title: Seconds Since Midnight to Date Object
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25534452
has body: I have a method that loads the time from a timeserver and returns a date object set to that time. The only problem is, the time I get from the server is in Seconds Since Midnight. How do I set a date object from seconds since midnight? public String timeserver = "time.nist.gov"; // Official U.S. Timeserver - Uses Time Protocol public Date load() { Socket reader; try { reader = new Socket(timeserver, 32); InputStreamReader isr = new InputStreamReader(reader.getInputStream()); BufferedReader in = new BufferedReader(isr); long g = isr.read() &amp; 0x00000000ffffffffL; Date d = new Date(); //set d's time from g? reader.close(); } catch (IOException e) { e.printStackTrace(); } return null; }
type: UnansweredQuestion
tagged with: date

http://stackoverflow.com/comment/39757607
type: AnswerComment
score: 0
has text: @StillLearningToCode, Try it and see! If you're still learning, there's no better way to learn than by doing. `String.format(...)` uses a java.util.Formatter object. Read the javadoc for that class to learn what %02x means.
comment on: http://stackoverflow.com/a/25475178
type: Comment

http://stackoverflow.com/comment/39623411
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25403492
has text: exactly, the item with the star should be exact that item where i clicked on that imageview for the star (I think it's nearly similar to the gmail app for marking an email as favorite)
score: 0

http://stackoverflow.com/q/25494507
has comment: http://stackoverflow.com/comment/39824121
has comment: http://stackoverflow.com/comment/39827771
has comment: http://stackoverflow.com/comment/39839647
has comment: http://stackoverflow.com/comment/39857471
answer count: 2
has comment: http://stackoverflow.com/comment/39822630
downvote count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/39800851
possible better answer: http://stackoverflow.com/a/25520185
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/39832053
has answer: http://stackoverflow.com/a/25520185
favorite count: 0
has comment: http://stackoverflow.com/comment/39830121
type: Question
has comment: http://stackoverflow.com/comment/39822799
has comment: http://stackoverflow.com/comment/39840394
type: AnsweredQuestion
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/25515108
has comment: http://stackoverflow.com/comment/39823448
has comment: http://stackoverflow.com/comment/39829748
tagged with: java
has body: I am currently using Spring Boot and annotation-based configuration to manage my spring applications. The project is composed of a registration and an external library of services. Service is composed of classes annotated with @Service and have a @Reposity injected into them. Registration injects the @Service. Project Structure (4 maven projects): xelamitchell (Parent POM) +- domain +- service (Spring JPA) registration (separate project with Spring Boot) Registration has a maven dependecy to service. PersonService: package org.xelamitchell.service.person; import org.xelamitchell.domain.person.Person; import java.util.List; /** * Manages {@link Person}s. * * @author amitchell */ public interface PersonService { List&lt;Person&gt; list(); Person get(Long id); Boolean exists(Long id); Person save(Person person); Boolean delete(Long id); } package org.xelamitchell.service.person; import org.xelamitchell.domain.person.Person; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; /** * * @author amitchell */ @Primary @Service public class DefaultPersonService implements PersonService { private PersonRepository repository; protected DefaultPersonService() {} @Autowired public DefaultPersonService(PersonRepository repository) { this.repository = repository; } @Override public List&lt;Person&gt; list() { return repository.findAll(); } @Override public Person get(Long id) { return repository.findOne(id); } @Override public Boolean exists(Long id) { return repository.exists(id); } @Override public Person save(Person person) { return repository.save(person); } @Override public Boolean delete(Long id) { if(id != null) { repository.delete(id); } return repository.exists(id); } } PersonRepository: package org.xelamitchell.service.person; import org.xelamitchell.domain.person.Person; import org.springframework.data.jpa.repository.JpaRepository; impor…
has answer: http://stackoverflow.com/a/25515108
has comment: http://stackoverflow.com/comment/39840383
has title: Including Spring context from an external jar does not find services
has comment: http://stackoverflow.com/comment/39828961
has comment: http://stackoverflow.com/comment/39827120

http://stackoverflow.com/q/25484616
has body: I can calculate the multiplication of two BigIntegers (say a and b) modulo n. This can be done by: a.multiply(b).mod(n); However, assuming that a and b are of the same order of n, it implies that during the calculation, a new BigInteger is being calculated, and its length (in bytes) is ~ 2n. I wonder whether there is more efficient implementation that I can use. Something like modMultiply that is implemented like modPow (which I believe does not calculate the power and then the modulo).
downvote count: 0
tagged with: biginteger
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/25490224
has comment: http://stackoverflow.com/comment/92924465
has answer: http://stackoverflow.com/a/25485291
upvote count: 15
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/45762228
has answer: http://stackoverflow.com/a/25484769
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25486075
score: 15
has title: Efficient BigInteger multiplication modulo n in Java

http://stackoverflow.com/q/25431436
has body: I've made a server/client that is setup to communicate via sockets. However I'm having some trouble connecting them. First I start my server on port 7777 (which is open), then I start my client but get a java.net.BindException. Is my coding wrong? Server side: public Server(int port) { // port = 7777 this.port = port; // dont bother with this line try { socket = new DatagramSocket(port); } catch (SocketException ex) { return; } run = new Thread(this, "Server"); run.start(); // starts thread to listen for sent client packets } Client side: private boolean openConnection(String address, int port) { // returns boolean to check for established connection as well as establish it, port = 7777 try { socket = new DatagramSocket(port); // THE ERROR IN OUTPUT POINTS TO THIS LINE ip = InetAddress.getByName(address); return true; } catch (UnknownHostException | SocketException ex) { ex.printStackTrace(); return false; } } Stack trace: java.net.BindException: Address already in use: Cannot bind at java.net.DualStackPlainDatagramSocketImpl.socketBind(Native Method) at java.net.DualStackPlainDatagramSocketImpl.bind0(DualStackPlainDatagramSocketImpl.java:81) at java.net.AbstractPlainDatagramSocketImpl.bind(AbstractPlainDatagramSocketImpl.java:95) at java.net.DatagramSocket.bind(DatagramSocket.java:376) at java.net.DatagramSocket.&lt;init&gt;(DatagramSocket.java:231) at java.net.DatagramSocket.&lt;init&gt;(DatagramSocket.java:284) at java.net.DatagramSocket.&lt;init&gt;(DatagramSocket.java:256) at chatprogram.client.Client.openConnection(Client.java:45) at chatprogram.client.Client.&lt;init&gt;(Client.java:35) at chatprogram.client.Login1$8.run(Login1.java:104) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivi…
score: 0
has comment: http://stackoverflow.com/comment/39676567
has answer: http://stackoverflow.com/a/55849222
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25432110
has comment: http://stackoverflow.com/comment/39676532
has answer: http://stackoverflow.com/a/25431925
type: Question
has comment: http://stackoverflow.com/comment/39676301
has title: Java server client bind error
type: UnansweredQuestion
tagged with: sockets
tagged with: port
tagged with: socketexception
has comment: http://stackoverflow.com/comment/39676725
has comment: http://stackoverflow.com/comment/39676251

http://stackoverflow.com/comment/39700617
score: 1
comment on: http://stackoverflow.com/a/25445346
type: Comment
has text: +1 - Was writing an almost identical solution when you posted this.
type: AnswerComment

http://stackoverflow.com/a/25491242
downvote count: 0
has comment: http://stackoverflow.com/comment/39787334
score: 2
has comment: http://stackoverflow.com/comment/39787968
type: Answer
has comment: http://stackoverflow.com/comment/39787635
has comment: http://stackoverflow.com/comment/39787367
has comment: http://stackoverflow.com/comment/39787533
has comment: http://stackoverflow.com/comment/39787930
has comment: http://stackoverflow.com/comment/39787752
has body: The reason I start the 2nd thread first is because I want the secondMethod of OtherClass to execute first. That's not how threads work. That's not what threads are for. Threads provide no guarantees of what happens before what else except where you provide explicit synchronization between them; And generally speaking, the more synchronization you use, the less you will benefit from having multiple threads. In your example, you have explicit synchronization that prevents any concurrent executions of firstMethod() and secondMethod(), but you have nothing that guarantees which one will run first, and which one will run second. Chances are, that main() will terminate before either of them runs. At that point, it's up to the scheduler to pick which one will run when. There is no requirement that it start them in the same order that your code called their start() methods. Your example may be educational, but it also is an example of when not to use threads. Your synchronization is very heavy handed. Your program basically does two things, firstMethod() and secondMethod(), and the synchronization insures that they can not be overlapped. In production software, if you have two tasks that must not overlap, then it'll simplify your program's logic if they are always performed by the same thread. All I get in the console output is "SECOND METHOD" every 5 seconds. The firstMethod isn't called. Your question was edited before I got to see it, so I don't know whether you're talking about the original version, or the fixed version. But in any case: The synchronization in your program does not guarantee that the two threads take turns. All it does is prevent them both from printing at the same time. Each of your threads runs a loop that grabs the lock, prints something, releases the lock, and then immediately tries to grab the lock again. When a running thread releases a lock, and then immediately tries to get it again, the chances are it will succeed. It doesn't matter that some o…
answers question: http://stackoverflow.com/q/25490766
has comment: http://stackoverflow.com/comment/39787515
upvote count: 2

http://stackoverflow.com/a/25527956
upvote count: 4
type: AcceptedAnswer
score: 4
has body: Parsing is supported since commons-lang 3.2. The basic recipe: Create a FastDateFormat instance using the static method suiting your specific needs. Use this to parse the string and obtain a Java Date object. That's it.
accepted answer of: http://stackoverflow.com/q/25526900
downvote count: 0
answers question: http://stackoverflow.com/q/25526900
type: Answer

http://stackoverflow.com/comment/39785593
has text: i am asking @truffleme as you have bypassed the TextIO class problem.... please reply
comment on: http://stackoverflow.com/a/25489432
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25500786
upvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25501095
has comment: http://stackoverflow.com/comment/39804786
has body: since I dont know how to generate DataInputStream easily, I cant test but pose my questions here. I use Java1.7 I need to manipulate an arrived DataInputStream, skip some bytes, call readShort() several times and skip another bytes. and I wonder: Q1 if we will lose the original DataInputStream after the skip Q2 after I call readShort(), would the stream move and point to the next position or it stays at the same position
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39804700
has answer: http://stackoverflow.com/a/25501095
answer count: 2
downvote count: 4
has title: Java: could we lose DataInputStream when we manipulate it?
tagged with: java
has comment: http://stackoverflow.com/comment/39804448
has answer: http://stackoverflow.com/a/25501846
possible better answer: http://stackoverflow.com/a/25501846

http://stackoverflow.com/a/25458875
type: AcceptedAnswer
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/39727583
has body: This happens when you try to get value from the Cursor for a column which either does not exist or was not included in the Select query. Since you are selecting all the columns it is most likely that you made a spelling mistake in one of the column names. Most likely cursor.getString(cursor.getColumnIndex("countyr_id")) Compare all the column names in the method to the names that you use in your Create statement for misc table.
accepted answer of: http://stackoverflow.com/q/25458843
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25458843

http://stackoverflow.com/comment/39634948
has text: @user3952416 you should read more about TSP, which I have added a link , your problem is a modified version of TSP, but you should learn about that first, it requires some advanced technique, which I already mentioned here in my answer:)
score: 1
comment on: http://stackoverflow.com/a/25396058
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25410904
score: 0
tagged with: java
answer count: 1
has title: how to design vertical custom JProgressBar
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25411987
has body: I have written this code for custom JProgressBar in which "string painted" appears just after the progress line, but I want the same functionality in a vertical JProgressBar, please tell how can I do that??? import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JProgressBar; public class R { public static void main(String arg[]) throws Exception { new R(); } public R() throws Exception { JFrame f = new JFrame(); CustomProgressBar b = new CustomProgressBar(); f.setExtendedState(JFrame.MAXIMIZED_BOTH); f.setUndecorated(true); f.setLayout(new FlowLayout()); b.setStringPainted(true); f.add(b); f.setVisible(true); for(int i=0; i&lt;101; i++) { b.setValue(i); Thread.sleep(50); } } } class CustomProgressBar extends JProgressBar{ private static final long serialVersionUID = 1L; private boolean isStringToBePainted = false; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(isStringToBePainted ) { Dimension size = CustomProgressBar.this.getSize(); int x = (int)( size.width * CustomProgressBar.this.getPercentComplete() ); int height = g.getFontMetrics().getHeight(); int d = g.getFontMetrics().getDescent(); int y = (size.height + height)/2-d; String text = getString(); g.setColor(Color.BLACK ); g.drawString(text, x, 12); } } @Override public void setStringPainted(boolean b) { isStringToBePainted=b; } }

http://stackoverflow.com/q/25505358
has answer: http://stackoverflow.com/a/25506118
has comment: http://stackoverflow.com/comment/39812989
score: 0
has comment: http://stackoverflow.com/comment/39815646
tagged with: java
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/39813139
type: Question
has comment: http://stackoverflow.com/comment/39813565
has body: I need your help and assistant in viewing the number of rows on each printed table at the top of it. I am using the below code to get the rows count: function count() { var tables = document.getElementsByClassName("tablesorter"); var rows; for (var i = 0; i < tables.length; i++) { rows = tables[i].rows.length-1; alert(rows); span.innerHTML = rows; } Currently the rows number are displayed in alerts and I want the number of the rows to be displayed in the html. I am printing the tables through while loop based on the retrieved values from the DB and they are having the same class and name. The class name is tablesorter and the id is detailsid . I tried to print the number of the rows in the span, however it prints only above the first table. It prints first 22 and then it was overwrited with 30 where the 30 should be printed above the second table. Here is my code for printing <% while (rs.next()) { count=0; name=rs.getString("name"); if (!(subcategory_name1).equals(temp_subcategory_name) ) { i=0; %> <%=category_name1%> / <%=subcategory_name1%> No. Name <% } %> <%=i%> <%=name%> Kindly assit me in printing the number of the rows above each table
linked to: http://stackoverflow.com/q/18539992
has title: Printing rows count above each table
type: UnansweredQuestion
answer count: 1
tagged with: jsp
tagged with: record-count
tagged with: javascript

http://stackoverflow.com/q/25393995
type: UnansweredQuestion
tagged with: selenium
has comment: http://stackoverflow.com/comment/39609204
has comment: http://stackoverflow.com/comment/39644191
favorite count: 0
downvote count: 0
score: 1
tagged with: android
has title: WebElement is stale when navigating to facebook/twitter then back to original page in Sauce Labs Selenium using AndroidDriver
tagged with: java
tagged with: junit
tagged with: saucelabs
type: Question
has comment: http://stackoverflow.com/comment/39609166
has body: I have a selenium test failing on Sauce Labs due to a stale element. The test opens up a page, clicks on a few links within the site, click on a link that takes you to Facebook, then back and that's where things stop working. For some reason after coming back to the original page, the driver is no longer able to find "fresh" elements. This seem to be only happening when using Android on Sauce Labs. The code is below, please let me know if you have any suggestions for how to work around it (I don't care if it is perfect at this point, just want to get it working). @Test public void testFooter() throws Exception { driver.get(baseUrl + "/"); // these links are all on my domain, work just fine driver.findElement(linkText("About Us")).click(); driver.findElement(linkText("Press")).click(); driver.findElement(linkText("Careers")).click(); driver.findElement(linkText("FAQ")).click(); driver.findElement(linkText("Industry Resources")).click(); driver.findElement(linkText("Share")).click(); // going out to facebook works driver.findElement(linkText("Facebook")).click(); driver.navigate().back(); // coming back to the page and clicking the twitter link fails due to // org.openqa.selenium.StaleElementReferenceException: WebElement is stale. driver.findElement(linkText("Twitter")).click(); driver.navigate().back(); }
has comment: http://stackoverflow.com/comment/39608073
answer count: 0
upvote count: 1

http://stackoverflow.com/q/25490081
downvote count: 0
tagged with: shadowing
has answer: http://stackoverflow.com/a/25490119
favorite count: 0
type: Question
score: 3
has title: Access to shadowed variable in local class
has body: I'm new to Java and I'm confused by below example public class Test { int testOne(){ //member method int x=5; class inTest // local class in member method { void inTestOne(int x){ System.out.print("x is "+x); // System.out.print("this.x is "+this.x); } } inTest ins=new inTest(); // create an instance of inTest local class (inner class) ins.inTestOne(10); return 0; } public static void main(String[] args) { Test obj = new Test(); obj.testOne(); } } Why can't I access the shadowed variable in inTestOne() method with "this" keyword in line 8?
tagged with: java
has answer: http://stackoverflow.com/a/25490127
answer count: 2
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/comment/39841336
type: QuestionComment
has text: Issue is not predictable. If you are running the app from an IDE, close and restart it. It may get resolved.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25520498

http://stackoverflow.com/q/25455771
score: 0
has comment: http://stackoverflow.com/comment/39724508
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39721182
answer count: 1
tagged with: swing
has title: Java Authentication Program Issue
has body: I am new to programming, and created a little program to practice code. It is an authentication program where you type in a username and password, and only my specified username and password will work to make it show a picture. I typed all the code, and there was no error; but when I ran it and typed in the username and password, it failed to show the picture. Here is my code. package main.Swing.com; //imports import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputMethodEvent; import java.awt.event.InputMethodListener; import java.awt.event.TextEvent; import java.awt.event.TextListener; import java.util.EventObject; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; //class that carries other classes and carries some variables public class Main extends javax.swing.JFrame implements ActionListener, TextListener, InputMethodListener { JButton Test = new JButton("TEST IF YOU HAVE ACCESS TO THIS"); JButton Cancel = new JButton("CANCEL"); JTextField username = new JTextField(15); JTextField password = new JTextField(15); String n = ("Nathan"); int nathannam; int nathannamer; JButton superman; JButton supermanny; //constructor class that has the jframe public Main() { super("Authenticator"); setSize(300, 220); setDefaultCloseOperation(EXIT_ON_CLOSE); setLookAndFeel(); //creating the pane and defining some labels JPanel pane = new JPanel(); JLabel UsernameLabel = new JLabel("Username: "); JLabel PasswordLabel = new JLabel("Password: "); //adding all the components to the pane pane.add(UsernameLabel); pane.add(username); pane.add(PasswordLabel); pane.add(password); pane.add(Test); pane.add(Cancel); //adding the pane add(pane); //adding a event listener to my JButton titled Test Test.addActionListener(this); //checking if the password variable and name variabl…
has comment: http://stackoverflow.com/comment/39724198
has comment: http://stackoverflow.com/comment/39721247
tagged with: java
tagged with: authenticator
has comment: http://stackoverflow.com/comment/39721255
type: Question
has answer: http://stackoverflow.com/a/25457600

http://stackoverflow.com/comment/39910569
has text: The link I gave states: The enhanced for loop (also sometimes known as "for-each" loop) can be used for collections that implement the Iterable interface and for arrays. With collections, an iterator is allocated to make interface calls to hasNext() and next(). With an ArrayList, a hand-written counted loop is about 3x faster (with or without JIT), but for other collections the enhanced for loop syntax will be exactly equivalent to explicit iterator usage. Again I just think it depends, but for this situation yes. If you think otherwise, it will be interesting to know your experience. @njzk2
comment on: http://stackoverflow.com/a/25538629
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25504028
has comment: http://stackoverflow.com/comment/39817268
has comment: http://stackoverflow.com/comment/39816913
tagged with: tdb
has comment: http://stackoverflow.com/comment/39816688
tagged with: fuseki
has comment: http://stackoverflow.com/comment/39817240
score: 0
tagged with: triplestore
linked to: http://stackoverflow.com/q/24798024
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39816759
has body: I have a question: I have two RDF files that I load on Jena TDB using this Java Code: public void store() { String directory = "C:\\tdb"; Dataset dataset = openTDB(directory); String source = "C:\\file1.rdf"; String source1 = "C:\\file2.rdf"; Model tdb = loadModel(source, dataset); dataset.addNamedModel("C://File1", tdb); Model tdb1 = loadModel(source1, dataset); dataset.addNamedModel("C://File2", tdb1); tdb.close(); tdb1.close(); dataset.close(); } public Dataset openTDB(String directory) { // open TDB dataset Dataset dataset = TDBFactory.createDataset(directory); return dataset; } public Model loadModel(String source, Dataset dataset) { Model model = ModelFactory.createDefaultModel(); FileManager.get().readModel(model, source, "RDF/XML"); return model; } As was suggested in this post https://stackoverflow.com/questions/24798024/how-i-can-use-fuseki-with-jena-tdb, I launch this command on CMD: fuseki-server --update --loc C:\tdb /ds On the localhost:3030 I see different page. In particular, I see "Control Panel" page where I can choose the dataset and I can execute a query. Now, I'm reading this documentation http://jena.apache.org/documentation/serving_data/ and I see that if I want to launch the SPARQL query endpoint I can write http://host/dataset/query path in the browser. But, If I launch this path ( http://localhost:3030/ds/query ), I get this error: Error 404: Service Description: /ds/query Fuseki - version 1.0.2 (Build date: 2014-06-02T10:57:10+0100) Why? I'm doing this research to find a Java method to launch Fuseki server in Java Code. Is it possible?
has comment: http://stackoverflow.com/comment/39816549
has comment: http://stackoverflow.com/comment/39816479
has comment: http://stackoverflow.com/comment/39817364
type: Question
has comment: http://stackoverflow.com/comment/39816633
linked to: http://stackoverflow.com/q/24971291
tagged with: http://stackoverflow.com/tag/rdf
has title: Error when I launch SPARQL query endpoint on the browser
type: UnansweredQuestion

http://stackoverflow.com/a/25428712
has comment: http://stackoverflow.com/comment/39670539
upvote count: 2
has comment: http://stackoverflow.com/comment/39670599
type: Answer
has comment: http://stackoverflow.com/comment/39670656
has body: You can use a regex like this: ((?:[^,]*,[^,]*|[^,]+){2})(?:,|$) Where number 2 is threshold - 1 RegEx Demo1 RegEx Demo2 OUTPUT: When threshold is 3: ABC1,ABCD2,A1 A234B456,C1 When threshold is 2: ABC1,ABCD2 A1,A234B456 C1 CODE: int threshold = 3; String str = "piid1,piid2,piid3,piid4,piid5"; Pattern p = Pattern.compile("((?:[^,]*,[^,]*|[^,]+){" + (threshold-1) + "})(?:,|$)"); Matcher m = p.matcher(str); while (m.find()) { System.out.println(m.group(1)); } Output: piid1,piid2,piid3 piid4,piid5
has comment: http://stackoverflow.com/comment/39671112
score: 2
answers question: http://stackoverflow.com/q/25428573
downvote count: 0
has comment: http://stackoverflow.com/comment/39672242
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39673215
accepted answer of: http://stackoverflow.com/q/25428573

http://stackoverflow.com/comment/39815651
type: AnswerComment
comment on: http://stackoverflow.com/a/25506516
score: 0
has text: As far as I can see, this will solve the OPs compilation problem...and beyond anything else, seems correct to me...
type: Comment

http://stackoverflow.com/comment/41335563
comment on: http://stackoverflow.com/q/25519931
score: 1
type: Comment
has text: @VineetVerma just follow these steps http://peterkellner.net/2012/03/11/how-to-setup-your-own-pop3imap-email-server-for-local-development-testing/
type: QuestionComment

http://stackoverflow.com/comment/39633822
has text: Uh, the correct way to localize strings it to use separate resource bundles. Mangling the property names like this is a good way to mess things up...
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25408486

http://stackoverflow.com/comment/39819758
type: QuestionComment
comment on: http://stackoverflow.com/q/25507001
score: 0
has text: Updated. Is that clearer?
type: Comment

sqlite
tags question: http://stackoverflow.com/q/25414352
tags question: http://stackoverflow.com/q/25458696
tags question: http://stackoverflow.com/q/25443680
tags question: http://stackoverflow.com/q/25482238
tags question: http://stackoverflow.com/q/25433770
tags question: http://stackoverflow.com/q/25549378
tags question: http://stackoverflow.com/q/25508326
tags question: http://stackoverflow.com/q/25438034
tags question: http://stackoverflow.com/q/25391540
tags question: http://stackoverflow.com/q/25521984
type: Tag
tags question: http://stackoverflow.com/q/25428234
tags question: http://stackoverflow.com/q/25473672
tags question: http://stackoverflow.com/q/25500372
tags question: http://stackoverflow.com/q/25524696
tags question: http://stackoverflow.com/q/25490092
tags question: http://stackoverflow.com/q/25520751
tags question: http://stackoverflow.com/q/25394873
tags question: http://stackoverflow.com/q/25430870
tags question: http://stackoverflow.com/q/25550288
tags question: http://stackoverflow.com/q/25410192
tags question: http://stackoverflow.com/q/25398119
tags question: http://stackoverflow.com/q/25405382
tags question: http://stackoverflow.com/q/25544578
tags question: http://stackoverflow.com/q/25472511
tags question: http://stackoverflow.com/q/25422226
tags question: http://stackoverflow.com/q/25443962
tags question: http://stackoverflow.com/q/25417349
tag name: sqlite
tags question: http://stackoverflow.com/q/25458843
tags question: http://stackoverflow.com/q/25470853
tags question: http://stackoverflow.com/q/25452136

http://stackoverflow.com/q/25491682
has comment: http://stackoverflow.com/comment/39787950
tagged with: sockets
type: AnsweredQuestion
score: 0
has body: If I write a java socket server on a machine with two LAN Cards each of which is on a different network like one is on the 10.x.x.x network and the other is on the 192.168.10.x network, is the server going to bind to one of them randomly or it will listen to the incoming requests on both NICs and answer accordingly?
linked to: http://stackoverflow.com/q/428313
tagged with: java
accepted answer: http://stackoverflow.com/a/25491751
tagged with: nic
has answer: http://stackoverflow.com/a/25491751
has title: Java server on a machine with two NICs
answer count: 1
type: Question

http://stackoverflow.com/a/25395038
has comment: http://stackoverflow.com/comment/39608516
has comment: http://stackoverflow.com/comment/39608223
has comment: http://stackoverflow.com/comment/39610193
has body: Fix this in your code and it'll work: static void prints(int... ints) // notice the static keyword at the beginning! The problem is not with the varargs, it's with the way you're calling an instance method from a static context. Also, make extra-sure that there are no other methods with conflicting signatures, for example these two methods will look the same to the compiler: void prints(int... ints) void prints(int[] ints)
score: 10
type: Answer
answers question: http://stackoverflow.com/q/25394998
has comment: http://stackoverflow.com/comment/39608608
has comment: http://stackoverflow.com/comment/39609355
has comment: http://stackoverflow.com/comment/39608259
accepted answer of: http://stackoverflow.com/q/25394998
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39610048
has comment: http://stackoverflow.com/comment/39610079
upvote count: 10
has comment: http://stackoverflow.com/comment/39608495
has comment: http://stackoverflow.com/comment/39634091
has comment: http://stackoverflow.com/comment/39610454

http://stackoverflow.com/a/25530315
answers question: http://stackoverflow.com/q/25530075
has body: First you must load your words to the array. Then only you can get a random word from your word array. so your code should be like package hangman; import java.util.Random; public class Dictionary { int NUMBER_OF_WORDS = 81452; public static String FILE_NAME = "dictionaryCleaned.txt"; private String[] dictionary = new String[NUMBER_OF_WORDS]; public void loadWordList(String fileName){ // write your logic to read the file and load them into the dictionary array } public String getRandomWord() { Random rand = new Random(); return dictionary[rand.nextInt(NUMBER_OF_WORDS)]; } }
score: 0
type: Answer

http://stackoverflow.com/a/77487381
answers question: http://stackoverflow.com/q/25546750
has body: I try to merge files to a file with 3 ways. I test these ways but I do not know which one is best...still. I thought that FileChannel is faster than others but it was not for me. Please let me know if you guys have any concern. BufferedReader & BufferedWrtier private static void mergeFiles(List<Path> sources, Path destination) { try (BufferedWriter writer = new BufferedWriter(new FileWriter(destination.toFile(), true))) { for (Path path : sources) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(path.toFile())))) { String line; while ((line = reader.readLine()) != null) { writer.write(line); writer.newLine(); } } catch (IOException e) { throw new RuntimeException(e); } } } catch (IOException e) { throw new RuntimeException(e); } } InputStream & Files.copy private static void mergeFiles2(List<Path> sources, Path destination) { try { BinaryOperator<InputStream> sequenceInputStream = SequenceInputStream::new; List<InputStream> inputStreams = new ArrayList<>(); for (Path path : sources) { InputStream is = Files.newInputStream(path, StandardOpenOption.READ); inputStreams.add(is); } InputStream streams = inputStreams.parallelStream().reduce(sequenceInputStream).orElseThrow(() -> new IllegalStateException("inputStreams reduce exception")); Files.copy(streams, destination, StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { throw new RuntimeException(e); } } File Channel private static void mergeFiles3(List<Path> sources, Path destination) { try (FileChannel desChannel = FileChannel.open(destination, StandardOpenOption.WRITE, StandardOpenOption.CREATE)) { for (Path path : sources) { try (FileChannel srcChannel = FileChannel.open(path, StandardOpenOption.READ)) { for (long position = 0, size = srcChannel.size(); position < size; ) { position += srcChannel.transferTo(position, size - position, desChannel); } } } } catch (IOException e) { throw new RuntimeException(e); } }
type: Answer
score: 0

http://stackoverflow.com/a/57135577
has body: This should also do the work for you: doc.selectFirst("div:containsOwn(Pantry/Catering)").text(); Explanation: selectFirst(selector) - Helps to avoid using select().first() containsOwn(text) - A pseudo selector to return elements that directly contain the specified text. The text must appear in the found element, not any of its descendants in contrast with contains(text). Source : https://jsoup.org/apidocs/org/jsoup/select/Selector.html#selectFirst-java.lang.String-org.jsoup.nodes.Element-
downvote count: 0
answers question: http://stackoverflow.com/q/25517353
score: 9
upvote count: 9
type: Answer

http://stackoverflow.com/a/25476676
has comment: http://stackoverflow.com/comment/39772678
has comment: http://stackoverflow.com/comment/39770830
has comment: http://stackoverflow.com/comment/39770969
downvote count: 0
upvote count: 1
has body: A good practice is to have an angle always positive for example in order not to mess with different sign in angles. You could notice that an angle 270 will work in the same way as -90 degrees. Your problem might be solved by attaching a simple check like this: while(angle &gt;= 2*Math.PI) //angle in radians angle -= 2*Math.PI; while(angle &lt; 0) angle += 2*Math.PI; Update: I guess the problem lies in the way you calculate the diffAngle. Could you try the following? float diffAngle = angleCannon - angleTank2Enemy; // or angleTank2Enemy - angleCannon, depending on the direction of angles in your game double sign = Math.signum(diffAngle); float diffAngle = sign &gt;= 0 ? Math.min(diffAngle, 2*MathUtils.PI - diffAngle) : Math.max(diffAngle, -(2*MathUtils.PI - diffAngle));
answers question: http://stackoverflow.com/q/25476563
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39774779

http://stackoverflow.com/a/25411764
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25410227
has comment: http://stackoverflow.com/comment/39640651
has body: This will give you the width of the string ie; text in your case. Paint paint = toggleButton.getPaint(); float length = paint.measureText(YOUR_STRING); This gives you the width of the string it would take on the screen. Now set the width of the toggle button via LayoutParams. Lets say parent layout of your toggle button is LinearLayout. so it should go like: toggleButton.setLayoutParams(new LayoutParams(WIDTH_YOU_CALCULATED,LinearLayout.LayoutParams.WRAP_CONTENT)); This will set the width and height of your ToggleButton to what you calculated.
score: 1
type: Answer

http://stackoverflow.com/comment/39687279
has text: I'm not sure about via Maven, but something like a custom FindBugs or Sonar rule might be what you're looking for.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25437542

http://stackoverflow.com/comment/39703027
type: AnswerComment
has text: I think your solution adds a useless space after words of exactly 10 characters
score: 1
comment on: http://stackoverflow.com/a/25446679
type: Comment

http://stackoverflow.com/q/25431007
has answer: http://stackoverflow.com/a/25431113
tagged with: templates
upvote count: 1
favorite count: 0
type: Question
tagged with: velocity
has body: I am loading up a vm tgemplate with velocity and chnaging some of the parameters I have around 10 parameters that can change in my template For the following portion of my template window.location = "$html5Dirhtml5/index.html?page=$pageNumber" I get this output window.location = "$html5Dirhtml5/index.html?page=1" Any idea why velocity is not converting the html5Dir attribute but it is setting the page? The attributes definitely exist in the attributes passed to velocity, I have checked this My velocity code is as follows public static StringWriter generateTextFromTemplate(String templateFile, Map&lt;String, String&gt; params) { LOG.debug("Entered generateTextFromTemplate - templateFile:{}", templateFile); StringWriter writer = null; try { VelocityEngine velocityEngine = new VelocityEngine(); velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath"); velocityEngine.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName()); velocityEngine.init(); VelocityContext velocityContext = new VelocityContext(); for (Map.Entry&lt;String, String&gt; entry : params.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); velocityContext.put(key, value); LOG.error("key:{}, value:{}", key, value); } // get the Template Template template = velocityEngine.getTemplate(templateFile); // now render the template into a Writer writer = new StringWriter(); template.merge( velocityContext, writer ); } catch (Exception e) { LOG.error("{}", e); writer = null; } return writer; }
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25431113
answer count: 1
downvote count: 0
has title: Java Project - Velocity Not replacing certain strings

http://stackoverflow.com/q/25522103
has title: Apache POI: Diagonal border in XSSFWorkbook
has body: I found the XSSFCellBorder to support diagonal border styles as well and I want to use them, but I haven't found any way to get a XSSFCellBorder from an XSSFCellStyle so I can apply them in the usual way. How can I set the diagonal border for a Cell, preferrably via Styles?
linked to: http://stackoverflow.com/q/39529042
has comment: http://stackoverflow.com/comment/70298219
has comment: http://stackoverflow.com/comment/70146676
tagged with: xssf
score: 2
tagged with: hssf
tagged with: apache-poi
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/5720049
tagged with: excel
type: Question

http://stackoverflow.com/comment/39762188
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25477928
type: AnswerComment
has text: @PeerNet I do not understand your comment. This is a complete and working example.

http://stackoverflow.com/comment/39649599
type: QuestionComment
has text: your code does not have any line that counts characters of your name?
score: 0
comment on: http://stackoverflow.com/q/25417191
type: Comment

http://stackoverflow.com/a/25490391
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25472136
has body: I think it is evaluating ('file.one.isActive' == 'true') before it is resolving. Better to resolve ('file.one.isActive' ) == 'true' for clarity
downvote count: 0

http://stackoverflow.com/q/25474721
score: 5
has answer: http://stackoverflow.com/a/25474862
possible better answer: http://stackoverflow.com/a/25474862
upvote count: 5
tagged with: wait
accepted answer: http://stackoverflow.com/a/25475076
has body: I was reading about thread synchronisation and wait/notify constructs from the tutorial. It states that When wait is invoked, the thread releases the lock and suspends execution. At some future time, another thread will acquire the same lock and invoke Object.notifyAll, informing all threads waiting on that lock that something important has happened. Some time after the second thread has released the lock, the first thread reacquires the lock and resumes by returning from the invocation of wait. AFAIK, if there are multiple threads which can compete for the lock when the first thread is awaken by the notify, any one of them can get to own the lock on that object. My question is, if this first thread itself re-acquires the lock, does it have to start all over from the beginning of the synchronized method (which means, it again executes the code before the while loop checking wait() condition) or does it just pause at the wait() line? // Does the waiting thread come back here while trying to own the // lock (competing with others)? public synchronized notifyJoy() { // Some code =&gt; Does this piece of code gets executed again then in case // waiting thread restarts its execution from the method after it is notified? while (!joy) { try { // Does the waiting thread stay here while trying to re-acquire // the lock? wait(); } catch(InterruptedException e) {} } // Some other code }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39756361
answer count: 2
has comment: http://stackoverflow.com/comment/39756154
tagged with: java
tagged with: multithreading
downvote count: 0
has answer: http://stackoverflow.com/a/25475076
has title: Does the waiting thread revisit the code inside synchronized method
favorite count: 0
type: Question

http://stackoverflow.com/comment/39731200
type: QuestionComment
comment on: http://stackoverflow.com/q/25453802
score: 1
type: Comment
has text: What protocol is the server that's hosting the file using? It's hard to tell based on your description, but it looks like CIFS (Windows File Sharing) or FTP are both possibilities. Whatever the case, you need to use a library that speaks that protocol. You can't just pass a URL like that to FileInputStream.

http://stackoverflow.com/a/25439448
answers question: http://stackoverflow.com/q/25439409
score: 1
type: Answer
has body: Iterator&lt;Father&gt; iterator = fatherList.iterator(); while (iterator.hasNext()) { Father father = iterator.next(); Iterator&lt;Children&gt; childiter = father.getChildren().iterator(); while(childiter.hasNext()){ System.out.println(childiter.next().toString()); } }
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39690775
has comment: http://stackoverflow.com/comment/39710078

http://stackoverflow.com/comment/39616550
comment on: http://stackoverflow.com/a/25399432
type: AnswerComment
score: 0
type: Comment
has text: Well since this can already use this library. Pless check correct answer.

http://stackoverflow.com/a/25523259
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25513552
upvote count: 1
answers question: http://stackoverflow.com/q/25513552
has body: Your testcase works fine for me with a .p12 from WSS4J test source on the latest WSS4J SNAPSHOT code. Are you using an older version of WSS4J? If so please try with the latest releases + see if it works. If not, then please create a test-case with your .p12 file + create a new issue in the WSS4J JIRA: https://issues.apache.org/jira/browse/WSS Colm.
type: Answer
has comment: http://stackoverflow.com/comment/40724251
has comment: http://stackoverflow.com/comment/39859528
score: 1

http://stackoverflow.com/a/25551440
has body: For a 1 MB text file it's impossible to take two minutes to load unless it's read from a diskette or alike. Putting it all into a user interface is a non-sense, nobody can do anything with it. Scrolling using a scroll bar get completely unusable, too. Allow the user to enter a starting offset (in lines), read the file using Files.readLines into a List&lt;String&gt;, and display a few lines only. Code idea All non-JDK classes come from Guava. List&lt;String&gt; allLines = Files.readLines(file, Chatsets.UTF8); int offset = Integer.parseInt(myOffsetTextField.getText()); int numberOfLinesToShow = 10000; int start = Math.min(allLines.size(), offset); int end = Math.min(allLines.size(), start + numberOfLinesToShow); // a sane-sized list of at most `numberOfLinesToShow` lines List&lt;String&gt; sublist = allLines.sublist(start, end); textPane.setText(Joiner.on('\n').join(sublist));
has comment: http://stackoverflow.com/comment/40000612
has comment: http://stackoverflow.com/comment/40035423
answers question: http://stackoverflow.com/q/25541571
has comment: http://stackoverflow.com/comment/40098993
has comment: http://stackoverflow.com/comment/39988259
has comment: http://stackoverflow.com/comment/40080985
has comment: http://stackoverflow.com/comment/40166395
has comment: http://stackoverflow.com/comment/40019319
has comment: http://stackoverflow.com/comment/39949800
type: Answer
has comment: http://stackoverflow.com/comment/40018876
has comment: http://stackoverflow.com/comment/40058271
has comment: http://stackoverflow.com/comment/40020684
has comment: http://stackoverflow.com/comment/40117486
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/39664971
type: QuestionComment
comment on: http://stackoverflow.com/q/25425873
type: Comment
score: 0
has text: And what if instead of `response.getWriter()` you print it into `System.out/err` ?

http://stackoverflow.com/comment/39757250
type: Comment
has text: These are [two patches](https://code.google.com/p/achartengine/issues/detail?id=392) which are already available. I now want to build the jar-file again. Do you know how? please...
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25463308

http://stackoverflow.com/comment/39744567
has text: Logging is the best and standard option as others have pointed. If you want to observe object and internal fields you could also use [Watch Expressions](http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fviews%2Fexpressions%2Fref-addwatch.htm) while debugging.
comment on: http://stackoverflow.com/q/25462354
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25509890
score: 0
has comment: http://stackoverflow.com/comment/39828498
type: Answer
has body: The javadoc of cancel(boolean) states Attempts to cancel execution of this task. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel is called, this task should never run. If the task has already started, then the mayInterruptIfRunning parameter determines whether the thread executing this task should be interrupted in an attempt to stop the task. Emphasis mine. The call will return true under all conditions which aren't failures. It is therefore possible that the method returns true and your task is running.
has comment: http://stackoverflow.com/comment/39826327
accepted answer of: http://stackoverflow.com/q/25496537
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25496537

http://stackoverflow.com/comment/39649503
type: AnswerComment
comment on: http://stackoverflow.com/a/25417023
has text: Yes I thought I had magic_quotes_gpc off which is why I got confused as to what was doing the escaping.
type: Comment
score: 0

http://stackoverflow.com/q/25502025
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25502074
has answer: http://stackoverflow.com/a/25502074
tagged with: java
has answer: http://stackoverflow.com/a/25502130
has comment: http://stackoverflow.com/comment/39807154
has answer: http://stackoverflow.com/a/25502112
has title: Conditions in Ternary Operator - Java
type: Question
tagged with: return
has answer: http://stackoverflow.com/a/25502094
has body: I have a simple if/elseif condition which I'm trying to convert it into a return statement with Ternay Operator for code redundancy but I have not been able to. Any help would be appreciated, Thanks. Here's my code snippet : if (val.equals("a")||val.equals("s")){ return true; } else if (val.equals("b")||val.equals("t")) { return false; } return true; Could someone please suggest on how to proceed with return statement(Ternary Operator) for the above if/else-if ?
answer count: 5
tagged with: if-statement
possible better answer: http://stackoverflow.com/a/25502070
has comment: http://stackoverflow.com/comment/39807222
has answer: http://stackoverflow.com/a/25502070

http://stackoverflow.com/comment/39667080
type: AnswerComment
comment on: http://stackoverflow.com/a/25426951
has text: **question :** so when we cross the `Integer.MAX_VALUE`, we are automatically shifted to `Integer.MIN_VALUE`...is reverse also true?
type: Comment
score: 1

http://stackoverflow.com/comment/39828557
type: QuestionComment
has text: What you need is a conversion table. Essentially, one spinner is the row, the other spinner is the column. Put them both together and you have the formula you need to run. I did this exact same thing for a measurement converter I wrote a bit ago. Not to blatantly plug the app. But it can be found here: http://dpoisn.com/demos/AndroidDev/miniapps/default.php
score: 0
comment on: http://stackoverflow.com/q/25513453
type: Comment

jboss
tags question: http://stackoverflow.com/q/25403012
tags question: http://stackoverflow.com/q/25459252
tags question: http://stackoverflow.com/q/25470445
tags question: http://stackoverflow.com/q/25433600
tags question: http://stackoverflow.com/q/25492216
tags question: http://stackoverflow.com/q/25541629
tags question: http://stackoverflow.com/q/25397928
tags question: http://stackoverflow.com/q/25547792
tags question: http://stackoverflow.com/q/25515171
tags question: http://stackoverflow.com/q/25512438
tag name: jboss
tags question: http://stackoverflow.com/q/25540892
tags question: http://stackoverflow.com/q/25549894
tags question: http://stackoverflow.com/q/25494322
tags question: http://stackoverflow.com/q/25509111
tags question: http://stackoverflow.com/q/25406198
type: Tag
tags question: http://stackoverflow.com/q/25428909
tags question: http://stackoverflow.com/q/25530993
tags question: http://stackoverflow.com/q/25453799
tags question: http://stackoverflow.com/q/25483627
tags question: http://stackoverflow.com/q/25397138

http://stackoverflow.com/comment/39686925
type: QuestionComment
has text: I have seen posts like these where the row is made bold, but this is just for one column - http://thinktibits.blogspot.com/2012/12/Java-POI-Format-Excel-Cell-Bold-Example-Program.html. I have close to 6 columns in my row.
comment on: http://stackoverflow.com/q/25437431
score: 0
type: Comment

http://stackoverflow.com/a/25517772
has comment: http://stackoverflow.com/comment/39837437
has comment: http://stackoverflow.com/comment/39837316
has comment: http://stackoverflow.com/comment/39837329
has body: When I run your code it selects the outer div, while I'm presuming what your looking for is the inner div. The documentation says that it selects the "elements that contains the specified text". In this simple html: Pantry/Catering The selector div:contains(Pantry/Catering) matches twice because both contain the text 'Pantry/Catering': Pantry/Catering Pantry/Catering The matches are always in that order because jsoup matches from the outside. Therefore .first() always matches the outer div. To extract the inner div you could use .get(1). Extracting the inner div in full: doc.select("div:contains(Pantry/Catering)").get(1)
downvote count: 0
has comment: http://stackoverflow.com/comment/39842069
score: 19
has comment: http://stackoverflow.com/comment/39837218
answers question: http://stackoverflow.com/q/25517353
upvote count: 19
has comment: http://stackoverflow.com/comment/39874163
type: Answer

http://stackoverflow.com/q/25438281
has body: I have n arrays of the same length (say m). The arrays represent different properties of the same m logical objects and I want to sort all the arrays according to one (or more) property. What's an idiomatic or anyway compact way in Java to do this? I came up with the below, which is very verbose. To give an idea about what I'm looking for, in Python you can just say zip(size, weight).sort, and other languages allow you to get the rank of the key array(s), which you can then apply to all the arrays. Use of widespread utilities like Apache Commons welcome, but obviously a solution based on Java libraries would be preferred. import java.util.*; class Box { public int size; public int weight; Box( int size, int weight ){ this.size = size; this.weight = weight; } } class SizeComparator implements Comparator&lt;Box&gt; { @Override public int compare(Box a, Box b) { return a.size &lt; b.size ? -1 : a.size == b.size ? 0 : 1; } } public class SortArrays { public static void main(String[] args) { int[] size = {5,3,6,2,4,4,2}; int[] weight = {9,7,8,3,5,2,5}; List&lt;Box&gt; boxes = new ArrayList&lt;Box&gt;(); for( int i = 0; i &lt; size.length; ++i ) { boxes.add( new Box( size[i], weight[i] ) ); } Collections.sort( boxes, new SizeComparator() ); int[] sortedSizes = getSizes( boxes ); int[] sortedWeights = getWeights( boxes ); System.out.println(Arrays.toString(sortedSizes)); System.out.println(Arrays.toString(sortedWeights)); } private static int[] getSizes( List&lt;Box&gt; boxes ) { int[] result = new int[boxes.size()]; for( int i = 0; i &lt; boxes.size(); ++i ) { result[i] = boxes.get(i).size; } return result; } private static int[] getWeights( List&lt;Box&gt; boxes ) { int[] result = new int[boxes.size()]; for( int i = 0; i &lt; boxes.size(); ++i ) { result[i] = boxes.get(i).weight; } return result; } }
has answer: http://stackoverflow.com/a/25438830
has comment: http://stackoverflow.com/comment/39688433
has comment: http://stackoverflow.com/comment/39689147
score: 1
tagged with: java
answer count: 1
downvote count: 0
has title: Sorting arrays of the same size according to one array
has comment: http://stackoverflow.com/comment/39689445
favorite count: 0
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39688444
tagged with: arrays
has comment: http://stackoverflow.com/comment/39688460
has comment: http://stackoverflow.com/comment/39688599
upvote count: 1
tagged with: sorting

http://stackoverflow.com/q/25441856
tagged with: upload
has title: YouTube java api v3: how to pause or interrupt ongoing videdo upload
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/26234862
tagged with: youtube-api
type: Question
has body: I am migrating from Youtube Java API v2 to v3 in an application that is doing YT upload. In my application I need to explicitly pause the video upload in situations where all the network capacity is needed for a more important use, but I can't find a corresponding pause() or resume() methods in v3 classes. Even forcibly canceling the transfer and re-starting it later would be an acceptable workaround. I have browsed through the javadocs and some of the code too and can't find a way to accomplish this. It seems the only way is to do some manual overrides to the classes that do the upload itself. Now I am asking that has anybody done this already? I am using google apis version 1.19 Thanks.
type: UnansweredQuestion

http://stackoverflow.com/a/40283752
score: 3
has body: use this line to set SSL protocol: connection.setSslProtocol("SSLv3"); and set trust manager as following line: connection.setTrustManagers(new CustomTtrustManager()); CutomTrustManager is you defined trust manager by implementing X509TrustManager or any kind of trust manager. for example: public class CustomTtrustManager implements X509TrustManager { public boolean isClientTrusted(X509Certificate[] cert) { return true; } public boolean isServerTrusted(X509Certificate[] cert) { try { cert[0].checkValidity(); return true; } catch (CertificateExpiredException e) { return false; } catch (CertificateNotYetValidException e) { return false; } } public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { // Do nothing for now. } public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { // Do nothing for now. } public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } }
type: Answer
answers question: http://stackoverflow.com/q/25505141
accepted answer of: http://stackoverflow.com/q/25505141
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25480496
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25480555
answer count: 1
linked to: http://stackoverflow.com/q/11228384
favorite count: 0
type: Question
tagged with: overlapping-matches
has comment: http://stackoverflow.com/comment/39767041
downvote count: 0
has title: In java, when using regex to find patterns, how to get nested result?
has body: The case is that, I want to find string which satisfies "c+d" in a string "cccd". My code is as follows, String str="cccd"; String regex="c+d"; Pattern pattern = Pattern.compile(regex); Matcher matcher =pattern.matcher(str); While(matcher.find()){ System.out.println(matcher.group()) } The result is only "cccd". But what I want is to get all the possible results, including nested ones, which are cd, ccd and cccd. How should I fix it, thanks in advance.
tagged with: regex
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42967010
accepted answer: http://stackoverflow.com/a/25480555

http://stackoverflow.com/comment/39817191
score: 0
type: AnswerComment
has text: I got what you said. To solve that issue i added `maze1=temp.maze2.clone();` after adding each element to `statequeue`.So now i think i'm not adding same reference to queue.But still im having same problem.Sorry for asking repeated questions.
comment on: http://stackoverflow.com/a/25505353
type: Comment

http://stackoverflow.com/comment/39637031
score: 0
has text: ya, I will correct it
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25405373

http://stackoverflow.com/comment/39687615
score: 0
comment on: http://stackoverflow.com/q/25437688
type: QuestionComment
has text: Thank guys. Great answers. Heard that OpenJDK is unstable. People faced "fatal errors" while using it, so they switched back to Oracle JDK. Do you know if we can access src for Oracke JDK 7 for OS X? I have access to Java src for Windows. Not sure if that is the same as src for mac though.
type: Comment

http://stackoverflow.com/comment/39704789
has text: Is it a 3d shooter? 2d platform? or...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25447558
score: 0

http://stackoverflow.com/comment/39673291
comment on: http://stackoverflow.com/a/25426000
type: AnswerComment
has text: @skamazin actually a programming language is a non-regular problem domain and as such regular epxressions have their limitations. To be absolutely sure you'd need to use a more appropriate representation, e.g. an AST.
score: 0
type: Comment

http://stackoverflow.com/a/25464722
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: myObject is an instance of a class, so you should use myObject.getClass(). Alternatively just call TryReflection.class.
accepted answer of: http://stackoverflow.com/q/25464700
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25464700

http://stackoverflow.com/a/25450090
answers question: http://stackoverflow.com/q/25449692
has comment: http://stackoverflow.com/comment/39714577
has body: Rice's Theorem basically states that non-trivial properties of code cannot be computed in general. The relationship between is_sorted being true, and running a faster search is possible instead of a linear one, is a non-trivial property of the program after is_sorted is asserted. You can arrange for explicit connections between is_sorted and the ability to use various faster algorithms. The way you communicate this information in C++ to the compiler is via the type system. Maybe something like this: template&lt;typename C&gt; struct container_is_sorted { C c; // forward a bunch of methods to `c`. }; then, you'd invoke a container-based algorithm that would either use a linear search on most containers, or a sorted search on containers wrapped in container_is_sorted. This is a bit awkward in C++. In a system where variables could carry different compiler-known type-like information at different points in the same stream of code (types that mutate under operations) this would be easier. Ie, suppose types in C++ had a sequence of tags like int{positive, even} you could attach to them, and you could change the tags: int x; make_positive(x); Operations on a type that did not actively preserve a tag would automatically discard it. Then assert( {is sorted}, foo ) could attach the tag {is sorted} to foo. Later code could then consume foo and have that knowledge. If you inserted something into foo, it would lose the tag. Such tags might be run time (that has cost, however, so unlikely in C++), or compile time (in which case, the tag-state of a given variable must be statically determined at a given location in the code). In C++, due to the awkwardness of such stuff, we instead by habit simply note it in comments and/or use the full type system to tag things (rvalue vs lvalue references are an example that was folded into the language proper). So the programmer is expected to know it is sorted, and invoke the proper algorithm given that they know it is sorted.
score: 3
has comment: http://stackoverflow.com/comment/39712322
type: Answer
has comment: http://stackoverflow.com/comment/39712436
has comment: http://stackoverflow.com/comment/39712074
has comment: http://stackoverflow.com/comment/39711967
accepted answer of: http://stackoverflow.com/q/25449692
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39896209
type: Comment
score: 0
type: AnswerComment
has text: Thank you again. Yes this way saves the time for inheritance.
comment on: http://stackoverflow.com/a/25550280

http://stackoverflow.com/comment/40331936
type: AnswerComment
type: Comment
has text: See the resolution is wont fix and they have left it like that.
comment on: http://stackoverflow.com/a/25767146
score: 0

http://stackoverflow.com/comment/39655066
type: AnswerComment
has text: The problem I'm seeing here is that the bean that is causing the problem isn't called in the context at all. It is loaded using the `PersistenceExceptionTranslationPostProcessor` bean in the context. However, maybe by adding the name to the `@Resource` would work. I'll give it a try.
type: Comment
comment on: http://stackoverflow.com/a/25419451
score: 0

http://stackoverflow.com/q/25535453
upvote count: 1
has comment: http://stackoverflow.com/comment/39950579
favorite count: 0
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25552683
has title: VTD-XML and Xpath 2.0 escaping string
linked to: http://stackoverflow.com/q/13482352
has answer: http://stackoverflow.com/a/25552683
possible better answer: http://stackoverflow.com/a/25553136
has answer: http://stackoverflow.com/a/25536187
has answer: http://stackoverflow.com/a/25553136
has body: When I try to running the following xpath expression in Java using VTD-XML I get an unexpected error. Code: .. AutoPilot ap = new AutoPilot(vn); ap.selectXPath("/a//b[text() = 'apple''banana']"); Error: Syntax error after or around the end of ==&gt; /a//b[text() = 'apple' Caused by: com.ximpleware.XPathParseException: XPath Syntax error: #29 at com.ximpleware.xpath.parser.unrecovered_syntax_error(parser.java:492) at java_cup.runtime.lr_parser.parse(lr_parser.java:601) at com.ximpleware.AutoPilot.selectXPath(AutoPilot.java:809) Is this not a bug? I was under the impression that escaping single quotes in XPath 2.0 was acceptable? When I try running the xpath query in XML Spy with the same document it runs fine.
has comment: http://stackoverflow.com/comment/39901489
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
answer count: 3
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12403870
downvote count: 0
tagged with: vtd-xml

http://stackoverflow.com/comment/77401764
type: QuestionComment
has text: Hi, I staid with JAX-RS (Jersey) using the following HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic(userName, userPassword); and then ClientBuilder.newClient().register(feature). That did the trick. More on http://howtodoinjava.com/jersey/jersey-restful-client-api-authentication-example/
score: 0
comment on: http://stackoverflow.com/q/25455579
type: Comment

http://stackoverflow.com/comment/39813682
score: 0
type: AnswerComment
has text: Thank you so much.I successfully run my code. May I know why we are using the line org.apache.poi.ss.usermodel.Row.CREATE_NULL_AS_BLANK? It will be useful for me
comment on: http://stackoverflow.com/a/25505553
type: Comment

http://stackoverflow.com/comment/39706329
has text: I'm, yes! Tell me more :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25447175

http://stackoverflow.com/comment/39788486
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25491583
has text: Yes. Lets say, EmpController calls EmpInformation.getModel and I would like to print at which line #, it is called "in" EmpController.
type: QuestionComment

http://stackoverflow.com/q/25419140
score: 5
type: UnansweredQuestion
upvote count: 5
downvote count: 0
has body: As I know hadoop-env.sh is the configuration file for settings environment for the hadoop daemons. In This file how can I define HADOOP_HEAPSIZE is the property to define heap size for daemons. Is it mean that it will work for all the daemons like namenode,datanode,task tracker,job tracker and secondary namenode all will take 1000 mb memory on each machine. If yes then how can I make different for each one. I watch following few entries in hadoop-env.sh export HADOOP_NAMENODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_NAMENODE_OPTS" export HADOOP_SECONDARYNAMENODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_SECONDARYNAMENODE_OPTS" export HADOOP_DATANODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_DATANODE_OPTS" export HADOOP_BALANCER_OPTS="-Dcom.sun.management.jmxremote $HADOOP_BALANCER_OPTS" export HADOOP_JOBTRACKER_OPTS="-Dcom.sun.management.jmxremote $HADOOP_JOBTRACKER_OPTS" Are these entries for seperatly allocate the memory for each daemon, if yes then what is -Dcom.sub.management.jmxremote as much I know syntax for java heap memory allocation is like -Xmx&lt;size&gt;m. Also In this where is task tracker. and what is Balancer.
tagged with: java
answer count: 1
has title: how to define memory separately for hadoop daemons in hadoop-env.sh
favorite count: 0
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/38711829

http://stackoverflow.com/q/25462039
tagged with: layout-inflater
type: Question
has answer: http://stackoverflow.com/a/25462081
type: UnansweredQuestion
answer count: 1
has body: I'm trying to create a listview with images, but when I launch my app android says unfortunatelly it has stopped. I followed this tutorial. Where is mistake? Logcat: 08-23 15:29:25.735: D/AbsListView(25714): Get MotionRecognitionManager 08-23 15:29:25.745: D/AbsListView(25714): onVisibilityChanged() is called, visibility : 4 08-23 15:29:25.745: D/AbsListView(25714): unregisterIRListener() is called 08-23 15:29:25.745: D/AbsListView(25714): onVisibilityChanged() is called, visibility : 0 08-23 15:29:25.745: D/AbsListView(25714): unregisterIRListener() is called 08-23 15:29:25.775: D/AndroidRuntime(25714): Shutting down VM 08-23 15:29:25.775: W/dalvikvm(25714): threadid=1: thread exiting with uncaught exception (group=0x41ca7ac8) 08-23 15:29:25.775: E/AndroidRuntime(25714): FATAL EXCEPTION: main 08-23 15:29:25.775: E/AndroidRuntime(25714): java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView 08-23 15:29:25.775: E/AndroidRuntime(25714): at android.widget.AdapterView.addView(AdapterView.java:480) 08-23 15:29:25.775: E/AndroidRuntime(25714): at android.view.LayoutInflater.inflate(LayoutInflater.java:503) 08-23 15:29:25.775: E/AndroidRuntime(25714): at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 08-23 15:29:25.775: E/AndroidRuntime(25714): at com.examples.flist.Adapter.getView(FlActivity.java:55) 08-23 15:29:25.775: E/AndroidRuntime(25714): at android.widget.AbsListView.obtainView(AbsListView.java:2619) 08-23 15:29:25.775: E/AndroidRuntime(25714): at android.widget.ListView.measureHeightOfChildren(ListView.java:1253) 08-23 15:29:25.775: E/AndroidRuntime(25714): at android.widget.ListView.onMeasure(ListView.java:1165) 08-23 15:29:25.775: E/AndroidRuntime(25714): at android.view.View.measure(View.java:16142) 08-23 15:29:25.775: E/AndroidRuntime(25714): at android.widget.RelativeLayout.measureChild(RelativeLayout.java:666) 08-23 15:29:25.775: E/AndroidRuntime(25714): at android.widget.RelativeLayout.onMeasure(R…
tagged with: listview
score: 0
has title: ListView has stopped
tagged with: android-arrayadapter
has comment: http://stackoverflow.com/comment/39732722
tagged with: android
tagged with: java

http://stackoverflow.com/comment/86150888
has text: @VukStanković I agree, JB Nizet answer should provide proper guidance. Your second issue (package does not exists) is different than the first one, it's probably a different problem. If you include your build data (your pom.xml and how you build and deploy your app) we should be able to help
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25471868

http://stackoverflow.com/a/25479203
score: 3
has body: You need to have break in switch-cases. switch(something){ case 1: // do something break; case 2: //do something break; default: // do something break; } If there is no break, that will execute all cases here. switch-cases in Java. Conclusion. If there is no return in cases, you should use break for every case. Following case you don't need break. switch (cases){ case "a": return "a"; case "b": return "b"; default: return "default"; }
type: Answer
answers question: http://stackoverflow.com/q/25479177
downvote count: 0
has comment: http://stackoverflow.com/comment/39764854
upvote count: 3

http://stackoverflow.com/q/25496051
favorite count: 0
accepted answer: http://stackoverflow.com/a/25496079
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25496079
has comment: http://stackoverflow.com/comment/39796201
tagged with: java
has comment: http://stackoverflow.com/comment/39796194
type: Question
answer count: 1
upvote count: 1
has body: Let say I have a class: package inheritanceexample; public class SuperClass { public SuperClass() { System.out.println("super class constructor 1"); } public SuperClass(int a) { System.out.println("super class constructor 2"); } public SuperClass(int a, int b) { System.out.println("super class constructor 3"); } } public class SubClass extends SuperClass { public SubClass() { System.out.println("sub class constructor 1"); } public SubClass(int a) { System.out.println("sub class constructor 2"); } public SubClass(int a, int b) { System.out.println("sub class constructor 3"); } } public class SubClass1 extends SubClass { public SubClass1(int a) { super(a); System.out.println("sub class 1 constructor 1"); } } How can I access the constructor in super class with parameters, lets say the constructor SuperClass(int a), if I'm going to access it in the SubClass1 which extends SubClass because when I put super(int a) in the SubClass1 it only accesses or executes the constructor in the subclass which it extends. Can I access the constructor in super class with parameters directly in SubClass1?
has title: Java inheritance: Can I access the constructor with parameters in super class?
downvote count: 1

http://stackoverflow.com/comment/39775722
type: Comment
has text: I just assumed all elements are not null.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25485429

http://stackoverflow.com/q/25406646
type: Question
has comment: http://stackoverflow.com/comment/39631208
has comment: http://stackoverflow.com/comment/39635890
has comment: http://stackoverflow.com/comment/39639567
has body: I'm trying to launch a Java 1.3 VM (x86) in Windows 7 (x64). Whenever any AWT-related code is executed, the following is printed to stderr: Assertion failed: glyph != NULL, file ../../../src/share/native/sun/awt/font/t2k/truetype.c, line 2133 In the Windows Event Log, I see: msvcrt.dll, version: 7.0.7601.17744, time stamp: 0x4eeaf722 Exception code: 0x40000015 Fault offset: 0x0006680c Faulting process id: 0x1bdc Faulting application start time: 0x01cfbc7d957f19ce Faulting application path: C:\Program_Files\Java\jdk1.3.1_28\bin\java.exe Faulting module path: C:\windows\syswow64\msvcrt.dll Report Id: d351babf-2870-11e4-8ed2-005056c00008 I've tried various compatibility modes for java.exe, with no luck. There's a "private" 32-bit msvcrt.dll copy under C:\Program_Files\Java\jdk1.3.1_28\jre\bin which apparently isn't used at all. Additionally, I'm using the Classic windows theme (Aero is turned off). Any idea how to make Java AWT operational?
tagged with: windows-7-x64
type: AnsweredQuestion
score: 0
has title: Java 1.3.1 on Windows 7
tagged with: windows-7
tagged with: java
has comment: http://stackoverflow.com/comment/39652082
answer count: 1
has comment: http://stackoverflow.com/comment/39635693
has answer: http://stackoverflow.com/a/52142980
accepted answer: http://stackoverflow.com/a/52142980

http://stackoverflow.com/comment/39858538
comment on: http://stackoverflow.com/q/25529990
type: Comment
type: QuestionComment
score: 0
has text: Erasure => After the compile process, the code doesn't know anything about the generics

http://stackoverflow.com/a/25534652
has body: The JLS is always the real reference: http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.11 Notably, this: Given a switch statement, all of the following must be true or a compile-time error occurs: Every case constant associated with the switch statement must be assignment compatible with the type of the switch statement's Expression (§5.2). If the type of the switch statement's Expression is an enum type, then every case constant associated with the switch statement must be an enum constant of that type. No two of the case constants associated with the switch statement have the same value. No case constant associated with the switch statement is null. At most one default label is associated with the switch statement. It would likely be clearer with something less ambiguous, roughly: Switch block statements can be labeled with one or more case labels, or a single, optional default label.
type: Answer
answers question: http://stackoverflow.com/q/25534550
has comment: http://stackoverflow.com/comment/39867453
downvote count: 0
score: 1
upvote count: 1

xpath
tags question: http://stackoverflow.com/q/25486381
tags question: http://stackoverflow.com/q/25535453
tags question: http://stackoverflow.com/q/25475622
tags question: http://stackoverflow.com/q/25534338
tag name: xpath
type: Tag
tags question: http://stackoverflow.com/q/25460818
tags question: http://stackoverflow.com/q/25397552
tags question: http://stackoverflow.com/q/25498525
tags question: http://stackoverflow.com/q/25502261
tags question: http://stackoverflow.com/q/25534680
tags question: http://stackoverflow.com/q/25449534
tags question: http://stackoverflow.com/q/25391077

http://stackoverflow.com/comment/39633730
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25408728
type: Comment
has text: thanks Elliott, the problem was actually due to the jb.toString() being passed directly into the JSONObject constructor ! It seems like it has be put into a variable before. However another error was just raised, "A JSONObject text must begin with '{' at 1 [character 2 line 1]". This seems quite weird since the jb.toString() print seems correct. I edited the first post.

http://stackoverflow.com/a/25468241
score: 11
type: Answer
has comment: http://stackoverflow.com/comment/124872217
upvote count: 11
has body: A completely transparent frame does not receive mouse events. Here is an alternative using the MouseInfo. This works if the components of the app. are invisible (transparent), unfocused or minimized. import java.awt.*; import java.awt.event.*; import java.awt.geom.GeneralPath; import java.awt.image.BufferedImage; import javax.swing.*; import javax.swing.border.EmptyBorder; public class MouseMoveOnScreen { Robot robot; JLabel label; GeneralPath gp; Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); MouseMoveOnScreen() throws AWTException { robot = new Robot(); label = new JLabel(); gp = new GeneralPath(); Point p = MouseInfo.getPointerInfo().getLocation(); gp.moveTo(p.x, p.y); drawLatestMouseMovement(); ActionListener al = new ActionListener() { Point lastPoint; @Override public void actionPerformed(ActionEvent e) { Point p = MouseInfo.getPointerInfo().getLocation(); if (!p.equals(lastPoint)) { gp.lineTo(p.x, p.y); drawLatestMouseMovement(); } lastPoint = p; } }; Timer timer = new Timer(40, al); timer.start(); } public void drawLatestMouseMovement() { BufferedImage biOrig = robot.createScreenCapture( new Rectangle(0, 0, d.width, d.height)); BufferedImage small = new BufferedImage( biOrig.getWidth() / 4, biOrig.getHeight() / 4, BufferedImage.TYPE_INT_RGB); Graphics2D g = small.createGraphics(); g.scale(.25, .25); g.drawImage(biOrig, 0, 0, label); g.setStroke(new BasicStroke(8)); g.setColor(Color.RED); g.draw(gp); g.dispose(); label.setIcon(new ImageIcon(small)); } public JComponent getUI() { return label; } public static void main(String[] args) throws Exception { Runnable r = new Runnable() { @Override public void run() { JPanel ui = new JPanel(new BorderLayout(2, 2)); ui.setBorder(new EmptyBorder(4, 4, 4, 4)); try { MouseMoveOnScreen mmos = new MouseMoveOnScreen(); ui.add(mmos.getUI()); } catch (AWTException ex) { ex.printStackTrace(); } JFrame f = new JFrame("Track Mouse On Screen"); // quick hack to end the frame and timer f.setDefaultCloseOperation(JFrame…
accepted answer of: http://stackoverflow.com/q/25467866
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/124872354
answers question: http://stackoverflow.com/q/25467866

http://stackoverflow.com/comment/39810976
type: Comment
type: AnswerComment
has text: Ok @BalusC I did it and it work nice..But I still have one problem..if I chose a category and then chose another one and return to the previous one I have duplicated articles in the list.I try to use `Set` but the problem persist :\
comment on: http://stackoverflow.com/a/25498495
score: 0

http://stackoverflow.com/q/25444185
downvote count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/39700064
favorite count: 0
has answer: http://stackoverflow.com/a/25445915
score: 3
has body: Using hibernate on my jax-rs I'm getting this error: HTTP ERROR 500 Problem accessing /services/datesTest. Reason: Server Error Caused by: java.lang.ExceptionInInitializerError at connectors.Connector.buildSessionFactory(Connector.java:32) at connectors.Connector.getSessionFactory(Connector.java:37) at connectors.Connector.getSession(Connector.java:45) at mainproject.services.HibernateDatesTest.verifyToken(HibernateDatesTest.java:24) 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.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) a…
answer count: 3
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: jax-rs
has title: Hibernate java.lang.NoSuchMethodError: > org.hibernate.integrator.internal.IntegratorServiceImpl.<init>
type: Question
has answer: http://stackoverflow.com/a/25445860
has comment: http://stackoverflow.com/comment/39700776
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27431303

http://stackoverflow.com/comment/39691220
type: Comment
comment on: http://stackoverflow.com/q/25440035
score: 0
type: QuestionComment
has text: are you sure the socket has some input to read?

monospace
tag name: monospace
type: Tag
tags question: http://stackoverflow.com/q/25451978

http://stackoverflow.com/a/25507404
has body: Date objects don't have a format. When you parse any object into a call to System.out.println() that objects' toString() method is called. Date's toString() method always returns a String in that format. For functionality like you describe you would have to subclass Date and override toString() like so; class FormattedDate extends Date { @Override public String toString(){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(this); } } Your DOA, would of course need knowledge of the new FormattedDate class. Edit Following Question Update; Given that you have no control of the DOA or the SQL database software directly there is no way of changing the format the database software displays the date in. The datebase simply takes a Date object, which is a representation of the number of miliseconds since 0 am January 1st 1970. The database software specifies how the dates are formatted, which you can not change except by changing the database access software's settings. If you need to then fetch the date and display it in your own software, you will need to reformat it on your end because the data in the database probably doesn't have a format. A date's format, and data representing a date are entirely different constructs. Dates and Formats are entirely seperate, even in the database.
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25507245
type: Answer
answers question: http://stackoverflow.com/q/25507245
upvote count: 3
score: 3

http://stackoverflow.com/comment/39734795
has text: possible duplicate of [creating our own jar and using it in another project](http://stackoverflow.com/questions/6315716/creating-our-own-jar-and-using-it-in-another-project)
comment on: http://stackoverflow.com/q/25460722
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39696921
type: Comment
comment on: http://stackoverflow.com/a/25443126
has text: @hiergiltdiestfu: Thanks - I've updated the answer to make it a bit clearer.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39756625
comment on: http://stackoverflow.com/q/25474821
has text: Where do you load the data from in activity A?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39787952
type: QuestionComment
comment on: http://stackoverflow.com/q/25491515
type: Comment
has text: I cant use method `addToList` because it creates objects with time stamp from now - see constructor for `SomeObjec`. Lets suppose I have a array of SomeObjects `someObjectsAraayWithElementsToTest` which can be used.
score: 0

http://stackoverflow.com/comment/39767460
type: AnswerComment
comment on: http://stackoverflow.com/a/25480694
score: 0
type: Comment
has text: No need to look up. You just wrote `A a = new B()`. So JVM have enough information to call which method.

http://stackoverflow.com/q/25428833
has comment: http://stackoverflow.com/comment/39670534
type: Question
tagged with: graph
tagged with: recursion
answer count: 3
has body: I'm trying to make a program for find all the Euler Paths in a graph. For doing this, I'm using a code adapted from this: http://www.sanfoundry.com/java-program-implement-euler-circuit-problem/ What I do: I modified a recursive function printEulerUtil() (below) for test and find (method isValidNextEdge) the possibles Euler paths. But, my recursive method doesn't stores the variable int[][] localAdjacencyMatrix (it's like a global variable, i can't understand that), which means that when the recursion returns (for example, after find the first Euler path in a deep first search), my variable is the same of the last recursive call (like I said, a global variable behaviour), not storing the values of the "original" call before in the program (the contexts before the first recursion call). What I'm doing wrong? All the context is not saved when recursion occurs, after all? Here is a piece of the code (commented): // in the main call, variable vertex and localAdjacencyMatrix are defined in the constructor. public void printEulerTourUtil(int vertex, int[][] localAdjacencyMatrix) { ArrayList&lt;Integer&gt; destinationVertexes = new ArrayList&lt;&gt;(); int destination = 1; // print the actual vertex System.out.println("V: " + vertex); for (destination = 1; destination &lt;= numberOfNodes; destination++) { // test all possibles destinations if (localAdjacencyMatrix[vertex][destination] == 1 &amp;&amp; isValidNextEdge(vertex, destination, localAdjacencyMatrix)) { // insert these destinations in a list of next vertex for recursion destinationVertexes.add(destination); System.out.println(destination + " "); } } // make a recursion for every vertex destination in the list. for (int i = 0; i &lt; destinationVertexes.size(); i++){ destination = destinationVertexes.get(i); // go to the next vertex in the graph System.out.println("-&gt; source : " + vertex + " destination " + destination); // localAdjacencyMatrix isn't working. it's like a global variable, so my recursion fails remo…
tagged with: java
possible better answer: http://stackoverflow.com/a/25428940
accepted answer: http://stackoverflow.com/a/25428938
has answer: http://stackoverflow.com/a/25428940
has answer: http://stackoverflow.com/a/25428938
linked to: http://stackoverflow.com/q/9106131
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25429052
has title: Keeping instances of variables in recursion

http://stackoverflow.com/comment/39838934
score: 12
type: AnswerComment
has text: Based on the little information you've given about your actual problem, I think you've misunderstood what the Streams library is actually for. Streams is about *data-parallelism*; data parallel problems are CPU-bound, not IO-bound. It seems that you're simply looking to run a number of mostly unrelated IO-intensive tasks concurrently. Use a plain-old thread pool for that; your first example is an ideal candidate for `ExecutorService.invokeAll()`.
type: Comment
comment on: http://stackoverflow.com/a/25518084

http://stackoverflow.com/comment/79693624
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/26155140
has text: Changing web.config doesn't help. This: <environmentVariable name="JAVA_OPTS" value="-Djava.net.preferIPv4Stack=true -Xmx1024m" /> causes a 500 error. I have changed the JVM according to this: https://stackoverflow.com/questions/37425798/microsft-azure-installing-java-cryptography-extension-jce Could that be part of the problem ?

http://stackoverflow.com/a/70608830
answers question: http://stackoverflow.com/q/25447502
has body: If you call System.out.println(Arrays.asList("a", "b").getClass()); the runtime type is java.util.Arrays$ArrayList, but if you call System.out.println(new ArrayList<>(Arrays.asList("a", "b").getClass())); the runtime type is java.util.ArrayList. Maybe this distinction helps.
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39836632
type: AnswerComment
comment on: http://stackoverflow.com/a/25398889
type: Comment
has text: Adding a rejected edit from @Nicholas as a comment, as it seems relevant: Drawback: If JVM2 is fired off, then is terminated, then fires off again, you'll get an error saying there is no server listening to port 8000 to connect to. Another possibility is to leave your application as a `server=y`, but add `suspend=y` which tells the JVM to wait for you to connect with Eclipse in attach mode before launching the program. This will make it so when the 2nd JVM finally goes, it will wait for the remote debugger to connect before launching.
score: 3

http://stackoverflow.com/comment/39748796
comment on: http://stackoverflow.com/a/25470610
type: AnswerComment
score: 0
type: Comment
has text: I guess you can get lucky. It is not specified how much it reads ahead.

http://stackoverflow.com/a/25470414
type: Answer
answers question: http://stackoverflow.com/q/25470280
score: 0
has body: The error is because of the empty try {} catch {} block in the main method of StreamCopier.java. Remove the empty try{} catch{} block and then try. It should work. public static void main (String[] args) { try { } catch (IOException e) {System.err.println(e);} // here is the problem }

http://stackoverflow.com/a/25469140
has comment: http://stackoverflow.com/comment/39745906
accepted answer of: http://stackoverflow.com/q/25469115
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25469115
downvote count: 1
has comment: http://stackoverflow.com/comment/39745932
upvote count: 4
has comment: http://stackoverflow.com/comment/39745902
has comment: http://stackoverflow.com/comment/39745912
has comment: http://stackoverflow.com/comment/39745969
type: Answer
has body: There's nothing broken. The reason you're getting sorted results is because your custom hashCode method doesn't have a very random hash distribution. The HashSet class is backed by an array of "buckets". When you add something to the HashSet it uses your hashCode method to figure out which bucket to use. I think it works something like this: bucketIndex = object.hashCode() % arrayLength; Since your hashCode() is just the ID, you end up with the Humans added to the buckets in order. If you mess with your hash function a bit in order to make it more randomly-distributed then you should get a more random ordering in the HashSet.
has comment: http://stackoverflow.com/comment/39745943
score: 3
has comment: http://stackoverflow.com/comment/39745809

http://stackoverflow.com/comment/39688460
type: Comment
has text: Comparison in Java is either done by a Comparator (like you did) or by implementing `Comparable` interface. Unlike Python - Java is verbose, there's no "compact" way...
score: 0
comment on: http://stackoverflow.com/q/25438281
type: QuestionComment

http://stackoverflow.com/comment/39820849
score: 0
type: AnswerComment
has text: oops - added end with date that is not the initial digit
comment on: http://stackoverflow.com/a/25509264
type: Comment

http://stackoverflow.com/comment/40692983
score: 0
comment on: http://stackoverflow.com/q/25469648
has text: sorry for delayed acknowledgement ... there is actually no problem with the output json, its just one my crazy client, who uses my WS, raised this false alarm .. damn! I wasted much time! Thanks @andersschuller appreciate your efforts
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39842307
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25520965
has text: thank you for reply, through filedialog is not possiable. how to change the java theme image.@mKorbel and @AndrewThompson

http://stackoverflow.com/q/25441076
tagged with: netbeans
score: 5
has answer: http://stackoverflow.com/a/32980522
has title: Collapsing sub-packages from NetBeans or Eclipse in java project view
has comment: http://stackoverflow.com/comment/39693768
has comment: http://stackoverflow.com/comment/39693825
has comment: http://stackoverflow.com/comment/39693253
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39693116
answer count: 1
has comment: http://stackoverflow.com/comment/39693568
downvote count: 0
has comment: http://stackoverflow.com/comment/39693058
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39693460
upvote count: 5
tagged with: java
has body: I have view like + controller + framework + model - view Calc.java Main.java + view.main + view.newpackage But i want that sub backages are collapsed into main packages like: + controller + framework + model - view Calc.java Main.java + main + newpackage or + controller + framework + model + view Know anybody is it possible in Eclipse and/or NetBeans? Thank you
has comment: http://stackoverflow.com/comment/39693880
tagged with: eclipse
linked to: http://stackoverflow.com/q/3915961

http://stackoverflow.com/a/25497000
score: 0
answers question: http://stackoverflow.com/q/25496897
type: Answer
has body: Your ShoppingBag.place(int,float) method doesn't add the new items and cost to the bag. It replaces what's in the bag, so the contents of the bag at any one time are only what you provided in the most recent call to place. In the main method, you're incrementing items before calling place, but then place multiplies the incremented value of items by only the most recent value of cost. Also, these two lines in your main method have no effect, since the called methods just return the existing value of a field, and you never assign the returned value to anything: myBag.getItems(); myBag.getCost();

http://stackoverflow.com/a/25421636
answers question: http://stackoverflow.com/q/25421566
has comment: http://stackoverflow.com/comment/39657226
score: 0
has body: You may try to change your query and provide column names in that like this: String sql = "select name, col1 from students where id="+ request.getParameter("st_id"); ResultSet rs= stmt.executeQuery(sql); and then you can use the rs.getstring like this: if(rs.next()) { if (rs.wasNull()) { request.getRequestDispatcher("/login_fail.jsp").forward(request, response); return; } else { request.setAttribute("name", rs.getString(1)); request.getRequestDispatcher("/login_action.jsp").forward(request, response); return; } }
type: Answer

http://stackoverflow.com/a/25548464
type: Answer
has comment: http://stackoverflow.com/comment/39897481
has body: The reason I ask is that I know that Strings are immutable, which suggests that there is a more efficient alternative, am I right? Nope. You're calling readLine multiple times, that's going to give you a different string reference each time. Just because the string content itself can't be changed doesn't mean that it's inefficient to change the value of a String variable. That variable value is just a reference... it's not like it's going to copy the string content on each iteration. Do you even need the variable to be declared in the loop? Generally, I prefer to declare variables with the narrowest scope possible: while (file.hasNext()) { String line = file.readLine(); // Use line here }
has comment: http://stackoverflow.com/comment/39895449
has comment: http://stackoverflow.com/comment/39892231
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25548421
accepted answer of: http://stackoverflow.com/q/25548421
score: 3

http://stackoverflow.com/comment/39689766
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25439022
score: 0
has text: @Ryan Good job dude ;)

http://stackoverflow.com/a/25513611
has body: It took me some time to clearly understand what you want to do and the implications beyond. Finding the root application context from the servlet one would be the easy part, context.getParentBeanFactory(), or directly context.getParent() gives it immediately in any ApplicationContextAware class, or through direct injection of the ApplicationContext. The hard part, is that at the time of initialization of the servlet application context, the root application context has already been refreshed. If I look at what happens in Tomcat : at deploy time the root application context is fully initialized and refreshed next, at first request for the DispatcherServlet the child context is initialized with root context as parent. That mean that when servlet context is initialized, it is way too late to inject beans in root context : all singleton beans have already been created. There may be workaround, all with their own flaws : register a new Configuration class in parent context and do a new refresh().IMHO, this would be the least bad solution as normally WebApplicationContextes support multiple refresh. The potentials problems are : all other beans must be initialized once without the new beans : the configuration must be tolerant to non existing beans other components (filters, security, DAO, etc.) may already be running, and they have to be thoroughly tested against a hot context refresh create an intermediate ApplicationContext with current root as parent containing beans that should not go into servlet application context, and then create the servlet application context with this intermediate context as parent. no problem for the root application context that is not even aware of the whole operation but no bean of root context can be injected with any new bean register all new beans directly in root context. Ok, all is fine for root initialization, and beans of servlet context will have access to all beans. But if one new bean need to be injected with a bean from servlet …
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39832642
has comment: http://stackoverflow.com/comment/39903737
upvote count: 3
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/25444579
has comment: http://stackoverflow.com/comment/39959633
answers question: http://stackoverflow.com/q/25444579
has comment: http://stackoverflow.com/comment/39832616
downvote count: 0

http://stackoverflow.com/q/25442508
has answer: http://stackoverflow.com/a/25444928
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/25448770
type: UnansweredQuestion
tagged with: indexof
has answer: http://stackoverflow.com/a/25442553
tagged with: string-utils
tagged with: postgresql
has body: I need to implement stringUtils Class indexOf() method in postgresql. Lets say I have a table in which url is one of the column. url : "http://paypal-info.com/home.webapps.cgi-bin-limit/webscr.cmd-login-submit" My requirement is to find the index of the 3rd occurence of '/' in the above url and do substring and take only paypal-info.com host name in Postgresql Query Any idea on implementing this would be grateful. Thanks
answer count: 3
downvote count: 0
tagged with: java
has title: StringUtil indexOf() equivalent postgreSQL query
favorite count: 0
type: Question

http://stackoverflow.com/q/25466527
has body: I have: Document doc = Jsoup.connect("http://example.com").get(); doc.select(".main li").last().remove(); This is working good if .main li exists, but if it doesn't exist, then this my application crashes. How can i check if .main li exists?
type: Question
tagged with: jsoup
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25466691
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25466691
tagged with: java
has title: The best way to check selector in Jsoup

http://stackoverflow.com/comment/39767034
type: Comment
type: QuestionComment
has text: use [`PreparedStatement`](http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html) to set the values in query.
score: 2
comment on: http://stackoverflow.com/q/25480529

http://stackoverflow.com/comment/39878621
type: Comment
score: 0
type: AnswerComment
has text: nope, because FILAS is generic, it depends of the longitud of the linkedlist. its a really weird. maybe because it is in a thread?
comment on: http://stackoverflow.com/a/25540935

http://stackoverflow.com/comment/39694754
type: AnswerComment
comment on: http://stackoverflow.com/a/25441661
score: 0
type: Comment
has text: ,is it possible to convert this json object back to java..?and where should i give the reference of this javascript file.in jsp page..or somewhere..?

http://stackoverflow.com/comment/39797506
type: QuestionComment
has text: Mind sharing the details about the error you are getting and stack trace that accompanies it?
score: 0
comment on: http://stackoverflow.com/q/25496766
type: Comment

http://stackoverflow.com/comment/79694063
score: 0
has text: the device that I used is supported by the sdk.
type: Comment
comment on: http://stackoverflow.com/q/25511693
type: QuestionComment

http://stackoverflow.com/q/25445169
has body: I have a String like this: "embed Test1 embed Test2 Test2.name = Foo;" Now, i want to delete the "embed"s and the following word. In this case, "embed Test1" and "embed Test2" My problem is, that I don't know, how many times the "embed" will occur. The final result should look like this: "Test2.name = "Foo";" Thanks for your help
has answer: http://stackoverflow.com/a/25445346
accepted answer: http://stackoverflow.com/a/25445307
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25445307
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/25445346
tagged with: regex
has answer: http://stackoverflow.com/a/25445235
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39700366
has answer: http://stackoverflow.com/a/25445280
has answer: http://stackoverflow.com/a/25445325
has comment: http://stackoverflow.com/comment/39700536
has answer: http://stackoverflow.com/a/25445261
upvote count: 0
score: -3
answer count: 6
tagged with: string
has title: Delete word after a specific substring

http://stackoverflow.com/a/25521352
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25521307
has body: file name that contains a public class should be set to the name of the public class. And a file cannot have two public classes (same reason).

http://stackoverflow.com/a/25425643
has comment: http://stackoverflow.com/comment/39673361
type: Answer
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25422297
has body: By default undocumentedAPI check should skip setters and getters. There are unfortunately no configuration available for this rule, so only way is to deactivate it alltogether or mark issues as false positive.
has comment: http://stackoverflow.com/comment/39671243

http://stackoverflow.com/a/25483325
downvote count: 0
type: Answer
has body: Because .* matches Zero length matches Change to .+ and you're good.
score: 2
answers question: http://stackoverflow.com/q/25483256
upvote count: 2

http://stackoverflow.com/q/25533008
has title: How convert the ListActivity to a FragmentActivity in Android
has comment: http://stackoverflow.com/comment/39864162
has comment: http://stackoverflow.com/comment/39864003
score: 0
tagged with: android-fragments
has body: I am new to android I have a problem with the code below, is the Activity extends ListActivity with an RSS to show a FragmentActivity with TabsHost. I wish someone would help me convert the ListActivity to display in the FragmentActvity (say ListActivity) to convert FragmentActivity. public class RssReaderActivity extends ListActivity { private ArrayList&lt;RSSItem&gt; itemlist = null; private RSSListAdaptor rssadaptor = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); itemlist = new ArrayList&lt;RSSItem&gt;(); new RetrieveRSSFeeds().execute(); } }
tagged with: java
has comment: http://stackoverflow.com/comment/39864310
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/39864270
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39864097

http://stackoverflow.com/a/25511319
score: 4
upvote count: 4
has body: The error message is correct, this for (Bags bag : Bags.values()) { for (int bagId : bag.getId()) { // &lt;-- HERE! if (bagId == index) { return bag; } } } Is not legal. I think you wanted for (Bags bag : Bags.values()) { if (bag.getId() == index) { return bag; } } Because getId() returns a single int.
downvote count: 0
answers question: http://stackoverflow.com/q/25511219
type: Answer

http://stackoverflow.com/q/25394319
has answer: http://stackoverflow.com/a/25395323
linked to: http://stackoverflow.com/q/941754
score: 5
upvote count: 6
has comment: http://stackoverflow.com/comment/57082422
has answer: http://stackoverflow.com/a/25395401
tagged with: loading
type: AnsweredQuestion
has body: After hours of fighting with this, I'm starting to get really frustrated. I have a JKS server file that I want to load from within the jar. Using FileInputStream works a treat as long as the file is outside the Jar, but as soon as I try to change that to getResourceAsStream it will just not take it, saying (No such file or directory). This is how the project is distributed ProjectFolder -src --package.name ---JKS File ---Class calling the resource retrieval and loading into the keystore I think I have tried almost every combination of this.getClass().getClassLoader().getResourceAsStream("jksFile.jks") I can think of. I apologise in advance for not being more specific with the code, but I have literally lost count of what I have tried and what I havent. HELP! Thanks in advance
answer count: 3
tagged with: classloader
has answer: http://stackoverflow.com/a/25394419
possible better answer: http://stackoverflow.com/a/25394419
tagged with: java
downvote count: 1
linked to: http://stackoverflow.com/q/2138574
has title: Keystore not loading JKS file from within jar
linked to: http://stackoverflow.com/q/344748
accepted answer: http://stackoverflow.com/a/25395401
favorite count: 0
type: Question

http://stackoverflow.com/comment/39784611
comment on: http://stackoverflow.com/q/25489953
type: QuestionComment
has text: @ortis It's a byte array
score: 0
type: Comment

http://stackoverflow.com/q/25522139
tagged with: spring-security
tagged with: http
has body: Is it possible to turn off HTTP session timeout in Spring Security? From this answer I see that the HTTP session timeout can be modified in web.xml like this: 10 But I did not find from the Spring Security manuals how to disable the timeout. From this answer I see that the Spring Security uses a javax.servlet.http.HttpSession internally, which according to this manual page can be set to never expire by calling method setMaxInactiveInterval(0). Therefore it should be possible to change the session timeout by obtaining the HttpSession (as shown here in an answer) and changing the maxInactiveInterval to 0. My question is, if I will do this the first time after the user has logged in, will the change persist in the HttpSession (i.e., in a next request, will the change in HttpSession will be still there?) And is it possible to disable the session timeout in web.xml like this or not? 0 And another question, what is the default HTTP session timeout in Spring Security?
favorite count: 0
has comment: http://stackoverflow.com/comment/39844688
accepted answer: http://stackoverflow.com/a/25522191
linked to: http://stackoverflow.com/q/1629211
type: Question
has answer: http://stackoverflow.com/a/25522191
linked to: http://stackoverflow.com/q/18785073
has comment: http://stackoverflow.com/comment/39844945
tagged with: spring
answer count: 1
has title: How to turn off HTTP session timeout in Spring Security?
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
downvote count: 0

http://stackoverflow.com/comment/39652398
type: QuestionComment
score: 0
has text: @Stewart Is there a way to make this non-recursive?
comment on: http://stackoverflow.com/q/25418859
type: Comment

http://stackoverflow.com/a/25449521
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/25449424
type: Answer
score: 2
upvote count: 3
has body: When doing string comparisons you really need to do sign_flag.equals("+") instead of '==', because this will only check the location of the addresses. String comparisons don't work in that manner. There might be more, but start with that. Edit: The mathematical logic signifies that the first number in those equations is getting multiplied by (-1) and then having one added on to it. That is the pattern. So, that should be followed to see where your calculations are going wrong. What is meant: 6 + (-5) != -10 but ((6 * -1) + 1) + (-5) = -10 and 6 − (-5) != 0 but ((6 * -1) + 1) - (-5) = 0 and 6 × (-5) != 25 but ((6 * -1) + 1) x (-5) = 25 That's the pattern I am seeing that is being calculated.
accepted answer of: http://stackoverflow.com/q/25449424

http://stackoverflow.com/comment/39614851
has text: I am pretty sure you can consider this a somewhat-obscure bug in both netbeans and eclipse (missing NPE rule for this anti-pattern). Why not file it in their bug systems?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25398651

http://stackoverflow.com/a/25440565
answers question: http://stackoverflow.com/q/25440490
score: 1
has body: You can try this: String[] xmls = new String[3]; GetXML taskA = new GetXML(); try { xmls = taskA.execute().get(); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (ExecutionException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }
type: Answer
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25440490

http://stackoverflow.com/comment/39699098
type: AnswerComment
comment on: http://stackoverflow.com/a/25444132
score: 0
type: Comment
has text: it just available for API 14. I'm using API 10.

http://stackoverflow.com/a/25485161
accepted answer of: http://stackoverflow.com/q/25485086
type: Answer
has comment: http://stackoverflow.com/comment/39775025
score: 2
answers question: http://stackoverflow.com/q/25485086
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: create this recreates db on startup.
has comment: http://stackoverflow.com/comment/39775050

http://stackoverflow.com/comment/39807222
type: QuestionComment
has text: ok I will revert back my question and add a new one, Sorry for the inconvenience.
comment on: http://stackoverflow.com/q/25502025
type: Comment
score: 0

http://stackoverflow.com/a/25416492
score: 2
has body: Your issue can be boiled down to simply this: how can one class be notified of a change of state in another class, when the change occurs. This is a common problem in event-driven GUI programs (and other program types as well) and is the whole reason that the observer or listener type design patterns were developed. So my suggestion is just that, that you somehow use a listener design pattern. This can be achieved in several ways including: Allowing the one class to attach an ActionListener to the first class's JButton Having the observer cla add a listener of some type to the class that changes state, the class with the JButton Or my favorite: get the boolean out of your view classes entirely and into a model class, and have any view that wants to be notified to register a listener to the model and react as needed to changes int he model's state. I've used the latter often, often using PropertyChangeListeners to achieve this. So a model class could look something like: class Model { public static final String START = "start"; // for the property change name private SwingPropertyChangeSupport pcSupport = new SwingPropertyChangeSupport( this); private boolean start = false; public boolean isStart() { return start; } public void setStart(boolean start) { // to set up our PropertyChangeEvent boolean oldValue = this.start; boolean newValue = start; this.start = start; // notify our listeners that the start property has changed pcSupport.firePropertyChange(START, oldValue, newValue); } // allow listeners to be added and removed public void addPropertyChangeListener(PropertyChangeListener listener) { pcSupport.addPropertyChangeListener(listener); } public void removePropertyChangeListener(PropertyChangeListener listener) { pcSupport.removePropertyChangeListener(listener); } } Edit For example, here is a M-V or Model-View simple example program: import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.beans.PropertyChangeListener; i…
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25416420
type: Answer

sensors
type: Tag
tags question: http://stackoverflow.com/q/25399001
tag name: sensors

http://stackoverflow.com/comment/39703443
comment on: http://stackoverflow.com/a/25410693
score: 0
type: Comment
type: AnswerComment
has text: @bcsb1001: I shall remember that. Due to the similarities between C# and Java and C-based languages, I presumed this was the same. Thanks for pointing me out that it's not.

http://stackoverflow.com/q/25394474
tagged with: jdbc
tagged with: object-pooling
has body: I have a DAO and I implement a connection pool. I instantiate the connection pool using a singleton to have only one instance. I call on the getConnection function to get my connection inside of my DAO. I do this for each method within the DAO? Is this a good way handling connections with DAO? Is there a more efficient way to setup my pool and have it work with my DAO? Specifically with JDBC. public class SQLUserDAO implements GenericDAO&lt;User, String, Boolean&gt; { @Override public void update(User user, Boolean active) throws NotFoundException { // Create the ConnectionPool: JDBCConnectionPool pool = JDBCConnectionPool.getPoolInstance(); // Get a connection: Connection con = pool.checkOut(); // Return the connection: pool.checkIn(con); } @Override public void delete(User user, Boolean active) throws NotFoundException { // Create the ConnectionPool: JDBCConnectionPool pool = JDBCConnectionPool.getPoolInstance(); // Get a connection: Connection con = pool.checkOut(); // Return the connection: pool.checkIn(con); } @Override public User findByKey(String key, Boolean active) throws NotFoundException { // Create the ConnectionPool: JDBCConnectionPool pool = JDBCConnectionPool.getPoolInstance(); // Get a connection: Connection con = pool.checkOut(); // Return the connection: pool.checkIn(con); return null; } @Override public User findByValue(User object, Boolean active) throws NotFoundException { // Create the ConnectionPool: JDBCConnectionPool pool = JDBCConnectionPool.getPoolInstance(); // Get a connection: Connection con = pool.checkOut(); // Return the connection: pool.checkIn(con); return null; } @Override public void insert(User user, Boolean active) throws NotFoundException { // Create the ConnectionPool: JDBCConnectionPool pool = JDBCConnectionPool.getPoolInstance(); // Get a connection: Connection conn = pool.checkOut(); PreparedStatement preparedStatement; try { preparedStatement = conn .prepareStatement("INSERT INTO users(user_id, user_name, user_password) V…
type: Question
downvote count: 0
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25394808
accepted answer: http://stackoverflow.com/a/25394808
favorite count: 0
type: AnsweredQuestion
score: 1
has title: Java - How handle JDBC connections inside your DAO
tagged with: java

http://stackoverflow.com/a/25543585
type: Answer
answers question: http://stackoverflow.com/q/25501962
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25501962
has body: Here's how I did it. Basically, I declare all the resources folders I want to see in Eclipse in the default configuration (adding them in each profile didn't work since when a profile is active, the node is appended to the final POM instead of (as I thought) replacing the existing one); then I tell Maven from which folder to copy the resources using properties, whose values are driver by the active profile. Any comment is, of course, very much appreciated! 4.0.0 ... ... ... war ... <!-- My prerequisite was that when working in Eclipse no extra steps should be required to make the IDE use the right configuration than Configure -> Convert to Maven Project, so I didn't like having default settings in a profile that must be enabled in Eclipse project configuration --> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> / <res.devel.includes>**/*</res.devel.includes> <res.devel.excludes></res.devel.excludes> <res.local.includes></res.local.includes> <res.local.excludes>*</res.local.excludes> <res.release.includes></res.release.includes> <res.release.excludes>*</res.release.excludes> ${basedir}/src/main/resources-local true ${res.devel.includes} ${res.devel.excludes} ${basedir}/src/main/resources-local true ${res.local.includes} ${res.local.excludes} ${basedir}/src/main/resources-release true ${res.release.includes} ${res.release.excludes} local ROOT <res.devel.includes></res.devel.includes> <res.devel.excludes>*</res.devel.excludes> <res.local.includes>*</res.local.includes> <res.local.excludes></res.local.excludes> <res.release.includes></res.release.includes> <res.release.excludes>*</res.release.excludes> release ROOT <res.devel.includes></res.devel.includes> <res.devel.excludes>*</res.devel.excludes> <res.local.includes></res.local.includes> <res.local.excludes>*</res.local.excludes> <res.release.includes>*</res.release.includes> <res.release.excludes></res.release.excludes>

http://stackoverflow.com/a/25406007
has body: It’s not too hard when just implementing it straight forward. The example code below does it. It simply uses local variables for everything that is not supposed to be shared. Besides the queue, only a thread safe counter maintaining the number of active producers is shared. The counter is used rather than a special “POISON_PILL” value as such a marker value does not work with a single queue and multiple consumers as all consumers have to recognize the finishing of the producer but only when all producers have finished. The counter is a simple ending condition. The only thing to care about is that after detecting that the counter reached zero, the queue has to be re-checked to avoid race conditions. As a side note, it doesn’t make sense to use concurrency features provided by Java 5 and not using Generics for clean type safe code. final AtomicInteger activeProducers=new AtomicInteger(); final BlockingQueue&lt;Integer&gt; queue=new ArrayBlockingQueue&lt;&gt;(10); Runnable producer=new Runnable() { public void run() { try { for(int i=0; i&lt;10; i++) { Thread.sleep(TimeUnit.SECONDS.toMillis(1)); queue.put(i); System.out.println("Produced "+i); } } catch(InterruptedException ex) { System.err.println("producer terminates early: "+ex); } finally { activeProducers.decrementAndGet(); } } }; Runnable consumer=new Runnable() { public void run() { try { for(;;) { Integer queueElement = queue.poll(1, TimeUnit.SECONDS); if(queueElement!=null) System.out.println("Consumed : " + queueElement); else if(activeProducers.get()==0 &amp;&amp; queue.peek()==null) return; } } catch(InterruptedException ex) { System.err.println("consumer terminates early: "+ex); } } }; final int NUM_PRODUCERS = 2, NUM_CONSUMERS = 2; for(int i=0; i&lt;NUM_PRODUCERS; i++) { activeProducers.incrementAndGet(); new Thread(producer).start(); } for(int i=0; i&lt;NUM_CONSUMERS; i++) { new Thread(consumer).start(); }
score: 0
answers question: http://stackoverflow.com/q/25393938
type: Answer

http://stackoverflow.com/q/25515113
has title: Android Math easy
downvote count: 6
score: -5
answer count: 3
has comment: http://stackoverflow.com/comment/39831955
tagged with: java
has answer: http://stackoverflow.com/a/25515826
has answer: http://stackoverflow.com/a/25515747
has answer: http://stackoverflow.com/a/25515191
upvote count: 1
has comment: http://stackoverflow.com/comment/39832003
linked to: http://stackoverflow.com/q/2605032
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39831902
has comment: http://stackoverflow.com/comment/39832008
type: UnansweredQuestion
tagged with: math
has body: I want to do something very easy 1+2=3 String var1 = "1"; String var2 = "2"; String var3 = var1 + var2; The problem: var3 is 12
has comment: http://stackoverflow.com/comment/39831925

jmockit
type: Tag
tag name: jmockit
tags question: http://stackoverflow.com/q/25420946
tags question: http://stackoverflow.com/q/25417926
tags question: http://stackoverflow.com/q/25498462

http://stackoverflow.com/q/25458444
tagged with: redis
possible better answer: http://stackoverflow.com/a/26582941
has body: I wanted to know since there is hibernate ORM present in the market with caching feature included that reduces the DB load in applications, what can be the usability for external caching systems like Redis/Memcached since they also provide caching mechanism. Since our objects are already cached using hibernate in the application, what can be the usability for external caching systems. How would they be of any help in the application performance? Should we store our class objects in memcached/redis also when hibernate already holds them in memory or should memcached be used only for storing list results which normally do not change and not the objects which can be fetched from hibernate cache?
has answer: http://stackoverflow.com/a/26582941
tagged with: caching
has title: Use of memcached when Hibernate already present and uses caching
type: AnsweredQuestion
answer count: 2
score: 1
tagged with: java
tagged with: hibernate
downvote count: 0
accepted answer: http://stackoverflow.com/a/26576321
upvote count: 1
has answer: http://stackoverflow.com/a/26576321
tagged with: memcached
favorite count: 0
type: Question

http://stackoverflow.com/comment/39875886
has text: Like the following? `TransportSlabGraph component2 = new TransportSlabGraph();` `component2.attProfileArray(slab1.euler(),slab1.getThickness());` `frame.add(component2);`
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25539252

http://stackoverflow.com/a/25551392
answers question: http://stackoverflow.com/q/25550628
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39933797
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39899376
has comment: http://stackoverflow.com/comment/39898914
type: Answer
accepted answer of: http://stackoverflow.com/q/25550628
has comment: http://stackoverflow.com/comment/39902616
has body: You can use LinearLayout instead of RelativeLayout to split screen. Just set height = 0 and weight = 1 of GLSurfaceView and WebView both. In your case the code will be: LinearLayout layout = new LinearLayout(this); // Use LinearLayout instead of Relative glView = new GLSurfaceView(this); glView.setRenderer(this); glView.setZOrderMediaOverlay(false); // height is 0, weight is 1 LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1); layout.addView(glView, params); webView = new WebView(this); this.showWV(false); //handler message , i hide it in certain screen. webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); // height is 0, weight is 1 params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1); layout.addView(webView, params); webView.loadUrl("http://stackoverflow.com"); setContentView(layout); Or you can use RelativeLayout with hardcoded height and width values: RelativeLayout layout = new RelativeLayout(this); // Use LinearLayout instead of Relative glView = new GLSurfaceView(this); glView.setRenderer(this); glView.setZOrderMediaOverlay(false); glView.setId(123); // set id RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(640, 480); layout.addView(glView, params); webView = new WebView(this); this.showWV(false); //handler message , i hide it in certain screen. webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); params = new RelativeLayout.LayoutParams(640, 480); params.addRule(RelativeLayout.BELOW, glView.getId()); // set WebView position is below GLSurfaceView layout.addView(webView, params); webView.loadUrl("http://stackoverflow.com"); setContentView(layout); UPD: Without hardcoded values, using invisible view: RelativeLayout layout = new RelativeLayout(this); // Use Linea…

http://stackoverflow.com/a/51552923
accepted answer of: http://stackoverflow.com/q/25420780
type: AcceptedAnswer
type: Answer
upvote count: 1
has body: There is actually a more straightforward solution as per https://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_a_file_in_the_workspace%3F int lineNumber = ... IPath path = ... IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); IMarker marker = file.createMarker(IMarker.TEXT); marker.setAttribute(IMarker.LINE_NUMBER, lineNumber); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IDE.openEditor(page, marker); marker.delete();
score: 1
answers question: http://stackoverflow.com/q/25420780
downvote count: 0

http://stackoverflow.com/q/25414107
tagged with: divide
has title: Java: Dividing pairs from an Array
has answer: http://stackoverflow.com/a/25414276
has answer: http://stackoverflow.com/a/25414235
possible better answer: http://stackoverflow.com/a/25414235
tagged with: arrays
has comment: http://stackoverflow.com/comment/39648929
has answer: http://stackoverflow.com/a/25414298
type: Question
tagged with: exception
tagged with: if-statement
accepted answer: http://stackoverflow.com/a/25414276
tagged with: java
has comment: http://stackoverflow.com/comment/39644135
has answer: http://stackoverflow.com/a/25414273
has comment: http://stackoverflow.com/comment/39648901
has body: I am working on a project and am stuck on what to do next. I need to write a Java program that accepts from a user ten values and place those numbers in an array. The numbers in the array will be added together and the result displayed to the user. (I got that part) Here is the problem: The program should compare the values for elements 1 and 2 (in the array) and divide the larger number by the smaller number. It should compare the values for all odd/even elements and divide the larger by the smaller value. I do not know how to do this at all. I started with if-else statements but I am getting errors. It know it's a mess right now, but any help with dividing the array pairs would be very helpful. Send me links too, I have been unsuccessful finding any, so I can learn more. Thanks! Here is what I have so far: /import java.util.Scanner; public class ExceptionHandler { /** * @param args the command line arguments10 * 10 */ public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter ten values:"); System.out.println(); // Input the data from the user. int[ ] digit = new int[11]; int sum = 0; //Declare an array for (int i = 1; i &lt; digit.length; i++) { System.out.print("Value " + i + ": "); digit[i] = in.nextInt(); sum += digit[i]; } System.out.println("Total Values in Array:"+ sum); // Calculate the sum and print the total System.out.println("Would you like to divide values?"); // Fix this later int result= digit[i]; if (digit[i] &gt; digit[i + 1]) result = digit[i] / digit[i + 1]; else { (digit[i + 1] / digit[i]); } // Compare element 0 with 1, divide larger element by smaller element if (digit[i])&gt; digit[i + 3]) result = digit[i] / digit[ i+ 3]; else{ (digit[i +3])/ digit[i]; } }
answer count: 4
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39655552
score: 0
comment on: http://stackoverflow.com/q/25420766
type: QuestionComment
type: Comment
has text: [Click me](http://docs.oracle.com/javase/tutorial/java/generics/).

http://stackoverflow.com/comment/39695245
type: AnswerComment
has text: you should iterate the `keySet` not the `entrySet` to get the exception
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25442172

http://stackoverflow.com/comment/82944985
type: Comment
comment on: http://stackoverflow.com/a/25403615
type: AnswerComment
has text: I did a search for how to get a portion of a bitmap and this answer came up! =]
score: 0

http://stackoverflow.com/q/25545434
accepted answer: http://stackoverflow.com/a/25545608
answer count: 1
has answer: http://stackoverflow.com/a/25545608
has title: Unable to edit mp3 tags
type: AnsweredQuestion
score: 0
tagged with: android
tagged with: java
type: Question
has body: I'm trying to use jaudiotagger 2.0.1 library but when I try to set a meta tag I get this error: 08-28 11:27:21.477: W/System.err(25763): org.jaudiotagger.audio.exceptions.CannotWriteException: org.jaudiotagger.audio.exceptions.UnableToCreateFileException: Cannot modify /storage/emulated/0/Music/01-Happy Christmas (War is Over) - John Lennon and Yoko Ono.mp3 because do not have permissions to modify file 08-28 11:27:21.477: W/System.err(25763): at org.jaudiotagger.audio.mp3.MP3File.commit(MP3File.java:722) 08-28 11:27:21.477: W/System.err(25763): at com.mypackage$1.onClick(Tag.java:142) 08-28 11:27:21.477: W/System.err(25763): at android.view.View.performClick(View.java:4445) 08-28 11:27:21.477: W/System.err(25763): at android.view.View$PerformClick.run(View.java:18446) 08-28 11:27:21.477: W/System.err(25763): at android.os.Handler.handleCallback(Handler.java:733) 08-28 11:27:21.477: W/System.err(25763): at android.os.Handler.dispatchMessage(Handler.java:95) 08-28 11:27:21.485: W/System.err(25763): at android.os.Looper.loop(Looper.java:136) 08-28 11:27:21.485: W/System.err(25763): at android.app.ActivityThread.main(ActivityThread.java:5139) 08-28 11:27:21.485: W/System.err(25763): at java.lang.reflect.Method.invokeNative(Native Method) 08-28 11:27:21.485: W/System.err(25763): at java.lang.reflect.Method.invoke(Method.java:515) 08-28 11:27:21.485: W/System.err(25763): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796) 08-28 11:27:21.485: W/System.err(25763): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612) 08-28 11:27:21.485: W/System.err(25763): at dalvik.system.NativeStart.main(Native Method) 08-28 11:27:21.485: W/System.err(25763): Caused by: org.jaudiotagger.audio.exceptions.UnableToCreateFileException: Cannot modify /storage/emulated/0/Music/01-Happy Christmas (War is Over) - John Lennon and Yoko Ono.mp3 because do not have permissions to modify file 08-28 11:27:21.485: W/System.err(25763): at org.jaudiotagger.tag.id…

http://stackoverflow.com/a/25390245
upvote count: 9
has body: If you're using Delphi 2009 or later (and hopefully later, because there was a serious bug in the original implementation) you can find the TDictionary class in the Generics.Collections unit. TDictionar&lt;TKey, TValue&gt; functions as a hash-map of keys to values, which should be exactly what you're looking for.
type: Answer
accepted answer of: http://stackoverflow.com/q/25390201
has comment: http://stackoverflow.com/comment/39612813
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39643401
downvote count: 0
has comment: http://stackoverflow.com/comment/39640940
score: 9
answers question: http://stackoverflow.com/q/25390201

http://stackoverflow.com/q/25428405
has body: I'm trying to make a little chat program for experimentation, but seeing as I'm not the best Java programmer, I don't know how to separate a port from an IP where they are both in the same string. This isn't super clear, but here's basically what I want to do. User enters IP and port in IP:Port format Scanner grabs it and puts it into a String Somehow put everything before the colon into a string and all numbers after the colon into an int. Any ideas on how to do this?
tagged with: string
has answer: http://stackoverflow.com/a/25429215
favorite count: 0
tagged with: ip
type: Question
has answer: http://stackoverflow.com/a/25428640
has answer: http://stackoverflow.com/a/25866412
has answer: http://stackoverflow.com/a/25428576
tagged with: port
tagged with: java
has answer: http://stackoverflow.com/a/25428588
answer count: 6
has answer: http://stackoverflow.com/a/25428545
linked to: http://stackoverflow.com/q/14882686
has comment: http://stackoverflow.com/comment/39669616
has title: Formatting IP:Port string to
downvote count: 0
upvote count: 1
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/39669573

http://stackoverflow.com/q/25478340
downvote count: 0
accepted answer: http://stackoverflow.com/a/25478354
has answer: http://stackoverflow.com/a/25478354
favorite count: 0
score: 11
type: AnsweredQuestion
tagged with: interface
tagged with: java
has body: I have 1) a basic interface, 2) a few classes that implement this interface, 3) and a generic class that I want to accept, as a parameter, any of the implementing classes I have tried the following: public class Foo extends Bar&lt;? extends SomeInterface&gt; { public Foo(List&lt;? extends SomeInterface&gt; someInterfaceList) { super(someInterfaceList); } ... } I receive the error No Wildcard Expected. Elsewhere in my code I have statements such as List&lt;? extends SomeInterface&gt; and I receive no errors, so why am I running into problems here? How can I fix this problem and still get the desired results? I have tried search 'No Wildcard Expected' and 'wildcard in class declaration' to no avail. Thanks in advance!
possible better answer: http://stackoverflow.com/a/25478429
tagged with: generics
upvote count: 11
has answer: http://stackoverflow.com/a/25478429
type: Question
answer count: 2
has title: Generic type in class declaration

http://stackoverflow.com/q/25493166
score: 0
has comment: http://stackoverflow.com/comment/39790720
has title: How to use method from other class in Activity
tagged with: java
has comment: http://stackoverflow.com/comment/39790744
has comment: http://stackoverflow.com/comment/39790777
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/6343166
favorite count: 0
type: Question
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/25493247
accepted answer: http://stackoverflow.com/a/25493203
has answer: http://stackoverflow.com/a/25493247
has answer: http://stackoverflow.com/a/25493203
has body: I have two Activity in my android app: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Connection.Response response = new Second().get(); } } and: public class Second extends Activity { Connection.Response response = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); get(); } public Connection.Response get() { try { response = Jsoup.connect("http://example.com").execute(); } catch (IOException e) { e.printStackTrace(); } return response; } } Second activity working ok - I use method get in my class and this is good, but if I open MainActivity I have errors: 08-25 19:31:30.764: E/AndroidRuntime(999): FATAL EXCEPTION: main 08-25 19:31:30.764: E/AndroidRuntime(999): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.js/com.example.js.MainActivity}: android.os.NetworkOnMainThreadException 08-25 19:31:30.764: E/AndroidRuntime(999): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955) 08-25 19:31:30.764: E/AndroidRuntime(999): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980) 08-25 19:31:30.764: E/AndroidRuntime(999): at android.app.ActivityThread.access$600(ActivityThread.java:122) 08-25 19:31:30.764: E/AndroidRuntime(999): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146) 08-25 19:31:30.764: E/AndroidRuntime(999): at android.os.Handler.dispatchMessage(Handler.java:99) 08-25 19:31:30.764: E/AndroidRuntime(999): at android.os.Looper.loop(Looper.java:137) 08-25 19:31:30.764: E/AndroidRuntime(999): at android.app.ActivityThread.main(ActivityThread.java:4340) 08-25 19:31:30.764: E/AndroidRuntime(999): at java.lang.reflect.Method.invokeNative(Native Method) 08-25 19:31:30.764: E/AndroidRuntime(999): at java.lang.reflect.Method.invoke(Method.java:511)…
type: AnsweredQuestion

http://stackoverflow.com/comment/39679678
type: QuestionComment
comment on: http://stackoverflow.com/q/25433587
score: 0
has text: Have you printed the `EditText` value to check if it has the right value?
type: Comment

http://stackoverflow.com/comment/39864003
comment on: http://stackoverflow.com/q/25533008
has text: public class RssReaderActivity extends ListActivity { private ArrayList<RSSItem> itemlist = null; private RSSListAdaptor rssadaptor = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); itemlist = new ArrayList<RSSItem>(); new RetrieveRSSFeeds().execute(); }
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25428360
answers question: http://stackoverflow.com/q/25428234
accepted answer of: http://stackoverflow.com/q/25428234
score: 3
has comment: http://stackoverflow.com/comment/39669649
upvote count: 3
type: Answer
has body: Integer.parseInt(cursor.getString(0)) this is the line that triggers the error. cursor.getString(0) returns null. Overall I would recommend you to substitute this line with the following: cursor.getInt(0). This, however, will still be throwing if the column is null, I suppose.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25545908
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39887337
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39887699
has body: 4.) Why m.put("first" , a) works? Because i am passing primitive variable and map's put() only accept Object. Autoboxing. int are automatically converted into Integer and vice-versa (with possible NullPointerException in this case) 3.) Why editor gives Unnecessary boxing to Integer. Because you don't need to write this piece of code. The compiler will do it for you. It is usually more readable 2.) If instead of Map, if there is any data structure like HashTable, then case is same??? Yes in JDK collections only work with Objects. It means that primitive types must be boxed. It has a small runtime cost and a huge memory overhead. An Integer take ~300% more memory than an int. You cannot escape it. The only way to avoid the boxing overhead is to use specialized collections like GNU trove which provide one class per primitive type. Only useful if you plan to store millions of primitive elements into a collection. And finally never ever write new Integer(x). Integer.valueOf(x) does the same thing but it maintains an internal cache to avoid creating new instances for some commonly used values.
answers question: http://stackoverflow.com/q/25545718

http://stackoverflow.com/comment/39889810
comment on: http://stackoverflow.com/q/25547365
type: QuestionComment
score: 0
type: Comment
has text: What "didn't work" about it? Can you be more specific? What you've got there looks right.

http://stackoverflow.com/comment/39804801
has text: does [this](http://stackoverflow.com/a/21709202/1777090) help? or [this](http://stackoverflow.com/questions/14588727/can-not-deserialize-instance-of-java-util-arraylist-out-of-value-string) and [this](http://stackoverflow.com/questions/8388656/java-json-jackson-nested-elements)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25500138

http://stackoverflow.com/comment/39845965
type: AnswerComment
has text: @Pavanraotk see [document](http://developer.android.com/reference/android/widget/LinearLayout.html#attr_android:orientation). That will explain clearly :) Basically, horizontal means put the views in one line, and whole line was being occupied by first textview only (as its size was match_parent). Got difference now?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25503520

http://stackoverflow.com/q/25410554
has answer: http://stackoverflow.com/a/25410622
type: AnsweredQuestion
answer count: 3
has comment: http://stackoverflow.com/comment/39637189
score: 1
tagged with: java
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has body: I am writing a class that has a static method that my colleagues will call in their client code. The method iterates over a bunch of files, changing their contents and their names. What I would like to do is return a single 'success/fail' value, and then a list (not necessarily a formal 'List') of the changes that were made to the files. What I have tried My current implementation is to build a TreeMap, where the key is an integer and the first value (at position 0) is 'success' or 'fail'. The remaining values (1 through N) are an ordered list of the changes that were made. My question If you were my (esteemed) colleague, would this returned data structure be a good idea to you? Is there something more elegant, a design pattern that fits this case? I would like to keep my methods static (per my company's standard for utilities), so I would like to avoid custom data structures/objects. Thanks very much.
possible better answer: http://stackoverflow.com/a/25410657
accepted answer: http://stackoverflow.com/a/25410774
has title: Best Data Structure for Returning Multiple Values from Static Method
has answer: http://stackoverflow.com/a/25410774
has answer: http://stackoverflow.com/a/25410657
tagged with: design-patterns

http://stackoverflow.com/comment/39842344
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25506913
score: 0
has text: Anyhow, this does not work even if I manually filter out the lock-children. This hangs up after 1-2 times of creating a node with different clients. Maybe I am running into an endless loop because acquiring and releasing a lock this way triggers the getChildren-watchers on all other clients, that also try to acquire a mutex and so on. When I remove the mutex, everything works as expected.

http://stackoverflow.com/comment/39647002
score: 0
type: QuestionComment
has text: Is there a symbolic link `libtesseract.so`?
type: Comment
comment on: http://stackoverflow.com/q/25404464

http://stackoverflow.com/q/25525746
type: Question
linked to: http://stackoverflow.com/q/24258951
has answer: http://stackoverflow.com/a/25821580
tagged with: spring-mvc
has body: I have implemented various Spring MVC REST endpoints to expose services that return a DeferredResult which is handed off to an Akka TypedActor to be completed. The application is deployed into a Glassfish 4 server. Generally the services execute and return as expected but I am intermittently receiving the following exception that occurs at the timeout interval I have specified: WARNING: Error invoking requestDestroyed method on ServletRequestListener org.jboss.weld.servlet.WeldListener java.lang.NullPointerException at org.jboss.weld.context.AbstractBoundContext.deactivate(AbstractBoundContext.java:71) at org.jboss.weld.context.http.HttpRequestContextImpl.deactivate(HttpRequestContextImpl.java:70) at org.jboss.weld.servlet.WeldListener.requestDestroyed(WeldListener.java:154) at org.apache.catalina.core.StandardContext.fireRequestDestroyedEvent(StandardContext.java:5261) at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:255) at org.apache.catalina.connector.Request.errorDispatchAndComplete(Request.java:4484) at org.apache.catalina.connector.Request.asyncTimeout(Request.java:4424) at org.apache.catalina.connector.Request.processTimeout(Request.java:4458) at org.apache.catalina.connector.Request.access$000(Request.java:156) at org.apache.catalina.connector.Request$6.onTimeout(Request.java:4302) at org.glassfish.grizzly.http.server.Response$SuspendTimeout.onTimeout(Response.java:2024) at org.glassfish.grizzly.http.server.Response$DelayQueueWorker.doWork(Response.java:2073) at org.glassfish.grizzly.http.server.Response$DelayQueueWorker.doWork(Response.java:2068) at org.glassfish.grizzly.utils.DelayedExecutor$DelayedRunnable.run(DelayedExecutor.java:158) 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:724) The servlet definition is my web.xml is as follows: DispatcherServlet org.springframew…
has comment: http://stackoverflow.com/comment/39858354
type: AnsweredQuestion
score: 0
has title: Spring MVC asynchronous request timing out intermittently when DeferredResult passed to an Akka actor
tagged with: akka
has comment: http://stackoverflow.com/comment/39884429
tagged with: java
has comment: http://stackoverflow.com/comment/39854873
tagged with: glassfish-4
answer count: 1
tagged with: asynchronous
accepted answer: http://stackoverflow.com/a/25821580

http://stackoverflow.com/q/25520847
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25520999
has answer: http://stackoverflow.com/a/25521007
favorite count: 0
has title: How to sort a Map in Java by its String keys which are numeric
type: Question
accepted answer: http://stackoverflow.com/a/25520971
downvote count: 0
possible better answer: http://stackoverflow.com/a/25521007
tagged with: dictionary
has answer: http://stackoverflow.com/a/25520971
has body: I have created a map called result. In the sortByKeys method as my keys are String with Numeric values, I have converted them to Integer key type Map then sorted them. The sorting is working fine when I am looping and printing individually, but not when I am setting them in another Map. public class TestDate { public static void main (String args[]){ Map&lt;String, String&gt; result = new HashMap&lt;String, String&gt;(); result.put("error", "10"); result.put("1","hii"); result.put("Update","herii"); result.put("insert","insert"); result.put("10","hiiuu"); result.put("7","hii"); result.put("21","hii"); result.put("15","hii"); Map&lt;String, String&gt; sorted = sortByKeys(result); //System.out.println(sorted); } private static Map&lt;String, String&gt; sortByKeys(Map&lt;String, String&gt; map) { Map &lt;Integer,String&gt; unSorted = new HashMap&lt;Integer, String&gt;(); Map &lt;String,String&gt; sorted = new HashMap&lt;String, String&gt;(); for (Map.Entry&lt;String, String&gt; entry : map.entrySet()) { try{ int foo = Integer.parseInt(entry.getKey()); unSorted.put(foo, entry.getValue()); }catch (Exception e){ } } Map&lt;Integer, String&gt; newMap = new TreeMap&lt;Integer, String&gt;(unSorted); Set set = newMap.entrySet(); Iterator iterator = set.iterator(); while(iterator.hasNext()) { Map.Entry me = (Map.Entry)iterator.next(); System.out.println(me.getKey()); System.out.println(me.getValue()); sorted.put(me.getKey().toString(), me.getValue().toString()); } System.out.println(sorted); return null; } } Here is the o/p : 1 hii 7 hii 10 hiiuu 15 hii 21 hii {21=hii, 10=hiiuu, 1=hii, 7=hii, 15=hii}
answer count: 3

http://stackoverflow.com/comment/39883973
type: Comment
has text: @BigbyWolf Also, are you sure that VTD-XML uses XPath 2.0? On the sourceforge page [here](http://vtd-xml.sourceforge.net/faq.html#Is_VTD-XML_conformant) I found: "VTD-XML fully conforms with W3C XPath 1.0 recommendation.". Is this outdated?
comment on: http://stackoverflow.com/a/25536187
score: 0
type: AnswerComment

http://stackoverflow.com/a/25540404
type: Answer
has body: 1/i will be 1 for i==1, and 0 for any i > 1 since you're using int. Hence, your result is 2. Use a double or float instead to do your calculations.
answers question: http://stackoverflow.com/q/25540377
score: 0

http://stackoverflow.com/a/25496730
upvote count: 2
has body: I just tested with some assumption, and it seems that the problem is related to integer overflow. I assume you defined NewFoodItem.date as int, instead of long. Hence, when you multiply the date * 1000 (both are int), it returns int. int d = 1409012824; // foodItem.date int d1000 = d * 1000; // returns 263550912 because of overflow, instead of 1409012824000 String date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") .format(new Date(d1000)); // returns 01/04/1970 08:42:30 When I try changing one of them to long, it behaves as expected // case 1 long d = 1409012824; long d1000 = d * 1000; // now returns 1409012824000 correctly String date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") .format(new Date(d1000)); // returns 08/26/2014 08:27:04 // case 2 int d = 1409012824; long d1000 = d * 1000L; // note the "L" suffix to indicate the number as long long d1000f = d * 1000; // FAIL, still returns 263550912 because of integer overflow String date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") .format(new Date(d1000)); // returns 08/26/2014 08:27:04 String date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") .format(new Date(d1000f)); // returns 01/04/1970 08:42:30 Generally when working with Date in Java, we define them as long since normally they are in millisecond. For easier maintenance, changing the type of NewFoodItem.date as long is the preferred one; much better if it's in millisecond also.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25496568
score: 2
answers question: http://stackoverflow.com/q/25496568
type: Answer
has comment: http://stackoverflow.com/comment/39797666

http://stackoverflow.com/a/25596631
score: 2
accepted answer of: http://stackoverflow.com/q/25546832
has comment: http://stackoverflow.com/comment/87980313
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/87963575
answers question: http://stackoverflow.com/q/25546832
has comment: http://stackoverflow.com/comment/87965048
type: Answer
has comment: http://stackoverflow.com/comment/87956185
has body: Take a look at the FindBugs Download site on SourceForge, which has all versions available. You would need version 2.0.3 of the Eclipse Plugin, which is here: http://sourceforge.net/projects/findbugs/files/findbugs%20eclipse%20plugin/2.0.3/
upvote count: 2

http://stackoverflow.com/a/25783841
accepted answer of: http://stackoverflow.com/q/25506133
has comment: http://stackoverflow.com/comment/40359419
score: 2
has body: I haven't used it that way myself, yet, but according to Guice's API documentation, I think you should be able to write something not much more than this once: bindListener(Matchers.subclassesOf(MyInterface.class), new TypeListener() { public &lt;I&gt; void hear(TypeLiteral&lt;I&gt; typeLiteral, TypeEncounter&lt;I&gt; typeEncounter) { myInterfaceBinder.addBinding().to(typeLiteral); } } Then, when you bind an implementation via bind(MyInterfaceImpl.class).asEagerSingleton(); it should be added to your multibinder automatically.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25506133
has comment: http://stackoverflow.com/comment/40353301
has comment: http://stackoverflow.com/comment/61798865
upvote count: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40326855

http://stackoverflow.com/a/25528244
has body: Using the previous answer as a base: try (Scanner scanner : new Scanner(new File("myfile.txt")) { List&lt;Long&gt; numbers = new ArrayList&lt;&gt;(); while (scanner.hasNextLong()) { numbers.add(scanner.nextLong()); } Long[] value = numbers.toArray(new Long[numbers.size()]); // or: long[] values = new long[numbers.size()]; int i = 0; for (Long n : numbers) { values[i] = n; ++i; } } The try-with-resources is used to close the Scanner, and the file, when you're done reading it. Scanner is a class that can read various thing, and among all, it can read Long. We need to store the values inside an ArrayList because we don't know the amount of number there are in the file. Converting the ArrayList is then a little tricky: With auto boxing Long can be converted to long (and long to Long), but that don't work for arrays: Long[] is not a long[]. The first form use the toArray method, which return an array of Long. The second form create an array of long[] and fill it with the numbers from the list using a for-each.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25527977

http://stackoverflow.com/comment/39655792
type: AnswerComment
comment on: http://stackoverflow.com/a/25418067
type: Comment
has text: I still don't know how to trace the exact reason of this, but we are guessing this is the problem of our IDE (STS, which might be a bit old in terms of eclipse version )
score: 0

http://stackoverflow.com/a/25418345
score: 4
has body: The long answer is, use DocumentFilter, see Implementing a Document Filter and DocumentFilter Examples for more details. The problem with this is, you need to take control, you can't rely on the "simple", "helper" functionality provided by JOptionPane.showInputDialog, as you need access to the text field been used to prompt the user... For example... The following examples uses a (slightly) modified version of the PatternFilter from DocumentFilter Examples import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.text.AbstractDocument; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.DocumentFilter; import javax.swing.text.DocumentFilter.FilterBypass; public class ValidateTest { public static void main(String[] args) { JTextField field = new JTextField(20); Pattern p = Pattern.compile("[0-9]+"); ((AbstractDocument) field.getDocument()).setDocumentFilter(new PatternFilter(p)); int option = ask("Enter number:", field); if (option == JOptionPane.OK_OPTION) { System.out.println("You have entered " + field.getText()); } } public static int ask(String label, JComponent comp) { JPanel panel = new JPanel(); panel.add(new JLabel(label)); panel.add(comp); return JOptionPane.showOptionDialog(null, panel, label, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); } public static class PatternFilter extends DocumentFilter { // Useful for every kind of input validation ! // this is the insert pattern // The pattern must contain all subpatterns so we can enter characters into a text component ! private Pattern pattern; public PatternFilter(Pattern p) { pattern = p; } public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException { String newStr = fb.getDocument().getText(0, …
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25418243
upvote count: 4

http://stackoverflow.com/comment/39878976
has text: `but I have to do it in the same method as the summing method` ... :)
comment on: http://stackoverflow.com/a/25541126
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25545141
answers question: http://stackoverflow.com/q/25544978
has body: You will have to override the adapter's getView method to implement your desired functioning: ArrayAdapter&lt;Students&gt; arrayAdapter = new ArrayAdapter&lt;Students&gt;( this, android.R.layout.simple_list_item_single_choice, studentList) { @Override public View getView(int position, View convertView, ViewGroup parent) { // Let the system create and re-use the views View view = super.getView(position, convertView, parent); // Get the default android layout's TextView TextView textView = (TextView) view.findViewById(android.R.id.text1); // Get the students info (name or w/e) Students student = getItem(position); String studentName = student.getName(); textView.setText(studentName); return view; } };
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25544978
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39851300
type: Comment
has text: An aside: Eclipse compiles this just fine, and using `o.<RuntimeException>orElseThrow(()...` solves the issue, however, this should not be necessary. (I think a similar issue was reported in another stackoverflow question a while ago, but I did not find it right now...)
type: QuestionComment
comment on: http://stackoverflow.com/q/25523375
score: 7

http://stackoverflow.com/a/25606479
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25488334
score: 0
answers question: http://stackoverflow.com/q/25488334
type: Answer
has body: Thanks for your answers. I created separate HTML page with html code above and inserted it to iframe.

http://stackoverflow.com/a/25550101
upvote count: 1
answers question: http://stackoverflow.com/q/25549670
score: 1
has body: you could try to open a stream: public static boolean exists(URL url) throws IOException { try { InputStream inputStream = url.openStream(); return inputStream != null; }catch (FileNotFoundException e){ return false; } } public static void main(String[] args) throws Exception { System.out.println(exists(new URL("https://www.google.de/images/srpr/logo11w.png"))); System.out.println(exists(new URL("https://www.google.de/images/srpr/foo.png"))); }
type: Answer
downvote count: 0

http://stackoverflow.com/a/29760019
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25406278
has body: That almost sounds like you are trying to re-invent DTLS. You are saying DTLS is problematic, but why is this? In theory your logic is sound though. It reminds me of DTLS with RSA key exchange: Client -> ClientHello (Share ClientRandom) Server -> ServerHello (Share ServerRandom) Server -> Certificate (Share certificate, containing server public key among other stuff) Client -> KeyExchange (Share Pre-Master Secret encrypted with server public key) Now both parties have: ClientRandom, ServerRandom which are public knowledge and Pre-Master Secret which has been shared over the network only with asymmetric encryption. Only the owner of the Certificate knows the private key required to decrypt Pre-Master Secret from the network communication so it is important that the Client verifies the Certificate the server sent. DTLS determines the method for generating Master Secret from Pre-Master Secret, ClientRandom and ServerRandom and the symmetric encryption/MAC keys from the Master Secret. DTLS uses Pre-Master Secret instead of directly sharing the Master Secret for modularity. From security stand point it should be equally secure to share Master Secret directly. The ClientRandom and ServerRandom are technically used as salt in the key generation. This guarantees that both participants get a say in the cryptographic security of the salt. Once the symmetric encryption keys are generated, the participants further verify that they can communicate using them before concluding the handshake. When using CBC the encrypted packets themselves are in the form of: [ IV ] + encrypted( [ Data blocks ] [ HMAC ] [ Padding ] ) Sending the Initialization vector with every packet adds some overhead to the transmission, but defends against some chosen plaintext attacks. However this is only one of the security measures against different attacks. There are a lot of different nuances in effective (D)TLS implementation: Ignoring or hiding error conditions, making sure operations take constant tim…
accepted answer of: http://stackoverflow.com/q/25406278
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25519401
accepted answer: http://stackoverflow.com/a/25520109
type: Question
has body: I wish to map a database view into a Java object using Hibernate but since I don't have an Id in my view, I can't do it. How do I set a column in my view as a primary key? @Entity @Table(name = "employmentinformationview") public class EmploymentInformationView implements Serializable { //@Id //No primary key @Column(name = "InfoID") private int infoId; @Column(name = "EmpID") private String empId; ... }
has answer: http://stackoverflow.com/a/25520109
has title: How to add primary key to a view?
type: AnsweredQuestion
score: 0
tagged with: sql
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: mysql

http://stackoverflow.com/a/44378079
type: Answer
answers question: http://stackoverflow.com/q/25441088
has comment: http://stackoverflow.com/comment/100638137
has body: Here is the simple solution by StreamEx: StreamEx.of(list).groupingBy(Function.identity(), MoreCollectors.countingInt()); This has the advantage of reducing the Java stream boilerplate code: collect(Collectors.
score: 6
has comment: http://stackoverflow.com/comment/114349303
upvote count: 7
downvote count: 1

http://stackoverflow.com/comment/39688281
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25438203
score: 9
has text: `x + (50 - (x % 50))`

http://stackoverflow.com/q/25464054
has title: How to disable the first item on a JComboBox
possible better answer: http://stackoverflow.com/a/25464995
tagged with: swing
score: -2
has comment: http://stackoverflow.com/comment/39736826
has body: I understand the question has been asked many times, but on a serious note. what is the easiest way to disable the first item of a JComboBox in Java. I have the following code and I want to disable "Select a State" so it forces the user to pick a state, if they don't then it prints a blank string states = new JComboBox&lt;String&gt;(new String[] {"Select a State", "AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA", "HI","ID","IL","IN","IA","KS","KY","LA","ME","MD", "MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ", "NM","NY","NC","ND","OH","OK","OR","PA","RI","SC", "SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"}); states.setEditable(false);
tagged with: jcombobox
type: AnsweredQuestion
answer count: 2
downvote count: 4
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25464321
tagged with: drop-down-menu
has answer: http://stackoverflow.com/a/25464995
has answer: http://stackoverflow.com/a/25464321
favorite count: 0
type: Question

http://stackoverflow.com/q/25499620
downvote count: 0
upvote count: 1
has title: How to solve org.hibernate.hql.ast.QuerySyntaxException: Exception
score: 1
tagged with: java
tagged with: hibernate
answer count: 1
has comment: http://stackoverflow.com/comment/39802364
tagged with: mysql
tagged with: hql
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/39802399
has comment: http://stackoverflow.com/comment/39802547
accepted answer: http://stackoverflow.com/a/25499705
has comment: http://stackoverflow.com/comment/39802425
has comment: http://stackoverflow.com/comment/39802794
has comment: http://stackoverflow.com/comment/39802427
type: AnsweredQuestion
has body: I want to retrieve a single value from database with hibernate query, Here is my java snippet String hql="select groupid from group_details where groupname= :groupname and clientid= :clientid"; Query query=session.createQuery(hql); query.setParameter(groupname, groupname); query.setParameter(clientid, clientid); int result = (int) query.uniqueResult(); System.out.println(result); I have a bean class GroupDetails which has setter and getter methods for fields. my mapping file is, groupDetails.hbm.xml in Hibernate conf file , I mapped above file, hibernate.cfg.xml <mapping resource="com/aurodisplay/its/xmlFiles/groupDetails.hbm.xml"/> I am getting following error , org.hibernate.hql.ast.QuerySyntaxException: group_details is not mapped [select groupid from group_details where groupname= :groupname and clientid= :clientid] org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158) org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87) org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70) org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:257) org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056) org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945) org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688) org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544) org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281) org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229) org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228) org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160) org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111) org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77) Can anyone help me in this please.
has answer: http://stackoverflow.com/a/25499705

http://stackoverflow.com/comment/39610645
score: 0
type: Comment
type: AnswerComment
has text: @spynoble, why are you talking about a DefaultTableModel? You are using DBUtils which returns you a TableModel so you can't override any of its methods. I don't use an IDE, so I can't advise you how to extend a class in Netbeans, although I'm sure that is possible in the IDE or the IDE would not be very useful. My advice is to not use the IDE. Instead create the GUI code yourself and just use the IDE to debug the code. Spend your time learning Java, not the IDE.
comment on: http://stackoverflow.com/a/25396017

http://stackoverflow.com/comment/39807353
type: QuestionComment
score: 0
has text: possible duplicate of [What is a NullPointerException, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it)
comment on: http://stackoverflow.com/q/25501155
type: Comment

http://stackoverflow.com/comment/39898157
type: Comment
score: 0
type: AnswerComment
has text: Also by your suggestion if you could point to some tutorials that would really help.
comment on: http://stackoverflow.com/a/25535977

http://stackoverflow.com/comment/83714208
has text: @AndreasZock I used this method, but after I unpause, my actor moves faster then before, What I want is, it should stop moving for some time and when I unpause it start moving with same configurations as before. am I missing anything? did it work for you?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25549630
type: Comment

http://stackoverflow.com/a/25518699
has body: Assuming that setDead is a nonprivate virtual method, you'll want to look for the invokevirtual opcode*. However, since there are multiple method calls in the function, you'll need to disambiguate by function called, which means looking up the associated constant pool index. Hopefully whatever tool or framework you're using has helper code to do this for you. If setDead is private, you'll want invokespecial instead. If for some reason it's static (yes you can call static methods via this if you want to), then you'll need to look for invokestatic instead.
type: Answer
has comment: http://stackoverflow.com/comment/39847855
score: 0
answers question: http://stackoverflow.com/q/25518499

http://stackoverflow.com/comment/39731875
type: Comment
type: AnswerComment
has text: I looked at beans earlier but I didn't think they would serve my purpose. Using a bean will allow me to only use `get` and `set` operations, but what if I want more functionality? For e.g., I might want to perform an arbitrary method `foo` on some `myObject`. Or even `Foo` on fields of `myObject`.
comment on: http://stackoverflow.com/a/25461555
score: 0

http://stackoverflow.com/q/25518240
has comment: http://stackoverflow.com/comment/39837676
answer count: 4
has comment: http://stackoverflow.com/comment/39868067
upvote count: 2
has answer: http://stackoverflow.com/a/25518656
has comment: http://stackoverflow.com/comment/39837565
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39868497
has answer: http://stackoverflow.com/a/25518683
has comment: http://stackoverflow.com/comment/39837884
downvote count: 1
favorite count: 0
type: Question
has body: In Java, what is the difference between instance of a class and Object of a class. For a class A, Take a look : line 1 : A a; // Declaring a reference variable of class A Line 2 : a = new A();// Instantiating an object of class A So....can the line 2 also be : // Instantiating an instance of class A which mean Instance and Object are absolutely the same thing ? Please give an objective answer than subjective.
has comment: http://stackoverflow.com/comment/39837578
has title: Difference between an Instance and Object in Java
has answer: http://stackoverflow.com/a/25518537
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39838087
has answer: http://stackoverflow.com/a/25518291

http://stackoverflow.com/q/25490514
upvote count: 2
type: UnansweredQuestion
answer count: 1
downvote count: 0
tagged with: cluster-computing
has answer: http://stackoverflow.com/a/25512823
has body: I am configuring cluster which group of managed server in console. I have 2 managed server: Managed_server_name listen_address listen_port ip_address m1 slc001.us.xxx.com 7001 10.1.1.1 m2 slc002.us.xxx.com 7002 10.1.1.2 So I created a cluster and added the two managed server to this cluster, the cluster message mode is unicast, now how do I configure cluster address? I have three options, which is correct one? slc001.us.xxx.com:7001,slc002.us.xxx.com:7002 10.1.1.1:7001,10.1.1.2:7002 10.1.1.1,10.1.1.2
favorite count: 0
tagged with: weblogic
tagged with: weblogic12c
tagged with: java
has title: how to configure cluster address in weblogic
tagged with: deployment
type: Question
score: 2

http://stackoverflow.com/q/25548808
type: AnsweredQuestion
has title: how to select group by LEFT(t.field, 6) in HQL?
has answer: http://stackoverflow.com/a/25548852
accepted answer: http://stackoverflow.com/a/25548852
tagged with: sql
tagged with: java
answer count: 1
tagged with: mysql
tagged with: hql
score: 0
type: Question
has body: Clean SQL syntax (MySQL) allows to select with "group by LEFT(...)" Example: SELECT * FROM `table` t WHERE t.field1 = 777 AND t.field2 = 0 GROUP BY LEFT(t.field3, 6) HAVING COUNT(*) = 4; But if I try to use HQL: " select t from TableEntity t " + " where t.field1 = :field_1 and t.field2 = :field_2 " + " group by LEFT(t.field3, 6) " + " having COUNT(*) = :other_condition " I got an exeption org.hibernate.hql.ast.QuerySyntaxException: unexpected token: LEFT near line 1, column 12 [ Is it possible to use HQL in this case?

http://stackoverflow.com/comment/39747481
score: 2
has text: Hibernate should translate the criteria to SQL using the appropriate dialect for your database. Maybe you've configured it to use the Oracle dialect instead of the MySQL dialect. Post your JPA/Hibernate configuration(s).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25469858

http://stackoverflow.com/q/25501373
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25695372
answer count: 2
upvote count: 2
tagged with: jdatechooser
downvote count: 0
linked to: http://stackoverflow.com/q/18820257
possible better answer: http://stackoverflow.com/a/25504577
tagged with: swing
has body: I want to disable multiple date ranges on a JCalendar. I'm following these steps, but I need to know how can I add multiple date evaluators. Help me please, thanks. Update: I don't know why I can't disable the dates on my JCalendar. I will leave my code here so you guys can check it. This is my RangeEvaluator class, modified from this class. class RangeEvaluator implements IDateEvaluator { private DateUtil dateUtil = new DateUtil(); @Override public boolean isSpecial(Date date) { return false; } @Override public Color getSpecialForegroundColor() { return null; } @Override public Color getSpecialBackroundColor() { return null; } @Override public String getSpecialTooltip() { return null; } @Override public boolean isInvalid(Date date) { return dateUtil.checkDate(date); // if the given date is in the range then is invalid } /** * Sets the initial date in the range to be validated. * @param startDate */ public void setStartDate(Date startDate) { dateUtil.setMinSelectableDate(startDate); } /** * @return the initial date in the range to be validated. */ public Date getStartDate() { return dateUtil.getMinSelectableDate(); } /** * Sets the final date in the range to be validated. * @param endDate */ public void setEndDate(Date endDate) { dateUtil.setMaxSelectableDate(endDate); } /** * @return the final date in the range to be validated. */ public Date getEndDate() { return dateUtil.getMaxSelectableDate(); } @Override public String getInvalidTooltip() { return null; } @Override public Color getInvalidBackroundColor() { return null; } @Override public Color getInvalidForegroundColor() { return null; } } Here is how I am using the RangeEvaluator class: RangeEvaluator evaluator = new RangeEvaluator(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd-mm-yyyy"); evaluator.setStartDate(dateFormat.parse("11-09-2014")); evaluator.setEndDate(dateFormat.parse("15-09-2014")); jCalendar1.getDayChooser().addDateEvaluator(evaluator); Am I missing something?. Help me please, Thanks.
has title: Disable multiple date ranges jDateChooser
tagged with: jcalendar
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/25504577
accepted answer: http://stackoverflow.com/a/25695372

http://stackoverflow.com/comment/39797342
has text: subList() return a list
comment on: http://stackoverflow.com/a/25495877
type: Comment
type: AnswerComment
score: 0

indexing
tags question: http://stackoverflow.com/q/25415210
tag name: indexing
type: Tag
tags question: http://stackoverflow.com/q/25452584
tags question: http://stackoverflow.com/q/25521190
tags question: http://stackoverflow.com/q/25535769
tags question: http://stackoverflow.com/q/25497093
tags question: http://stackoverflow.com/q/25479199

http://stackoverflow.com/comment/39802139
type: Comment
comment on: http://stackoverflow.com/a/25488507
score: 0
type: AnswerComment
has text: OK that does it then :) Thanks.

http://stackoverflow.com/q/25475963
tagged with: return
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25476067
score: 0
has title: Compile time error when retrieving objects from return values in a different class.
answer count: 1
has comment: http://stackoverflow.com/comment/39758434
has comment: http://stackoverflow.com/comment/39758418
tagged with: arraylist
tagged with: object
accepted answer: http://stackoverflow.com/a/25476067
type: Question
has body: I am receiving a compile time error with the following code. The first code block scans in a text file and provides a get method for retrieving the largest value in the Array List. That block of code compiles fine. The second block of code is where I'm having difficulty. I'm fairly new to programming and am having difficulty understanding where I've made my error. public class DataAnalyzer { public DataAnalyzer(File data) throws FileNotFoundException { { List&lt;Integer&gt; rawFileData = new ArrayList&lt;&gt;(); FileReader file = new FileReader("info.txt"); try (Scanner in = new Scanner(file)) { while(in.hasNext()) { rawFileData.add(in.nextInt()); } } } } public int getLargest(List&lt;Integer&gt; rawFileData){ return Collections.max(rawFileData); } } This is the Tester Class I am attempting to implement. I am receiving a compile time error. public class DataAnalyzerTester { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("Enter your fileName: "); } public void printLargest(DataAnalyzer rawFileData) { rawFileData.getLargest(); System.out.println(rawFileData.getLargest()); } }
tagged with: java
tagged with: methods

http://stackoverflow.com/q/25433587
type: Question
has answer: http://stackoverflow.com/a/25433657
has title: Cannot figure out parselong and strings (Android app)
type: UnansweredQuestion
tagged with: android
score: -1
has body: I have read alot of the questions regarding this subject and everything I have read seems to indicate I am doing the correct thing, but still the problem remains (frustrated). I am having a user enter a edit text value to use for a countdown timer that I know needs a long (primitive) variable. So I used Long.pasreLong(Stringvarible) to get the long. This isnt working. I have added a try catch and it seems to be indicating there is a problem with the parsing, but I cannot figure out the issues. See the section of code below: editText_Time.setOnEditorActionListener(new OnEditorActionListener(){ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean handled = false; if (actionId == EditorInfo.IME_ACTION_DONE|| actionId == EditorInfo.IME_ACTION_SEARCH || event.getAction() == KeyEvent.ACTION_DOWN &amp;&amp; event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { startTime_String = editText_Time.getText().toString(); //Something's wrong with the parse long portion startTime_Long = Long.parseLong(startTime_String); // try { // startTime_Long = Long.parseLong(startTime_String); // } catch (NumberFormatException e) { // System.out.println("NumberFormatException: " + e.getMessage()); // } startTime = startTime_Long; countDownTimer = new MyCountDownTimer(startTime, interval); return false; } return handled; } });
has comment: http://stackoverflow.com/comment/39679678
tagged with: android-edittext
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39898781
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39624010
type: QuestionComment
comment on: http://stackoverflow.com/q/25403293
has text: Where you define `List<OneComment> data`?
score: 0
type: Comment

http://stackoverflow.com/comment/39657699
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25406889
has text: Added info to the answer with regards to your additional question, does it answer it?
score: 0

http://stackoverflow.com/q/25447548
downvote count: 0
tagged with: grails
type: AnsweredQuestion
tagged with: missingmethodexception
tagged with: groovy
has title: Groovy/Grails - Jollyday CalenderUtil - No signature of method
has body: I have a little problem with my project: URI /TimeKeeper/calendar/show Class groovy.lang.MissingMethodException Message No signature of method: static de.jollyday.util.CalendarUtil.create() is applicable for argument types: (java.util.GregorianCalendar) values: [java.util.GregorianCalendar[time=1406897280000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2014,MONTH=7,WEEK_OF_YEAR=31,WEEK_OF_MONTH=0,DAY_OF_MONTH=1,DAY_OF_YEAR=213,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=2,HOUR_OF_DAY=14,MINUTE=48,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600000]] Possible solutions: create(), create(java.util.Calendar), create(int, de.jollyday.config.Fixed), create(int, int, int), create(int, int, int, org.joda.time.Chronology), grep() And thats my code where the exception is thrown: import static java.util.Calendar.* import de.jollyday.* import de.jollyday.util.* class DayReport { def day def records def getHolidayName() { def m = HolidayManager.getInstance(HolidayCalendar.GERMANY) def holidays = m.getHolidays(day.get(YEAR), 'nw') holidays.find { CalendarUtil.create(day) == it.date }?.description } def isHoliday() { def m = HolidayManager.getInstance(HolidayCalendar.GERMANY) def create = CalendarUtil.create(day) println "DayReport isHoliday: ${create.getClass()}" m.isHoliday(create, 'nw') } ... Can somebody tell me what is wrong? Thanks :)
score: 1
accepted answer: http://stackoverflow.com/a/25502358
tagged with: java
answer count: 1
tagged with: gregorian-calendar
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25502358

http://stackoverflow.com/comment/39752153
type: QuestionComment
has text: Your SQL query should be returning the data ordered by `title`. Something else would seem to be the problem.
comment on: http://stackoverflow.com/q/25472511
score: 0
type: Comment

http://stackoverflow.com/a/25540774
has comment: http://stackoverflow.com/comment/39879685
downvote count: 0
has comment: http://stackoverflow.com/comment/39879326
has comment: http://stackoverflow.com/comment/39879681
has comment: http://stackoverflow.com/comment/39879643
has comment: http://stackoverflow.com/comment/39878414
score: 3
has comment: http://stackoverflow.com/comment/39879948
has body: Something like... System.out.println(String.format("%-4s %s:", "XXXX", "词语")); System.out.println(String.format("%-4s %s:", "YY", "词语")); Which prints XXXX 词语: YY 词语: Or System.out.println(String.format("%4s %s:", "XXXX", "词语")); System.out.println(String.format("%4s %s:", "YY", "词语")); Which prints XXXX 词语: YY 词语: You could then wrap this into a method call and pass the prefix and the suffix to to do the formatting for you For example... public class Test1 { public static void main(String[] args) { System.out.println(formatLeftAligned("XXXX", "词语")); System.out.println(formatLeftAligned("YY", "词语")); System.out.println(formatRightAligned("XXXX", "词语")); System.out.println(formatRightAligned("YY", "词语")); } public static String formatLeftAligned(String prefix, String suffix) { return String.format("%-4s %s:", prefix, suffix); } public static String formatRightAligned(String prefix, String suffix) { return String.format("%4s %s:", prefix, suffix); } } Or public class Test1 { public static void main(String[] args) { System.out.println(formatLeftAligned("XXXX", 4, "词语")); System.out.println(formatLeftAligned("YY", 4, "词语")); System.out.println(formatRightAligned("XXXX", 4, "词语")); System.out.println(formatRightAligned("YY", 4, "词语")); } public static String formatLeftAligned(String prefix, int padding, String suffix) { return String.format("%-" + padding + "s %s:", prefix, suffix); } public static String formatRightAligned(String prefix, int padding, String suffix) { return String.format("%" + padding + "s %s:", prefix, sufix); } } If you want more control over the padding...You could even use varargs for the methods allow the format methods to determine the padding amount it self, and return an array of Strings formatted to these requirements, as an idea Updated If you need both the suffix and prefix to be padded, it might be easier to pad them separately, for example... public class Test1 { public static void main(String[] args) { System.out.println(String.format("%s…
has comment: http://stackoverflow.com/comment/39880608
has comment: http://stackoverflow.com/comment/39878394
has comment: http://stackoverflow.com/comment/39878875
has comment: http://stackoverflow.com/comment/39878968
answers question: http://stackoverflow.com/q/25540723
type: Answer
has comment: http://stackoverflow.com/comment/39880884
has comment: http://stackoverflow.com/comment/39879261
has comment: http://stackoverflow.com/comment/39879597
has comment: http://stackoverflow.com/comment/39879508
has comment: http://stackoverflow.com/comment/39879943
upvote count: 3
has comment: http://stackoverflow.com/comment/39880727
has comment: http://stackoverflow.com/comment/39879766
has comment: http://stackoverflow.com/comment/39880690

http://stackoverflow.com/a/25479124
type: Answer
has body: You can't use a PhoneLookup in this case. You need to query Phone.CONTENT_URI to obtain the ID that matches up with the contact picker. The following code below does exactly this. Cursor cur = getContentResolver().query( Phone.CONTENT_URI, new String[] { Phone.DISPLAY_NAME, Phone._ID }, Phone.NORMALIZED_NUMBER + "=?", new String[] { ... //phone number placed here }, null); if (!cur.moveToFirst()) return; String id = cur.getString(cur.getColumnIndex(Phone._ID)));
accepted answer of: http://stackoverflow.com/q/25476420
score: 0
answers question: http://stackoverflow.com/q/25476420
type: AcceptedAnswer

http://stackoverflow.com/comment/43510810
type: Comment
comment on: http://stackoverflow.com/a/25633424
score: 2
type: AnswerComment
has text: How do you disable the check in sonar?

http://stackoverflow.com/comment/39627724
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25402441
has text: Still I think the cleanest way would be to have a Factory for the class in Spring, which could inject further dependencies in the class.
type: QuestionComment

http://stackoverflow.com/a/25528316
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25527476
has body: I should've read the docs more carefully. There is a getWindow()-method, which allows me to centre the dialog manually. However, I think this should be default behaviour.. here's a quick and dirty way to centre any dialog: public static final class Utils { public static Stage getStage() { return StageHelper.getStages().get(0); } public static void centre(Dialog dialog) { Window window = dialog.getWindow(); Stage scene = Utils.getStage(); double x = scene.getX() + scene.getWidth() / 2 - window.getWidth() / 2; double y = scene.getY() + scene.getHeight() / 2 - window.getHeight() / 2; window.setX(x); window.setY(y); } } ... Platform.runLater(() -&gt; { Utils.centre(dialog); } dialog.show();
answers question: http://stackoverflow.com/q/25527476

http://stackoverflow.com/comment/39642023
comment on: http://stackoverflow.com/a/25412845
type: Comment
has text: Apparently I'm just dense. I went to the directory and typed: `javac -classpath.hello.java java hello` I tried to type `java hello` on a new line but terminal obviously tries to run when I hit enter.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39862870
has text: And the line `LdapConnection connection = new LdapNetworkConnection("172.16.1.8", 636, true);` is what you have in your `Account.java` on line 123?
comment on: http://stackoverflow.com/q/25505141
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/25409459
type: AnsweredQuestion
score: 3
answer count: 3
possible better answer: http://stackoverflow.com/a/25409789
has comment: http://stackoverflow.com/comment/39635177
has answer: http://stackoverflow.com/a/25409779
tagged with: java
has title: Java: Nested classes, interfaces Vs Package
has answer: http://stackoverflow.com/a/25409789
accepted answer: http://stackoverflow.com/a/25409833
type: Question
has body: I was reading nested classes will enable group classes &amp; interfaces logically. I feel this we can achieve using package as well by placing related classes in a package. If this is the case, where exactly the Nested class and Nested interface come into play? When should we consider using them?
upvote count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25409833
favorite count: 0

http://stackoverflow.com/comment/39732983
score: 1
type: Comment
type: QuestionComment
has text: Now is the perfect time to learn using a debugger.
comment on: http://stackoverflow.com/q/25462198

http://stackoverflow.com/q/25480442
tagged with: java
tagged with: hibernate
score: 4
has body: I have been trying a Dropwizard project using Maven. I can run hello world programs. When I tried to run database program using Hibernate, I got an error like below when running the program using java -jar. default configuration has the following errors: * database.driverClass may not be null (was null) * database.url may not be null (was null) * database.user may not be null (was null) * template may not be empty (was null) This is my hello-world.yml file template: Hello, %s! defaultName: Stranger database: driverClass: com.mysql.jdbc.Driver user: root password: url: jdbc:mysql://localhost/test Thanks in advance !!
upvote count: 4
type: AnsweredQuestion
answer count: 2
tagged with: dropwizard
has title: Hibernate database connection error in Maven Dropwizard
downvote count: 0
tagged with: maven
possible better answer: http://stackoverflow.com/a/33839712
accepted answer: http://stackoverflow.com/a/25500964
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25500964
has answer: http://stackoverflow.com/a/33839712

http://stackoverflow.com/q/25428759
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/31161209
tagged with: java
has title: Connection to MongoDB by SSH in Java
answer count: 1
tagged with: ssh
favorite count: 0
type: Question
upvote count: 4
score: 4
tagged with: mongodb
has body: To connect to MongoDB from Java I use: MongoClient mongoClient = new MongoClient("localhost", port); And it works fine. Now I would like to connect to MongoDB which is on machine where I have to login by SSH. I try to use JSch for this, here is my code: String host = "host"; String user = "user"; String password = "pass"; int port = 22; int tunnelLocalPort = 3309; String tunnelRemoteHost = "host"; int tunnelRemotePort = 3306; JSch jsch = new JSch(); Session session = jsch.getSession(user, host, port); session.setPassword(password); localUserInfo lui = new localUserInfo(); session.setUserInfo(lui); session.connect(); session.setPortForwardingL(tunnelLocalPort, tunnelRemoteHost, tunnelRemotePort); Everything looks fine, I can connect, but here is a problem: MongoClient mongoClient = new MongoClient("localhost", 27020); List&lt;String&gt; databaseNames = mongoClient.getDatabaseNames(); LOG.info("DB names=" + databaseNames); And error is: Aug 21, 2014 4:12:29 PM com.mongodb.DBTCPConnector initDirectConnection Warnung: Exception executing isMaster command on localhost/127.0.0.1:27020 java.io.IOException: couldn't connect to [localhost/127.0.0.1:27020] bc:java.net.ConnectException: Connection refused: connect at com.mongodb.DBPort._open(DBPort.java:214) Should I set something more to connect? How can I check from Java that program connects, when I check session.isConnected() output is true. When I use PuTTY everything works fine.
accepted answer: http://stackoverflow.com/a/25459661
downvote count: 0
has answer: http://stackoverflow.com/a/25459661
tagged with: jsch
has comment: http://stackoverflow.com/comment/109303709

http://stackoverflow.com/comment/39691863
comment on: http://stackoverflow.com/q/25440427
has text: JTextArea is designated for plain text, use JLabel instead
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25510982
type: Question
type: UnansweredQuestion
upvote count: 5
tagged with: jdbc
score: 4
has answer: http://stackoverflow.com/a/26152792
has comment: http://stackoverflow.com/comment/39824342
has comment: http://stackoverflow.com/comment/39825121
has title: How does jdbc truncate numeric values?
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39824864
has body: If I have an SQL column which has a scale of 2. How does JDBC handle truncating values which has more than 3 digits after the separator? Example: insert value 2.989 becomes 2.98 in Sybase or 2.99 in Oracle depending on the SQL provider. How does JDBC handle that?
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39824667

http://stackoverflow.com/comment/39922206
type: QuestionComment
comment on: http://stackoverflow.com/q/25546879
has text: can you post the link to that following-question
score: 0
type: Comment

http://stackoverflow.com/q/25440562
has answer: http://stackoverflow.com/a/25440634
has answer: http://stackoverflow.com/a/25440639
has comment: http://stackoverflow.com/comment/39692258
score: -1
has comment: http://stackoverflow.com/comment/39692248
has answer: http://stackoverflow.com/a/25440622
accepted answer: http://stackoverflow.com/a/25440622
linked to: http://stackoverflow.com/q/19162331
has comment: http://stackoverflow.com/comment/39692108
tagged with: type-conversion
linked to: http://stackoverflow.com/q/738629
type: AnsweredQuestion
has body: This piece of code is giving the result I wanted double a=Math.random()*100; int b=(int)a; System.out.println(b); but when I did for the same thing this way, it is giving zero always int a=(int)Math.random()*100; System.out.println(a); As far as I know typecasting will store the bigger data-type to small. but in the later code, I'm gettig zero every single time I run the program.
downvote count: 4
has answer: http://stackoverflow.com/a/25440777
possible better answer: http://stackoverflow.com/a/25440639
duplicate of: http://stackoverflow.com/q/19162331
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39692115
has answer: http://stackoverflow.com/a/25440608
answer count: 7
has title: Cast problems between int and double
has answer: http://stackoverflow.com/a/25440594
has answer: http://stackoverflow.com/a/25440879
has comment: http://stackoverflow.com/comment/39692144
favorite count: 0
type: Question

http://stackoverflow.com/a/25548472
has comment: http://stackoverflow.com/comment/89915791
type: Answer
has body: You can use a Semaphore, as follows: private static Semaphore semaphore = new Semaphore(1); public void doSomeChangesTo(JSONObject json) { try { semaphore.acquire(); // doSomeChangesTo } finally { semaphore.release(); } }
answers question: http://stackoverflow.com/q/25548192
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/89857423
downvote count: 0

http://stackoverflow.com/comment/39842487
score: 0
has text: @Divya yes do as like this http://www.webspeaks.in/2012/08/upload-files-from-android-to-server.html Another solution is that upload image using MultipartEntity
type: Comment
comment on: http://stackoverflow.com/a/25499373
type: AnswerComment

http://stackoverflow.com/a/25478465
downvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25478444
answers question: http://stackoverflow.com/q/25478444
score: -3
type: Answer
has body: If I change the class Cougar to public class Cougar extends Feline { public String type = "c "; // &lt;-- shadow Feline's type. public void hh() { super.hh(); // this.type = "c "; System.out.print("CCCCC " + this.type + super.type); } } Then I get the output you seem to expect of FFFFF CCCCC c f Instead of the output your code produces (which was) FFFFF CCCCC c c This is not the OO way to do things, because Cougar is-a Feline. The behaviour you see (of the value changing in the super class) is because of that relationship. Finally, to keep the values distinct you would need to shadow the Feline type as above.
upvote count: 0

http://stackoverflow.com/q/25411743
score: 0
answer count: 1
type: Question
tagged with: spring-mvc
tagged with: spring-boot
has body: I have followed the Spring example Serving Mobile Web Content with Spring MVC and got it working. Now I would like to replace greeting.html with a simple static page (and replace Thymeleaf with a simpler view handler). What is the easiest approach in this particular case? I am new to Java, the probable solutions in web use web.xml, whereas this example does not use web.xml and it does not seem to be the recommended approach in Spring Boot documentation either. So, use @EnableAutoConfiguration with some overriding? How?
tagged with: java
has answer: http://stackoverflow.com/a/25419143
has title: How to override AutoConfiguration in Spring?
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25419143

http://stackoverflow.com/comment/39760440
comment on: http://stackoverflow.com/q/25477015
type: QuestionComment
has text: Please always post critical information in your question itself, not as a comment.
type: Comment
score: 0

http://stackoverflow.com/q/25459797
answer count: 1
tagged with: memcached
type: Question
tagged with: spymemcached
accepted answer: http://stackoverflow.com/a/25461761
has answer: http://stackoverflow.com/a/25461761
has body: I have observed that the spymemcached client communicate with memcached server very fast. I googled the sample implementations, but not found. Only the theoretical documentations. Has any one got sample source (code, any other supporting jars) which explain how data transfer happens in java?
type: AnsweredQuestion
score: 0
tagged with: java
has title: How to use Memcache Protocal

http://stackoverflow.com/a/25482172
has body: After reading this article you can deserialize it in this way: ObjectMapper mapper = new ObjectMapper(); JsonFactory f = new JsonFactory(); JsonParser jp = f.createParser(JSON); //Skip all tokens before start array token. while (jp.nextToken() != JsonToken.START_ARRAY) { } MapType mapType = mapper.getTypeFactory().constructMapType(Map.class, String.class, String.class); while (jp.nextToken() != JsonToken.END_ARRAY) { Map&lt;String, String&gt; map = mapper.readValue(jp, mapType); System.out.println(map); } Next option is to use JsonNode: ObjectMapper mapper = new ObjectMapper(); JsonNode rootNode = mapper.readTree(JSON); JsonNode arrayNode = rootNode.get("jsonAry"); Iterator&lt;JsonNode&gt; jsonNodeIterator = arrayNode.elements(); while (jsonNodeIterator.hasNext()) { JsonNode itemNode = jsonNodeIterator.next(); Iterator&lt;String&gt; fieldNames = itemNode.fieldNames(); while (fieldNames.hasNext()) { String field = fieldNames.next(); System.out.println(field + " = " + itemNode.get(field)); } } If your JSON is not big, you can deserialize it to POJOs. Example: class JsonRoot { @JsonProperty("jsonAry") private List&lt;JsonEntity&gt; entities; public List&lt;JsonEntity&gt; getEntities() { return entities; } public void setEntities(List&lt;JsonEntity&gt; entities) { this.entities = entities; } @Override public String toString() { return "JsonRoot{" + "entities=" + entities + '}'; } } class JsonEntity { private Map&lt;String, String&gt; values = new LinkedHashMap&lt;String, String&gt;(); public Map&lt;String, String&gt; getValues() { return values; } @JsonAnySetter public void setValues(String key, String value) { values.put(key, value); } @Override public String toString() { return "JsonEntity{" + "values=" + values + '}'; } } And deserializing is looking like this: ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.readValue(JSON, JsonRoot.class));
answers question: http://stackoverflow.com/q/25480478
score: 0
type: Answer

http://stackoverflow.com/comment/39768376
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25481330
has text: Add jar file containing `org.hibernate.dialect.MYSQLDialect`...

http://stackoverflow.com/q/25402726
accepted answer: http://stackoverflow.com/a/25405343
tagged with: client-server
has comment: http://stackoverflow.com/comment/39622432
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39623341
has answer: http://stackoverflow.com/a/25405343
has comment: http://stackoverflow.com/comment/39622520
has comment: http://stackoverflow.com/comment/39621794
answer count: 1
has comment: http://stackoverflow.com/comment/39622019
has body: I already referred this link Sending files using POST with HttpURLConnection Using the following code, I'm trying to POST a file to local PHP server. It always return file size 0 in my PHP file public class FileUpload2 { String CRLF = "\r\n"; /** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { new FileUpload2().put("http://localhost/test/test.php"); } public void put(String targetURL) throws Exception { String BOUNDRY = "=================================="; HttpURLConnection conn = null; try { // These strings are sent in the request body. They provide // information about the file being uploaded String contentDisposition = "Content-Disposition: form-data; name=\"userfile\"; filename=\"test.txt\""; String contentType = "Content-Type: application/octet-stream"; // This is the standard format for a multipart request StringBuffer requestBody = new StringBuffer(); requestBody.append("--"); requestBody.append(BOUNDRY); requestBody.append(CRLF); requestBody.append(contentDisposition); requestBody.append(CRLF); requestBody.append(contentType); requestBody.append(CRLF); requestBody.append("Content-Transfer-Encoding: binary" + CRLF); requestBody.append(CRLF); requestBody.append(new String(getFileBytes("test.txt"))); requestBody.append("--"); requestBody.append(BOUNDRY); requestBody.append("--"); requestBody.append(CRLF); // Make a connect to the server URL url = new URL(targetURL); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); conn.setUseCaches(false); conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDRY); conn.setRequestProperty("Cache-Control", "no-cache"); // Send the body DataOutputStream dataOS = new DataOutputStream( conn.getOutputStream()); dataOS.writeBytes(requestBody.toString()); dataOS.flush(); dataOS.close(); // Ensure we got the HTTP 200 response code int…
has comment: http://stackoverflow.com/comment/39624237
type: Question
has comment: http://stackoverflow.com/comment/39621765
linked to: http://stackoverflow.com/q/11766878
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39621895
tagged with: httpurlconnection
has title: POST File with HttpURLConnection to PHP
tagged with: http
tagged with: post

http://stackoverflow.com/a/25417759
has comment: http://stackoverflow.com/comment/39650670
has comment: http://stackoverflow.com/comment/39668210
has comment: http://stackoverflow.com/comment/39650669
has comment: http://stackoverflow.com/comment/39650602
has comment: http://stackoverflow.com/comment/39650815
type: Answer
has comment: http://stackoverflow.com/comment/39650629
has comment: http://stackoverflow.com/comment/39651010
score: 2
has body: In Java, everything is passed by value. For reference types, the value passed happens to be an object reference. The problem you run into is that start = "changed" is assigning your method's start variable a new String object reference, while pclass still has the old String object reference. Incidentally, String objects are immutable and can't be modified.
has comment: http://stackoverflow.com/comment/39651233
answers question: http://stackoverflow.com/q/25417730
upvote count: 2
downvote count: 0

http://stackoverflow.com/a/25525007
has comment: http://stackoverflow.com/comment/39849126
answers question: http://stackoverflow.com/q/25524794
has comment: http://stackoverflow.com/comment/39849195
score: 0
has body: You should not put a unique constraint on your foreign key. The foreign key models a one-to-many relation ship. While your parent-objects may only have one user, the same user may be related to many different parent objects. Thus, there will not necessarily be only one row in your parent object table for one userId.
has comment: http://stackoverflow.com/comment/39849208
type: Answer

http://stackoverflow.com/a/25453980
has comment: http://stackoverflow.com/comment/39717743
has comment: http://stackoverflow.com/comment/39717770
score: 1
has body: You're not checking the result of CountDownLatch.await(). So if it returns because of the timeout (i.e. if it returns false), the producer threads have not finished their job, and you can't access the list safely. The CountDownLatch class offers visibility guarantees, if used properly.
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39717916
has comment: http://stackoverflow.com/comment/39717645
answers question: http://stackoverflow.com/q/25453917
type: Answer
has comment: http://stackoverflow.com/comment/39717803

http://stackoverflow.com/q/25542514
downvote count: 0
answer count: 1
has body: I have question about invoking method count() in following sample jOOQ statement: create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count()) .from(AUTHOR) .join(BOOK).on(AUTHOR.ID.equal(BOOK.AUTHOR_ID)) .where(BOOK.LANGUAGE.eq("DE")) .and(BOOK.PUBLISHED.gt(date("2008-01-01"))) .groupBy(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) .having(count().gt(5)) .orderBy(AUTHOR.LAST_NAME.asc().nullsFirst()) .limit(2) .offset(1) .forUpdate() .of(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) I have tried to create mechanism like this to invoke method without using object/class reference, but I have given up. Is it really possible to achieve it? Thanks for help. Wicia
favorite count: 0
tagged with: jooq
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: invoke
tagged with: sql
tagged with: java
tagged with: methods
has title: jOOQ - method invoking
has answer: http://stackoverflow.com/a/25550493
accepted answer: http://stackoverflow.com/a/25550493
type: Question

http://stackoverflow.com/comment/39918642
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25546678
has text: What is your flush mode?

http://stackoverflow.com/q/25439914
tagged with: servlets
type: Question
has body: I have servlet calling in ajax call. It send json object in response. Now I have receive this json in jsp and place data in table format. Can someone help me in this. Here is my code, I am calling servlet as, xmlHttpReqRM.open('POST', "RTMobitor?rtype=rmonitor", true); my servlet, Here vehicleList is a list object latlng.setLng(resultSet.getString("lng")); latlng.setStatus(resultSet.getString("status")); latlng.setRdate(resultSet.getString("rdate")); latlng.setRtime(resultSet.getString("rtime")); vehicleList.add(latlng); System.out.println(vehicleList); String json = new Gson().toJson(vehicleList); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(json); Previously I was sending response as a text, it was easy but now I changed to json. I am not getting how to receive, xmlHttpReqRM.onreadystatechange = function() { if (xmlHttpReqRM.readyState == 4) { if (xmlHttpReqRM.status == 200) { var responceeString = xmlHttpReqRM.responseText; // How to replace this ajax code for json document.getElementById("flexme1").innerHTML = (responceeString); } else { alert('ERR OR: AJAX request status = ' + xmlHttpReqRM.status); } How can I replace this ajax code for json. Can anyone help me in this please.
score: 0
has comment: http://stackoverflow.com/comment/39691012
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39691065
answer count: 1
tagged with: jquery
has title: How to retrieve json object in ajax onreadystatechange function
has comment: http://stackoverflow.com/comment/39691128
tagged with: ajax
has answer: http://stackoverflow.com/a/25439947
has comment: http://stackoverflow.com/comment/39691214
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39691187

http://stackoverflow.com/comment/39838512
score: 0
comment on: http://stackoverflow.com/a/25518441
type: Comment
type: AnswerComment
has text: Okay sure! Thanks for the tips. Gonna do more research on it!

http://stackoverflow.com/comment/39678564
comment on: http://stackoverflow.com/a/25433040
type: Comment
score: 0
type: AnswerComment
has text: now, its working untill the build and packaging with maven. But, its not starting the jar!

http://stackoverflow.com/comment/39658302
type: QuestionComment
has text: idk, but do you commit between creating the database and adding records?
score: 0
comment on: http://stackoverflow.com/q/25422226
type: Comment

http://stackoverflow.com/comment/39730133
type: Comment
has text: Thanks buddy let me try with it
type: AnswerComment
comment on: http://stackoverflow.com/a/25460591
score: 0

http://stackoverflow.com/comment/51745089
score: 0
type: AnswerComment
has text: Does Quartz add anything useful to what's already there with Spring? Just wondering...
comment on: http://stackoverflow.com/a/25501556
type: Comment

http://stackoverflow.com/q/25462719
has comment: http://stackoverflow.com/comment/39734002
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39733911
tagged with: java
has comment: http://stackoverflow.com/comment/39734283
has body: I have AsyncTask that get a List of Images and upload them one by one to DropBox, and display notification with progress. public UploadImages(Context context, DropboxAPI&lt;?&gt; api, String dropboxPath, List&lt;MyImages&gt; imgList) { .. .. } It is working O.K, I call it from my mainThread in my main Activity : UploadImages uploadImages = new UploadImages(this, mApi, IMAGES_DIR, listOfImages); upload.execute(); I want that my app once a day (even if my App is closed) would download a list of images from DropBox and upload those images that written in file (if they exist on my device). How can I implement it? I thought about set an Alarm to start IntentService that will download this list, and in that IntentService to parse it and call to my UploadImages AsynTask with the parsed list...Can I do it? I understand that calling to AsynTask is done from mainThread, and I will call it from IntetService. Does it the right to use for that an IntentService (it work for 1-3 min) ?
type: Question
tagged with: android-service
has title: Calling an existing AsynTask from IntentService when App is closed
type: UnansweredQuestion
tagged with: android
tagged with: intentservice

http://stackoverflow.com/comment/39774966
type: Comment
comment on: http://stackoverflow.com/q/25485091
has text: What kind of conlfict occurrs? IMO the class MyTest shouldn't even be visible outside ouf interface Test2.
score: 0
type: QuestionComment

http://stackoverflow.com/a/25527591
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25494191
answers question: http://stackoverflow.com/q/25494191
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39861078
has body: Just to expand a bit on the topic. The feature You are looking for is indeed Modality Worklist or MWL for short. It is a service, that dcm4chee server can provide and the modality (imaging equipment) has to be setup to query the service for worklist entries. However there is another side to it - getting the orders in to dcm4chee. This is usually done by sending HL7 order messages from a HIS or RIS to dcm4chee. I don't see a way to manually input worklist entries into dcm4chee. This would also not be a very useful feature, since it would just shift the manual typing work from the modality to dcm4chee administration panel. In the HIS/RIS there should usually be all the relevant information already available and it's just a matter of configuring the HL7 messages to sent. (If Your HIS/RIS does support HL7 messaging. Could be, that it doesn't have support for that, if it has not been needed before and is a custom built in-house system or something) So in short - You need to get orders in HL7 format into dcm4chee and then they will be available in worklist to be queried by a modality. The HL7 part might actually be the more difficult part.

http://stackoverflow.com/a/25473871
downvote count: 0
score: 2
has body: This block is always executed: ...finally{ System.out.println(errorMessage); } If your errorMessage has not been assigned any other value before (ie. no exception thrown in your try clause) - System.out.println will print you the errorMessage value which is null.
has comment: http://stackoverflow.com/comment/39754734
answers question: http://stackoverflow.com/q/25473850
type: Answer
has comment: http://stackoverflow.com/comment/39754605
has comment: http://stackoverflow.com/comment/39754673
upvote count: 2

http://stackoverflow.com/comment/39605428
has text: As I stated already in the question: but then others would have to setup this in their settings.xml as well. That would be ugly I think. Or is this possible in the pom.xml too?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25393435

http://stackoverflow.com/comment/39619565
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25394609
has text: @khmarbaise, perhaps I can reword to the question to state that `2.2.x` is *nice to have* since still a lot of people are using it.
score: 0

http://stackoverflow.com/comment/39868887
type: Comment
type: AnswerComment
has text: I just got it working with the same thing and have edited your reply. Thank you for your help.
score: 0
comment on: http://stackoverflow.com/a/25535318

http://stackoverflow.com/q/25393406
has title: How to add domain to Google Cloud Storage object ACL at creation?
type: Question
tagged with: google-app-engine
type: UnansweredQuestion
tagged with: google-cloud-storage
has body: In my Java based app-engine project, i allow users to upload files to google cloud store (this works), but i can't seem to add a specific domain to the access list, so that only people from within my company can access my files. How do i do this? i tried using: GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance()); GcsFilename gcsFileName = new GcsFilename("my-bucket", user_uploaded_file_name); Builder fileOptionsBuilder = new GcsFileOptions.Builder(); fileOptionsBuilder.mimeType(mimeType); fileOptionsBuilder.acl("authenticated-read"); // how do i modify this list? GcsFileOptions fileOptions = fileOptionsBuilder.build(); GcsOutputChannel outputChannel = gcsService.createOrReplace(gcsFileName, fileOptions); and this authenticated-read just makes the file public (not what i want). i want to add everyone from the organization "@mycompany.com" to the access list. do i do this through code? or do i do this using the google cloud console? I will be providing people the links to files they upload via this url: String url = https://console.developers.google.com/m/cloudstorage/b/" + "my-bucket" + "/o/" + user_uploaded_file_name;
tagged with: acl
score: 2
upvote count: 2
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/13616007
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25395581

http://stackoverflow.com/comment/39748558
has text: post `mathsgameresults.xml`
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25470536

http://stackoverflow.com/comment/39702810
type: QuestionComment
comment on: http://stackoverflow.com/q/25446314
has text: @Bathsheba, this is actually an external XSL file that is passed as command line param to Saxon jar.
score: 0
type: Comment

http://stackoverflow.com/q/25464893
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25464920
downvote count: 0
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25464910
type: Question
has comment: http://stackoverflow.com/comment/39738061
linked to: http://stackoverflow.com/q/1482395
accepted answer: http://stackoverflow.com/a/25464918
has body: I've tried to throw the same excpetion in a finally block, while the previously throwed expcetion was not catched. I expected that we have two object of Excpetion type that shal be thrown. Since we need in two catch clauses as the following: public static void main(String[] args) { try { try { try { throw new Exception(); } finally { System.out.println("finally"); throw new Exception(); } } catch (Exception ex) { System.out.println("catch"); } finally { System.out.println("finally"); } } catch (Exception ex) { System.out.println("catch"); } System.out.println("finish"); } But that program prints: finally catch finally finish That is, the second catch clause was not entered. Why?
answer count: 3
tagged with: exception
has comment: http://stackoverflow.com/comment/39738047
linked to: http://stackoverflow.com/q/12641834
has answer: http://stackoverflow.com/a/25464918
tagged with: java
has comment: http://stackoverflow.com/comment/39738014
possible better answer: http://stackoverflow.com/a/25464910
has title: Throw an exception in the finally block
favorite count: 0

http://stackoverflow.com/comment/39906025
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25470915
type: QuestionComment
has text: i agree with user. if it is eclipse, check your compiler settings. if compile settings are ok, just try clean/rebuild as a sanity check. if you are using maven, check your pom java dependency as well as JAVA_HOME for maven.

user-interface
tags question: http://stackoverflow.com/q/25502796
tags question: http://stackoverflow.com/q/25510330
tags question: http://stackoverflow.com/q/25504664
tags question: http://stackoverflow.com/q/25429816
tags question: http://stackoverflow.com/q/25536031
tags question: http://stackoverflow.com/q/25454794
tags question: http://stackoverflow.com/q/25437673
tags question: http://stackoverflow.com/q/25475972
tags question: http://stackoverflow.com/q/25517675
tags question: http://stackoverflow.com/q/25454551
tags question: http://stackoverflow.com/q/25477663
tags question: http://stackoverflow.com/q/25535277
tags question: http://stackoverflow.com/q/25428523
tags question: http://stackoverflow.com/q/25502552
type: Tag
tags question: http://stackoverflow.com/q/25410758
tags question: http://stackoverflow.com/q/25394366
tags question: http://stackoverflow.com/q/25494732
tags question: http://stackoverflow.com/q/25456843
tags question: http://stackoverflow.com/q/25467703
tags question: http://stackoverflow.com/q/25467866
tags question: http://stackoverflow.com/q/25496558
tags question: http://stackoverflow.com/q/25412620
tag name: user-interface
tags question: http://stackoverflow.com/q/25429087
tags question: http://stackoverflow.com/q/25426441
tags question: http://stackoverflow.com/q/25469583
tags question: http://stackoverflow.com/q/25543936
tags question: http://stackoverflow.com/q/25496420
tags question: http://stackoverflow.com/q/25442821
tags question: http://stackoverflow.com/q/25461953
tags question: http://stackoverflow.com/q/25522340

http://stackoverflow.com/a/25511783
has comment: http://stackoverflow.com/comment/39869050
has comment: http://stackoverflow.com/comment/39867688
type: Answer
has comment: http://stackoverflow.com/comment/39867997
has comment: http://stackoverflow.com/comment/39868966
has comment: http://stackoverflow.com/comment/39868267
has comment: http://stackoverflow.com/comment/39860200
has comment: http://stackoverflow.com/comment/39867483
answers question: http://stackoverflow.com/q/25508845
has comment: http://stackoverflow.com/comment/39834284
downvote count: 0
upvote count: 1
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25508845
has body: It looks as though the package-info.java (that contains the @XmlSchema annotation) file that was generated along with the other model files from the XML Schema is not being compiled. Update I am running OSGi and using Java SE You should make sure you import the javax.xml.bind package in your manifest. Their can be ClassLoader issues with javax classes in OSGi environments.
has comment: http://stackoverflow.com/comment/39864722

http://stackoverflow.com/comment/39928546
comment on: http://stackoverflow.com/q/25549423
type: Comment
type: QuestionComment
has text: As suggested in [Concurrency in JavaFX, Cancelling the Task](http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm) you should properly handle _InterruptedException_ by checking _isCancelled_ and break the loop if it returns true.
score: 0

http://stackoverflow.com/comment/39753699
comment on: http://stackoverflow.com/q/25473192
score: 0
has text: @EdwinDalorzo that used to work only if the project was compiled with debug info enabled. I'm not sure if that still is the case.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25546161
has body: By Default, it will not write those messages into a log file. You will have to specify a file Handler to which the log messages to write. Handler handler = new FileHandler("logfile.log", size, rt_cnt); Logger.getLogger("").addHandler(handler); Based on the file name and location which you are providing in the FileHandler constructor, it will create the file and write the message
has comment: http://stackoverflow.com/comment/39888215
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25545861
has comment: http://stackoverflow.com/comment/39887895
answers question: http://stackoverflow.com/q/25545861
score: 1

http://stackoverflow.com/a/25412639
has body: I would expect to help catch areas where the developer's unit tests were incomplete. As developers, we all have our blind spots when it comes to writing unit tests or running ad-hoc tests.
answers question: http://stackoverflow.com/q/25412556
score: 0
type: Answer

http://stackoverflow.com/q/25451316
tagged with: jelastic
type: Question
has answer: http://stackoverflow.com/a/25455844
has title: Best configuration for a multiapp-one db scenario on Jelastic
type: UnansweredQuestion
tagged with: tomcat
has body: I'm approaching the deployment of 4 Java webapps that share a common database. I wonder what is the best scenario to do that under the Jelastic platform: 5 environments, 5 nodes (4 tomcat and 1 db) 1 environment, 5 nodes (4 tomcat and 1 db) 1 environment, 2 nodes (1 tomcat managing all the 4 webapps, plus the 2nd node for the db) other mixed combinations Please consider that the webapps need to be served as virtual hosts and share lots of common files on the filesystem, too. TIA
score: 0
tagged with: java
answer count: 1
tagged with: deployment

http://stackoverflow.com/comment/39858669
score: 1
type: QuestionComment
has text: I've just solve the problem using StAX. I got the concrete XML and then I have created unmarshalling using JAX-B
comment on: http://stackoverflow.com/q/25528977
type: Comment

http://stackoverflow.com/q/25429570
has comment: http://stackoverflow.com/comment/39831650
tagged with: java
downvote count: 0
has body: I have a editable combobox which contains data from a mysql table. What I want to do is when entering a value in the combobox it should show me the possibilities. f.e.: column1 E120 E110 O100 So when I am entering "E" in the combobox there should be displayed a list of the two values. E120 E110 And also it should be not possible to enter "E121". Which methode I can use to do this? thanks
score: 1
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25430217
type: Question
has answer: http://stackoverflow.com/a/25430217
possible better answer: http://stackoverflow.com/a/25429747
has title: display list of possibilities by entering value in combobox/choice Java
tagged with: combobox
has answer: http://stackoverflow.com/a/25429747
tagged with: listview
type: AnsweredQuestion
answer count: 2

http://stackoverflow.com/q/25548874
accepted answer: http://stackoverflow.com/a/25554608
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25554608
tagged with: java
has comment: http://stackoverflow.com/comment/39893855
answer count: 1
tagged with: gradle
has body: I have a dependency in my gradle build script: apply plugin 'war' dependencies { compile 'com.github.jsimone:webapp-runner:7.0.22' } when creating a war, is there way a task createWebappRunnerJar could create a jar from given remote sources? I was looking at http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.bundling.Jar.html but I don't think it was meant to be used for remote sources. The webapp-runner is built into the war, maybe there's a way to copy it out of the war somehow, if it can't be built from remote sources? In maven the following does the same: org.apache.maven.plugins maven-dependency-plugin 2.3 package copy com.github.jsimone webapp-runner 7.0.22 webapp-runner.jar
type: Question
has title: create additional jar when building war

http://stackoverflow.com/a/25403418
answers question: http://stackoverflow.com/q/25403093
type: Answer
has comment: http://stackoverflow.com/comment/39623163
accepted answer of: http://stackoverflow.com/q/25403093
has comment: http://stackoverflow.com/comment/39623190
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39623228
has body: Try this. Split the input into a character array and print each one. Scanner scanner = new Scanner(System.in); String text = scanner.next(); char[] characters = text.toCharArray(); //create character array of letters int square = 80; //length of box if (square &gt; 0) { int index = 0; for (int i = 0; i &lt; square; i++) { for (int j = 0; j &lt; square; j++) { if (i == 0 || j == 0 || i == square - 1 || j == square - 1) System.out.print(&quot;*&quot;); else { if (index &lt; characters.length &amp;&amp; index &lt; square * square) //if index in bounds System.out.print(characters[index++]); //print next letter else { System.out.print(&quot; &quot;); //else whitespace } } } System.out.println(); } }
score: 2

http://stackoverflow.com/a/43687707
answers question: http://stackoverflow.com/q/25526611
score: 2
upvote count: 2
downvote count: 0
has body: For me it was much simple solution. I forgot to close brackets in my SwaggerUI request like that: { "jobGroup": "Authorizer-CCC", "jobName": "Authorizer-2NO5-101"
type: Answer

http://stackoverflow.com/comment/39818915
type: AnswerComment
comment on: http://stackoverflow.com/a/25507891
score: 0
type: Comment
has text: The message is clear. It indicates that I simply forgot to make this class implement the ActionListener interface. Fixed now.

http://stackoverflow.com/q/25519543
has title: Shortcuts in eclipse
score: 1
possible better answer: http://stackoverflow.com/a/25519570
tagged with: java
tagged with: eclipse
favorite count: 0
has answer: http://stackoverflow.com/a/25519568
type: Question
has answer: http://stackoverflow.com/a/25519582
downvote count: 0
has body: Is there any keyboard(mouse) shortcut in eclipse to check: From which class a particular method has been called(i.e. navigating from called class to calling class). which class(es) has extended a particular class(i.e. navigating from parent class to child class). Thanks in advance.
upvote count: 1
tagged with: keyboard-shortcuts
has answer: http://stackoverflow.com/a/25519570
accepted answer: http://stackoverflow.com/a/25519568
type: AnsweredQuestion
answer count: 3

http://stackoverflow.com/a/25422359
has body: In addition to @Ray answer, you should use db's system date like, Query q = super.getEntityManager() .createQuery("select t from MyTable as t where extract(month from t.myDate) = SQL('(SELECT extract(month from SYSDATE) FROM DUAL)') ");
has comment: http://stackoverflow.com/comment/39661876
has comment: http://stackoverflow.com/comment/39662821
has comment: http://stackoverflow.com/comment/39659300
has comment: http://stackoverflow.com/comment/39665653
upvote count: 1
has comment: http://stackoverflow.com/comment/39662783
has comment: http://stackoverflow.com/comment/39659694
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/25421865
has comment: http://stackoverflow.com/comment/39662896
type: Answer
has comment: http://stackoverflow.com/comment/39691518

http://stackoverflow.com/comment/39625791
type: AnswerComment
comment on: http://stackoverflow.com/a/25404671
score: 0
has text: the "OR" solution will not work since base class for `EventListArrayAdapter` is `ArrayAdapter<String>` and `values` is type of `List<Venue>`
type: Comment

http://stackoverflow.com/q/25540636
has answer: http://stackoverflow.com/a/25540762
tagged with: android
tagged with: java
tagged with: regex
possible better answer: http://stackoverflow.com/a/25541262
answer count: 4
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25540775
has answer: http://stackoverflow.com/a/25541262
linked to: http://stackoverflow.com/q/776826
upvote count: 2
downvote count: 0
has title: Java Regex - Trying to isolate text from a line that starts with a certain string?
has body: EDIT: MAKE SURE YOU CALL Matcher#matches or Matcher#find before trying to use group! Source I'm trying to do something very simple - I'm trying to get the text from a line that starts with a word. In this case, the word is Location:. I'm reading from raw HTML so the line of interest actually looks like this: Location: Main Hall Obviously, I want Main Hall returned to me so I can read the location for my application. This is what I've tried: String t_location = ""; Pattern t_pat = Pattern.compile("^[\\s]+?(?s)Location: (?-s)(.*)$"); Matcher t_match = t_pat.matcher(t_inner_html); t_location = t_match.group(0); But I keep getting the error: java.lang.IllegalStateException: No successful match so far Breaking down my Regex, this is what (I think) I'm doing: ^ - Read from the beginning of the line [\\s]+? - With a reluctant qualifier, read the whitespace at the beginning of the line until we hit something else (?s)Location: (?-s) - The literal string "Location: " is read (.*)$ - Read characters (except newlines) until the end of the line That is what I THINK I'm doing. I'm not so good at Regex, but I've tried to follow the documentation to no avail. Can someone please help me? For example purposes, the String t_inner_html looks like this: 8/28/2014 Alumni Reunion Location: Main Hall &lt;span class="extra-info"&gt; Blah blah blah.... &lt;/span&gt;
accepted answer: http://stackoverflow.com/a/25540797
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25540797

http://stackoverflow.com/comment/39898440
type: AnswerComment
comment on: http://stackoverflow.com/a/25484123
score: 0
type: Comment
has text: @Ash The term "walltime" is just meant in a descriptive way standing for a simple analogue clock on the wall. Like the type "PlainTime", it has NO reference to any timezone in internal state. Well, I should really find time to write a good tutorial about the library. Although there are many classes, it is not necessary to learn all of them. Often, just apply the same schematic approach starting with the four basic types (PlainXYZ or Moment), and the IDE will tell you by code completion what you can do. A tutorial should show this simplicity in usage.

http://stackoverflow.com/q/25512890
tagged with: jboss7.x
has title: Package external jars in mdb jar
type: Question
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39827512
has comment: http://stackoverflow.com/comment/39831583
score: 0
answer count: 0
has body: I developed MDB (say mymdb.jar) using Maven/Eclipse and I am deploying it in JBOSS 7.2. It works. But, when I add have external jars such as http client 4.3.4, maven compiles it but these external jars are not packaged with the existing mymdb.jar mdb.jar contains com/test/MyMDB META-INF/MANIFEST.MF META-INF/ejb-jar.xml META-INF/jboss-ejb3.xml META-INF/maven How do I have maven package external jars such as http-client-4.3.4.jar and reference it from my application. Note: This is not a .war or .ear file. It is a .jar with a MDB that implements onMessage method
linked to: http://stackoverflow.com/q/574594

file
tags question: http://stackoverflow.com/q/25541454
tags question: http://stackoverflow.com/q/25445657
type: Tag
tags question: http://stackoverflow.com/q/25540751
tags question: http://stackoverflow.com/q/25467579
tags question: http://stackoverflow.com/q/25516503
tags question: http://stackoverflow.com/q/25496766
tags question: http://stackoverflow.com/q/25405405
tags question: http://stackoverflow.com/q/25391459
tags question: http://stackoverflow.com/q/25502203
tags question: http://stackoverflow.com/q/25549638
tags question: http://stackoverflow.com/q/25526712
tags question: http://stackoverflow.com/q/25480708
tags question: http://stackoverflow.com/q/25433547
tags question: http://stackoverflow.com/q/25396662
tags question: http://stackoverflow.com/q/25434148
tags question: http://stackoverflow.com/q/25550772
tags question: http://stackoverflow.com/q/25493095
tags question: http://stackoverflow.com/q/25484660
tags question: http://stackoverflow.com/q/25501961
tags question: http://stackoverflow.com/q/25477507
tags question: http://stackoverflow.com/q/25394365
tag name: file
tags question: http://stackoverflow.com/q/25453404
tags question: http://stackoverflow.com/q/25399310
tags question: http://stackoverflow.com/q/25512333
tags question: http://stackoverflow.com/q/25424597
tags question: http://stackoverflow.com/q/25451818
tags question: http://stackoverflow.com/q/25536449
tags question: http://stackoverflow.com/q/25422244
tags question: http://stackoverflow.com/q/25413131
tags question: http://stackoverflow.com/q/25403420
tags question: http://stackoverflow.com/q/25486471
tags question: http://stackoverflow.com/q/25472186
tags question: http://stackoverflow.com/q/25404527
tags question: http://stackoverflow.com/q/25548192
tags question: http://stackoverflow.com/q/25436895
tags question: http://stackoverflow.com/q/25453186
tags question: http://stackoverflow.com/q/25540734

http://stackoverflow.com/a/25476089
score: 0
has comment: http://stackoverflow.com/comment/39758746
has body: There is no Button with id = button_main_activity in your layout, so mainActivity field is null when you try to use it in setLayoutTypoGraphy method
type: Answer
has comment: http://stackoverflow.com/comment/39774905
answers question: http://stackoverflow.com/q/25476054
has comment: http://stackoverflow.com/comment/39758809
has comment: http://stackoverflow.com/comment/39758785

http://stackoverflow.com/q/25435941
upvote count: 2
has title: jetty request log rotation - size-based
type: UnansweredQuestion
downvote count: 0
tagged with: jetty
tagged with: logging
has answer: http://stackoverflow.com/a/61420554
answer count: 3
tagged with: java
has body: I need to setup the jetty-requests logs to rotate the logs based on size rather than time. Is there a way to achieve this? I've read the documentation on http://wiki.eclipse.org/Jetty/Howto/Configure_Request_Logs but to no avail. Any ideas? Thanks, Vladimir
has answer: http://stackoverflow.com/a/25451194
favorite count: 0
type: Question
score: 2
has answer: http://stackoverflow.com/a/25494815

http://stackoverflow.com/q/25510096
tagged with: java
has comment: http://stackoverflow.com/comment/39822334
has body: I used the following code to calculate the Fibonacci sequence out to an arbitrarily large digit. The code worked as expected until I asked it to call the function 4,000,000 times (previously I only did a few hundred) and the computer ran for a little while, then the console in Eclipse generated the exceptions which I pasted below the code. My question is what happened here exactly? Did my computer run completely out of memory or memory allocated to the thread? If so, why did it stop at this digit specifically? Additional: How would I calculate further digits of the Fibonacci Sequence? import java.math.BigInteger; public class fibonacci2 { public static void main(String[] args) { calculate(p,q); } static long i = 0; static BigInteger p = BigInteger.valueOf(0); static BigInteger q = BigInteger.valueOf(1); static BigInteger temp = BigInteger.valueOf(1); public static void calculate(BigInteger s,BigInteger t){ while(i&lt;4000000){ System.out.printf("%d\t%d\n", p, i); temp = p; p = p.add(q); q = temp; i++; calculate(p,q); } } } Exceptions: Exception in thread "main" java.lang.StackOverflowError at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715) at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556) at java.util.regex.Pattern$Branch.match(Pattern.java:4502) at java.util.regex.Pattern$Branch.match(Pattern.java:4500) at java.util.regex.Pattern$Branch.match(Pattern.java:4500) at java.util.regex.Pattern$BranchConn.match(Pattern.java:4466) at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615) at java.util.regex.Pattern$Curly.match0(Pattern.java:4177) at java.util.regex.Pattern$Curly.match(Pattern.java:4132) at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556) at java.util.regex.Pattern$Branch.match(Pattern.java:4502) at java.util.regex.Pattern$Branch.match(Pattern.java:4500) at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715) at java.util.regex.Pattern$Start.match(Pattern.java:3408) at java.util.regex.Matcher.search(Matc…
favorite count: 0
type: Question
tagged with: fibonacci
has title: Why does BigInteger end up with StackOverflowError in Java at 19635th the integer in Fibonacci Sequence
possible better answer: http://stackoverflow.com/a/25510201
accepted answer: http://stackoverflow.com/a/25510133
has answer: http://stackoverflow.com/a/25510201
score: 4
upvote count: 4
tagged with: stack-overflow
has answer: http://stackoverflow.com/a/25512648
type: AnsweredQuestion
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25510133
tagged with: biginteger

http://stackoverflow.com/comment/39862058
type: AnswerComment
has text: @user Which library are you using? I might have gotten them wrong. Also, what does _is not working_ mean? Does it throw an exception? Does it return `null`?
comment on: http://stackoverflow.com/a/25531547
type: Comment
score: 0

http://stackoverflow.com/comment/39837348
type: AnswerComment
has text: Sorry for the short explanation I will post some code for you in the morning. But the short of it would be to override onResume using the override/ implement choice from right clicking in your activity file. Then select onResume() from the wizard. And move your media playback instantiation into the onResume so you don't get null pointer and playback resumes when the activity resumes
type: Comment
comment on: http://stackoverflow.com/a/25518008
score: 0

http://stackoverflow.com/a/57055891
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: I use this code for List: List&lt;Integer&gt; numbers = Stream.of(reader.readLine().split("\\s+")).map(Integer::valueOf).collect(Collectors.toList()); And it is almost the same for array: int[] numbersArray = Arrays.stream(reader.readLine().split("\\s+")).mapToInt(Integer::valueOf).toArray();
answers question: http://stackoverflow.com/q/25491997

http://stackoverflow.com/q/25493288
has comment: http://stackoverflow.com/comment/43299340
answer count: 2
score: 1
tagged with: java
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has body: OkHttp version: 2.0.0 I've received the following exception stack trace through Google Play: java.lang.IllegalStateException: Cannot stream a request body without chunked encoding or a known content length! at com.squareup.okhttp.internal.http.HttpTransport.createRequestBody(HttpTransport.java:68) at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:254) at com.squareup.okhttp.Call.getResponse(Call.java:198) at com.squareup.okhttp.Call.access$200(Call.java:36) at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:143) at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:848) This is exactly how requests are made: Request.Builder requestBuilder = new Request.Builder(); requestBuilder.addHeader("User-Agent", userAgent); requestBuilder.addHeader("Accept", "application/hal+json"); requestBuilder.url(transformedURL); RequestBody requestBody = body == null ? null : RequestBody.create(MediaType.parse("application/json"), gson.toJson(body)); requestBuilder.method(method, requestBody); okHttpClient.newCall(requestBuilder.build()).enqueue(new com.squareup.okhttp.Callback() { ... At first it seemed related to this bug, but it's already been fixed. Also, we've tested POST requests with an empty body several times during development. This app only does GET and POST requests. What could have possibly led to this error?
type: UnansweredQuestion
has title: 2.0.0: IllegalStateException: Cannot stream a request body without chunked encoding or a known content length
has answer: http://stackoverflow.com/a/25497282
tagged with: okhttp
has answer: http://stackoverflow.com/a/39100633

http://stackoverflow.com/q/25533449
has answer: http://stackoverflow.com/a/61266224
tagged with: sql
has comment: http://stackoverflow.com/comment/39865574
tagged with: java
tagged with: hibernate
has body: I'm getting a weird error on my application. I'm trying to retrieve an list of entity from database (MySQL) with session.createCriteria().list() but I'm getting this org.hibernate.WrongClassException. I have looked up this error and I know what it means, but I don't know how to solve it on my context. I have the following database structure: CREATE TABLE vtiger_crmentity ( `crmid` int(19) NOT NULL ) CREATE TABLE vtiger_account ( `accountid` int(19) NOT NULL DEFAULT 0 ) CREATE TABLE vtiger_accountscf ( `accountid` int(19) NOT NULL DEFAULT 0 ) CREATE TABLE vtiger_accoutshipads ( `accountaddressid` int(19) NOT NULL DEFAULT 0 ) CREATE TABLE vtiger_accountbillads ( `accountaddressid` int(19) NOT NULL DEFAULT 0 ) So, quickly explaining, all the tables are linked by the these id columns, and in the last level, the vtiger_accountscf table has 1 vtiger_accountshipads and 1 vtiger_accountbillads. All the tables have the same PK. So I made my classes like this (stubs): @Entity @Inheritance(strategy = InheritanceType.JOINED) @Table(name = "vtiger_crmentity") public class VtigerCrmentity { @Id @Basic(optional = false) @Column(name = "crmid", nullable = false) public Integer getId() { return this.id; } } @Entity @PrimaryKeyJoinColumn(name = "accountid") @Inheritance(strategy = InheritanceType.JOINED) @Table(name = "vtiger_account") public class VtigerAccount extends VtigerCrmentity { } @Entity @PrimaryKeyJoinColumn(name = "accountid") @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @Table(name = "vtiger_accountscf") public class VtigerAccountscf extends VtigerAccount { } @Entity @PrimaryKeyJoinColumn(name = "accountaddressid") @Table(name = "vtiger_accountbillads") public class VtigerAccountbillads extends VtigerAccountscf { } @Entity @PrimaryKeyJoinColumn(name = "accountaddressid") @Table(name = "vtiger_accountshipads") public class VtigerAccountshipads extends VtigerAccountscf { } And here's my problem. When I do: getSession().createCriteria(VtigerAccountbillads.class)…
tagged with: mysql
accepted answer: http://stackoverflow.com/a/25533699
tagged with: vtiger
upvote count: 8
favorite count: 0
score: 8
type: Question
has comment: http://stackoverflow.com/comment/39865075
answer count: 3
has answer: http://stackoverflow.com/a/58690362
possible better answer: http://stackoverflow.com/a/58690362
has answer: http://stackoverflow.com/a/25533699
has title: Object with id was not of the specified subclass
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/39616658
score: 0
comment on: http://stackoverflow.com/q/25399312
type: QuestionComment
type: Comment
has text: see this http://stackoverflow.com/questions/8568684/secure-web-service-requests http://stackoverflow.com/questions/853620/secure-web-services-rest-over-https-vs-soap-ws-security-which-is-better

http://stackoverflow.com/q/25441190
has comment: http://stackoverflow.com/comment/39694919
tagged with: java
has comment: http://stackoverflow.com/comment/39693542
has body: Search by id method: public class ClientsDetailsList { public ArrayList &lt;ClientDetails&gt; aListOfClientDetails; public ClientDetails getClientDetails(String givenID) { boolean found = false; int index = 0; for(;index&lt;aListOfClientDetails.size();index++){ if((aListOfClientDetails.get(index).ClientID.equals(givenID))) found = true; } if(found) return aListOfClientDetails.get(index); else return null; } } aListOfClientDetails List format It reads a file and creates a list of ClientDetails. [IC-x00042W Ms LQ Bethea 205, Willis Road Bolton BO5 1DQ 2000000007 2000100037 2006200319, IC-x00033D Mr R Bowie 119, Thatcher Way Glasgow GL9 5SX 2006000016 2003100008 2005300001, IC-x00013A MS GRV Blackwell 209, Drunk Road Hawick HK8 1MY 2006000009 2004100014 2003200304, IC-x00018O Ms NAP Wallis 244, Grubb Lane Durham DU4 4ZX 2000000006 2003100012 2006200305] One line is an object of the list. With the method above I try to return an object of the list found by ID (e.g. first token IC-x00042W). However when I run this in my main method it returns Only the first object.(IC-x00042W/Ms/LQ/Bethea/205, Willis Road/Bolton/BO5.....) If I search by id of another object it returns null. Source of ClientDetailsList: The txt file has the following data: IC-x00042W/Ms/LQ/Bethea/205, Willis Road/Bolton/BO5 1DQ/2000000007/2000100037/2006200319# IC-x00033D/Mr/R/Bowie/119, Thatcher Way/Glasgow/GL9 5SX/2006000016/2003100008/2005300001# IC-x00013A/MS/GRV/Blackwell/209, Drunk Road/Hawick/HK8 1MY/2006000009/2004100014/2003200304# IC-x00018O/Ms/NAP/Wallis/244, Grubb Lane/Durham/DU4 4ZX/2000000006/2003100012/2006200305# IC-x00037N/Miss/DOD/Burke/272, Ambrose Lane/Cambridge/CB2 2XD/2005000003/2001100020# IC-x00039A/Dr/X/Salter/285, Bannister Road/Sea Palling/SP2 6GW/2000000002/2005100029/2005200306# IC-x00011I/MR/R/Reece/104, Bannister Lane/Cromer/CR0 6LD/2005000012/2003100001/2001200300# IC-x00025V/Mr/P/Abbott/163, Drunk Lane/Hunstanton/HU1 1UR/2003000029/2004100017# IC-x00008L/Dr/P/Runyon/150, T…
has comment: http://stackoverflow.com/comment/39693668
has answer: http://stackoverflow.com/a/25441270
possible better answer: http://stackoverflow.com/a/25441270
type: Question
has comment: http://stackoverflow.com/comment/39693494
has comment: http://stackoverflow.com/comment/39693829
accepted answer: http://stackoverflow.com/a/25441240
has comment: http://stackoverflow.com/comment/39694955
has comment: http://stackoverflow.com/comment/39694907
has title: Search(by a givenID) method returning only first object
has comment: http://stackoverflow.com/comment/39693340
has answer: http://stackoverflow.com/a/25441240
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39693876
answer count: 3
has comment: http://stackoverflow.com/comment/39694132
has answer: http://stackoverflow.com/a/25441377

http://stackoverflow.com/comment/39670738
type: Comment
type: QuestionComment
has text: The parent LinearLayout height is not adjusted on the TextView height change. Quick fix: make the TextView single line (also reduce its textSize a bit).
comment on: http://stackoverflow.com/q/25428877
score: 0

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

http://stackoverflow.com/comment/39881646
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25542698
has text: go for a low level `read` and test the bytes one by one to see if there are chars.

http://stackoverflow.com/comment/39805163
type: Comment
type: QuestionComment
has text: you cant return a value from a `void` method
score: 2
comment on: http://stackoverflow.com/q/25501188

http://stackoverflow.com/comment/39862933
type: Comment
type: QuestionComment
has text: I suggest you read up on classpaths.
comment on: http://stackoverflow.com/q/25532266
score: 0

http://stackoverflow.com/a/25488741
accepted answer of: http://stackoverflow.com/q/25488277
answers question: http://stackoverflow.com/q/25488277
downvote count: 0
type: AcceptedAnswer
score: 9
upvote count: 9
has body: When using CDI in Java EE 7 (CDI 1.1), the default bean discovery mode is annotated. Which means that any bean with an explicitly specified scope is available for injection. So to make your bean B available for injection, you can either: Declare an explicit scope on class B (that's what you are doing when putting @Dependent) Declare a beans.xml file with the bean-discovery-mode attribute set to all. This will make all beans of your archive available for injection (same behavior than Java EE 6 (CDI 1.0)). The beans.xml file must be in the META-INF folder and looks like: <?xml version="1.0" encoding="UTF-8"?> However, i would not recommend using bean-discovery-mode="all".
type: Answer

http://stackoverflow.com/q/25528508
tagged with: jsp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39855647
has body: I want to show the date on the view layer based on different formats. I am obtaining custom formats such as MMM YYYY, Yr, H/Yr etc. as another attribute from the same object. In this case, Which is best option. I have two options Write a custom tag and invoke before showing on the screen Write a utility method and call from the JSP page. Is there any other way? Which is the best approach?
tagged with: java
tagged with: custom-tags
has comment: http://stackoverflow.com/comment/39855715
type: Question
has title: Custom tag or utility method which is better to use display value on JSP
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39855755

http://stackoverflow.com/q/25399982
has comment: http://stackoverflow.com/comment/39616930
tagged with: return
has answer: http://stackoverflow.com/a/25400095
accepted answer: http://stackoverflow.com/a/25400095
has comment: http://stackoverflow.com/comment/39617033
answer count: 1
has comment: http://stackoverflow.com/comment/39617039
favorite count: 0
type: Question
type: AnsweredQuestion
has title: Method with return? When should I use it?
downvote count: 3
has body: I'm a beginner with java programming and I have a simple question: When should I use return values? I understand the meaning and what I can do with it. But I wonder if I shouldn't always make global variables to work with. Can you guys tell me when I should choose which option?
tagged with: java
has comment: http://stackoverflow.com/comment/39616988
has comment: http://stackoverflow.com/comment/39616985
score: -1
tagged with: global
has comment: http://stackoverflow.com/comment/39617008
upvote count: 2

http://stackoverflow.com/comment/39852366
score: 0
comment on: http://stackoverflow.com/q/25526220
has text: (ok, actually, `remainderOfX` might be missleading. but unfortunately there is no verb for "set to remainder of" or a verb for "do modulo")
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39871295
type: Comment
comment on: http://stackoverflow.com/a/25536498
type: AnswerComment
has text: your ans reads the call to this(..) avoids call to super(...) no matter what. either super(), or this(), or none can be called in a constructor-- bth cant be. i agree to the rest of what youre saying.
score: 0

http://stackoverflow.com/comment/39899106
comment on: http://stackoverflow.com/a/25550129
type: AnswerComment
type: Comment
score: 0
has text: Don't forget to remove the `static` keyword again - never leave fixes that don't work... Nobody would expect gay love on SO, so that last comment is not necessary.

http://stackoverflow.com/comment/39763994
has text: @MadProgrammer Finished my runnable Find Demo of my problem sir.. I hope you can test it and tell which exactly is my problem.. thank you in advance
score: 0
comment on: http://stackoverflow.com/q/25478541
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39705535
comment on: http://stackoverflow.com/q/25445166
score: 1
has text: Hi @koma, thanks for your answer. What do you mean by insert the entities before adding the index? I already have some records in the database. I have to delete them and start again?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25461502
answers question: http://stackoverflow.com/q/25461463
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/39733606
has comment: http://stackoverflow.com/comment/39731728
upvote count: 0
has comment: http://stackoverflow.com/comment/78286544
has comment: http://stackoverflow.com/comment/78254823
downvote count: 1
has comment: http://stackoverflow.com/comment/39731766
has body: You're not interrupting the synchronization, you're interrupting the sleep().

http://stackoverflow.com/comment/39770300
type: QuestionComment
comment on: http://stackoverflow.com/q/25482241
score: 0
type: Comment
has text: Yes, I'm sure about this.

http://stackoverflow.com/a/25511880
score: 2
answers question: http://stackoverflow.com/q/25511536
upvote count: 2
has body: Your professors example is very misleading. From the API, it says this about DataInputStream: "Read primitive Java data types from an underlying input stream in a machine-independent way". Back in Java v 1.0, this was much more important, as communication protocols like HTML, XML, and JSON didn't exist or were in their infancy. So the big problem was with big-endian / little-endian issue with ints, longs, floats, etc. Communicating from a big-endian computer to a little-endian computer in Java using raw sockets WOULD need something like this. But this has nothing to do with reading text files. I'd advise using FileReader to connect to the BufferedReader, rather than what your professor has done.
downvote count: 0
type: Answer

http://stackoverflow.com/q/25395316
type: Question
accepted answer: http://stackoverflow.com/a/25395352
possible better answer: http://stackoverflow.com/a/25395397
tagged with: eclipse
has answer: http://stackoverflow.com/a/25395352
has answer: http://stackoverflow.com/a/25395397
has title: classpath and Eclipse
type: AnsweredQuestion
answer count: 2
has body: I would like to export the classpath configuration of my java application from eclipse. how Can I set the classpath manually? how can I package it keeping the configuration the same. The application is a standard java application.
score: 0
tagged with: java
tagged with: eclipse-classpath
tagged with: classpath

http://stackoverflow.com/q/25402243
has body: Hi we are migrating an application from ASP to Java.In ASP they have used the below function for finding the firstweekday for a given month and year. for(var i=0; i &lt; 12; i++) { iPrintDay = 1; iStopFlag = 0; iDays=0; iLastDay = arrMonthDay[i]; datFirstDay = new Date(sParmYear,i, 1); iFirstWeekday = datFirstDay.getDay(); } From above for loop, the sysout of datFirstDay will return Wed Jan 1 00:00:00 CST 2014 and the sysout of iFirstWeekday will return 3[which is the starting weekday for the month of Jan for the year 2014 which they are passing] for the first iteration of the for loop given above. I am trying to find the value of iFirstWeekday which is FIRST WEEKDAY STARTING FOR EVERY MONTH for a given year in Java. I tried lot of solutions but none of them meets my expectation. Any suggestions will be really helpful to resolve the issue
tagged with: asp.net
type: Question
has comment: http://stackoverflow.com/comment/39621819
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39620993
linked to: http://stackoverflow.com/q/8940438
has answer: http://stackoverflow.com/a/25403895
answer count: 2
score: 0
tagged with: java
has title: How to get frst weekday of each month for a year in java
has answer: http://stackoverflow.com/a/25403212
tagged with: calendar

http://stackoverflow.com/comment/39854359
type: Comment
has text: i haven't i have no idea how to do it, i insert directly in the first table then insert in the second and the two have no relashionship, so that's what i'm trying to do by using AffiliateID as a ForeignKey
type: QuestionComment
comment on: http://stackoverflow.com/q/25522827
score: 0

http://stackoverflow.com/comment/39672325
score: 2
type: QuestionComment
type: Comment
has text: try `[-LBQTHWROMSNT](0MIL|[LBCDGJKMNPQSTUVWXYZ][NA][0137CUVRT][PCBMVWTHKNDG])(NR|RR)(?:(?<=A[A-Z0-9]{4})[OPLH]|$)`
comment on: http://stackoverflow.com/q/25429659

http://stackoverflow.com/comment/40950558
type: AnswerComment
has text: I did not get a chance to test your proposed solution, because somehow I can no longer reproduce my original problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26033752

http://stackoverflow.com/comment/39868441
score: 0
type: AnswerComment
has text: As the error suggests there is a problem connecting to that queue manager using those connection settings. Check that SENDER_QUEUE_MGR_QA is the right queue manager name and that the host/port are correct for that queue manager.
comment on: http://stackoverflow.com/a/25533530
type: Comment

http://stackoverflow.com/comment/39655308
type: Comment
has text: Err, what is 'context'? Is this JNDI? LDAP? What?
type: QuestionComment
comment on: http://stackoverflow.com/q/25420609
score: 0

http://stackoverflow.com/q/25399280
favorite count: 0
has body: Hello i need to read Phone Hardware Properties in apk. Is there any aapt command or java project for this? I am using aapt -l a game.apk and there is no hardware property at there. If Game Developer add hardware properties in AndroidManifest.xml how can i read ?
tagged with: aapt
type: Question
accepted answer: http://stackoverflow.com/a/30434443
downvote count: 0
upvote count: 1
score: 1
answer count: 1
has comment: http://stackoverflow.com/comment/39615722
type: AnsweredQuestion
tagged with: android
tagged with: java
has title: How to read CPU,RAM or Other hardware properties in AndroidManifest.xml
has answer: http://stackoverflow.com/a/30434443
tagged with: manifest

http://stackoverflow.com/comment/39754418
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25473726
type: AnswerComment
has text: Thanks!, but, extend the main class... i don't know... I would like have many separate classes, and to extend all of them... it's too much code in the class name... but thanks! :)

http://stackoverflow.com/comment/39879928
score: 0
comment on: http://stackoverflow.com/q/25541684
has text: best bet is regex for such requirement
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39644731
has text: And are you using version 4 or later of the play services library? Admob is available in gps 4+
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25413772

http://stackoverflow.com/q/25509483
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: uri
answer count: 1
tagged with: web-applications
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25511655
score: 1
tagged with: spring
tagged with: spring-mvc
has title: spring tools suite defaul mvc project web application
tagged with: java
has body: hi i'm trying to change my default home page for another one but i couldn't do it, so i try to redirect the page from the default home page to the one i want, but i get this error No mapping found for HTTP request with URI: [/myapp/WEB-INF/views/index.html] in DispatcherServlet with name 'appServlet' this is my setup i left everything by default when i create the project with spring tools suite this is my servlet-contex.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="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/context http://www.springframework.org/schema/context/spring-context.xsd"> <annotation-driven /> <resources mapping="/resources/**" location="/resources/" /> <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <beans:property name="prefix" value="/WEB-INF/views/" /> <beans:property name="suffix" value="" /> </beans:bean> <context:component-scan base-package="com.proj.myapp" /> this is my web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> contextConfigLocation /WEB-INF/spring/root-context.xml org.springframework.web.context.ContextLoaderListener appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/appServlet/servlet-context.xml 1 appServlet / this is my deafult home file home.jsp enter code here <%@ taglib uri="http://java.…

http://stackoverflow.com/comment/39802438
comment on: http://stackoverflow.com/q/25485260
type: Comment
type: QuestionComment
score: 0
has text: According to the screenshot, your input is on one single line. We assumed there were `newLine`s after each dataset. That will make things complicated. Personally, I'd say your Input is broken and useless and urge the creator to create a valid Input file. But I guess the horrible input is the main task to be dealt with in this assignment ... :(

http://stackoverflow.com/comment/39752075
score: 0
type: AnswerComment
has text: The question is trivial, so is the answer, and this answer says all that needs to be said.
comment on: http://stackoverflow.com/a/25471645
type: Comment

jcheckbox
tags question: http://stackoverflow.com/q/25481394
tags question: http://stackoverflow.com/q/25538213
tag name: jcheckbox
tags question: http://stackoverflow.com/q/25437673
type: Tag
tags question: http://stackoverflow.com/q/25407161
tags question: http://stackoverflow.com/q/25501703

http://stackoverflow.com/comment/39896153
type: QuestionComment
comment on: http://stackoverflow.com/q/25550344
has text: Please post relevant code and files.
score: 0
type: Comment

deserialization
type: Tag
tags question: http://stackoverflow.com/q/25425939
tags question: http://stackoverflow.com/q/25501988
tag name: deserialization

http://stackoverflow.com/comment/39616147
comment on: http://stackoverflow.com/q/25399454
type: Comment
score: 0
type: QuestionComment
has text: I included "Thread.sleep(100);" statement at end of main method , even then it doesnt work.

http://stackoverflow.com/a/27366051
score: 9
upvote count: 9
type: Answer
accepted answer of: http://stackoverflow.com/q/25440651
answers question: http://stackoverflow.com/q/25440651
type: AcceptedAnswer
downvote count: 0
has body: The error is caused by ScmStatsSensor. You need to add "scmstats" to the list of plugins to be excluded from the preview scan. From the docs: Excluding Plugins Some plugins (useless for a preview analysis) can be skipped thanks to the sonar.preview.excludePlugins (was sonar.dryRun.excludePlugins prior to SonarQube 4.0) property. This property can be set through the SonarQube web interface: Settings > General Settings > General > General). The default value is "devcockpit,pdfreport,report,scmactivity,views,jira". For example, to skip the Build Stability plugin (due to https://jira.codehaus.org/browse/SONARIDE-346), set the property to "devcockpit,pdfreport,report,scmactivity,views,jira,buildstability". You can also set this property in Eclipse at global or project level. Right click on your project root and go to Properties / SonarQube / Preview Analysis Properties. Add the property there if you just want to exclude it for that project, or click "Configure Workspace Settings" and add it there to cover all projects. Your current exclusions list is shown in the output above 08:07:02.875 INFO - Exclude plugins: devcockpit, jira, pdfreport, views, report, buildstability, scmactivity, buildbreaker so the property value should be : devcockpit, jira, pdfreport, views, report, buildstability, scmactivity, buildbreaker, scmstats
has comment: http://stackoverflow.com/comment/51345925

http://stackoverflow.com/q/25539866
answer count: 1
has title: Is it possible to convert text images into a text file? JAVA
upvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/39876749
tagged with: java
tagged with: ocr
favorite count: 0
type: Question
has body: Is it possible to convert text images into a text file? What could be the right algorithm for making this thoughts possible? I'm new about this stuff, and I want to expand more my learning about this thing because I'm still a student.
has comment: http://stackoverflow.com/comment/39877106
has answer: http://stackoverflow.com/a/25540262
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/q/25511928
has title: Issue with JPA @ManyToMany From A to B(NOT bidirectional) via C table, but the connection to B not by primary key
tagged with: java
tagged with: hibernate
type: UnansweredQuestion
tagged with: jpa
tagged with: spring-data
answer count: 1
has answer: http://stackoverflow.com/a/25602868
type: Question
has body: I have an JPA @ManyToMany issue I have One Main entity called Report. I have several entities connect to Report with ManyToMany Relation. The connection is done via extra table. i.e with @JoinTable annotation. Each relation is lazy. I have a function that fetch the report with all its relations. now, if i do fetch by accessing the property (i.e mark the function as @Transcational and access to each one of the property) everything works as expected. But, if I do CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Report> query = cb.createQuery(Report.class); Root<Report> report = query.from(Report.class); ArrayList<Predicate> preds = new ArrayList<Predicate>(); DomainSpecification.<Report>eager().toPredicate(report, query, cb); preds.add(DomainSpecification.<Report>idIsEqual(id).toPredicate(report, query, cb)); query.where(cb.and(preds.toArray(new Predicate[preds.size()]))); query.select(report); List<Report> results = em.createQuery(query).setMaxResults(1).get I get all the relations as well but One of the relation (that has been connected to another table NOT by primary key) is fetching alots times. This means that the length of r.getProjects() is 13823 of the same value. i.e of the same Project. I'm attaching here the relevant source from Domain Specification/Report.java/Project.java and Keyword.java (the keyword is just to show an example for an entity that works good with this kind of fetching) Maybe one can throw some light on this issues. Thanks, Oak Additional Information Code Report.java @Entity(name = "reports") public class Report implements Serializable, Auditing,JppDbObject { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "REPORT_ID", unique = true, nullable = false) private Long id; @JsonIgnore @OneToOne(cascade = CascadeType.ALL, mappedBy = "report") private ReportId report; /* * this here for updating the reports_ids table. * * set json ignore over this field. */ @Column(name = "txt", nullable = false) private String tx…
score: 0
tagged with: many-to-many

http://stackoverflow.com/a/25449419
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25449313
has body: getActivity() returns null if the Fragment is not yet attached to an Activity. The ArrayAdapter is being instantiated in the constructor (that's when member variables with assignments get assigned), and at that point the Fragment has not yet been attached to the Activity. You can declare the ArrayAdapter and wait to instantiate it in onCreateView or onActivityCreated
type: Answer
answers question: http://stackoverflow.com/q/25449313
score: 2

http://stackoverflow.com/comment/39646219
comment on: http://stackoverflow.com/a/25415335
has text: could you explain more if you can?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39603567
type: Comment
type: QuestionComment
has text: @user3218114 I can't use both BoxLayout and GridBagLayout at the same time. But each of them give the same result: the components are not wrap, and when the window is to narrow, I can't see every button.
comment on: http://stackoverflow.com/q/25392338
score: 0

http://stackoverflow.com/comment/111434376
type: AnswerComment
score: 1
type: Comment
has text: There is no need to run with -U option.
comment on: http://stackoverflow.com/a/59897594

http://stackoverflow.com/comment/39786023
type: QuestionComment
comment on: http://stackoverflow.com/q/25490744
type: Comment
score: 0
has text: Furthermore, just running `java -version` doesn't probably even attempt to start a JVM; it just runs native code which prints the version information. If you try to actually *run* some java program, you may find it fails as well.

http://stackoverflow.com/a/25555454
downvote count: 0
type: Answer
has body: If you know the number of times a method is suppoed to be called you can use the times() method of Mockito //for example if had to be called 3 times verify(uc1, times(3)).thisMethod(); verify(uc2, times(3)).thatMethod(); However, I now see that you call the method a random number of times, so this probably isn't the best answer unless you stub out the random number generator to always return an expected value.
answers question: http://stackoverflow.com/q/25543250
has comment: http://stackoverflow.com/comment/39913630
score: 5
upvote count: 5

icons
tags question: http://stackoverflow.com/q/25442753
tags question: http://stackoverflow.com/q/25398945
tag name: icons
type: Tag
tags question: http://stackoverflow.com/q/25452750

http://stackoverflow.com/q/25455579
tagged with: java
tagged with: preemptive
upvote count: 4
tagged with: client
score: 4
has comment: http://stackoverflow.com/comment/50662668
type: Question
has comment: http://stackoverflow.com/comment/50699446
answer count: 0
downvote count: 0
has title: Preemptive authentication with JAX-RS?
type: UnansweredQuestion
has body: I'm a long time reader and first time user so please go easy on me. I'm attempting to use preemptive auth with javax.ws.rs.client.Client. I've got this working with HTTPClient, but I can't figure out how to accomplish the same with a JAX authenticator. HttpClient client = new HttpClient(); client.getParams().setAuthenticationPreemptive(true); Credentials creds = new UsernamePasswordCredentials("user", "pass"); client.getState().setCredentials(AuthScope.ANY, creds); I do have basic auth working with JAX. Here's my client: public HttpsConnection() { // configure ssl final SslConfigurator sslConfig = SslConfigurator.newInstance().keyStoreFile(keyStore).keyPassword("pass"); final HostnameVerifier hostnameVerifier = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; final SSLContext sslContext = sslConfig.createSSLContext(); // configure client final Client client = ClientBuilder.newBuilder().sslContext(sslContext).hostnameVerifier(hostnameVerifier) .register(new Authenticator(username, password)).register(JacksonFeature.class) .register(new JsonObjectMapper()).build(); WebTarget target = client.target(base_url); } And here's my auth filter: public class Authenticator implements ClientRequestFilter { private final String user; private final String password; public Authenticator(String user, String password) { this.user = user; this.password = password; } public void filter(ClientRequestContext requestContext) throws IOException { MultivaluedMap&lt;String, Object&gt; headers = requestContext.getHeaders(); final String basicAuthentication = getBasicAuthentication(); headers.add("Authorization", basicAuthentication); } private String getBasicAuthentication() { String token = this.user + ":" + this.password; try { return "Basic " + DatatypeConverter.printBase64Binary(token.getBytes("UTF-8")); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException("Cannot encode with UTF-8", ex); } } } Can anyone give m…
tagged with: authentication
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/77401764
favorite count: 0

http://stackoverflow.com/comment/39733620
has text: How would you do this "by hand", on paper?? No different in a program.
comment on: http://stackoverflow.com/q/25462493
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25469114
has answer: http://stackoverflow.com/a/25469153
tagged with: java
has comment: http://stackoverflow.com/comment/39745787
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/39746768
favorite count: 0
tagged with: postgresql
answer count: 4
has answer: http://stackoverflow.com/a/25469336
has answer: http://stackoverflow.com/a/25469883
type: Question
has comment: http://stackoverflow.com/comment/39746613
has answer: http://stackoverflow.com/a/25469179
tagged with: jdbc
has body: I get back an error indicating java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost: 5432/testDBMS import java.sql.*; import java.util.*; public class JdbcPostgresqlConnection { public static void main(String[] args) { Connection conn3 = null; try { String dbURL3 = "jdbc:postgresql://localhost:5432/testDBMS"; Properties parameters = new Properties(); parameters.put("user", "pgmrHere"); parameters.put("password", "111111"); conn3 = DriverManager.getConnection(dbURL3, parameters); } catch (SQLException ex) { ex.printStackTrace(); } } }
type: UnansweredQuestion
score: -2
has title: Getting the following error - No suitable driver found for jdbc:postgresql://localhost: 5432/testDBMS
has comment: http://stackoverflow.com/comment/39745767

http://stackoverflow.com/comment/116898049
score: 0
type: AnswerComment
type: Comment
has text: this answer is almost correct. What you need to add is a) activeprofiles statement for the profile id you have and 2) remove mirror configuration for google. that's not a mirror of anything. Also, 3) internal repository mirror should be named "central" so requests reaching for central explicitly would go to mirror.
comment on: http://stackoverflow.com/a/25442236

http://stackoverflow.com/comment/39796340
score: 0
type: AnswerComment
has text: @valbertos...the images in my folders are small and big size.. that why I made them to fit the screen size..
type: Comment
comment on: http://stackoverflow.com/a/25495802

http://stackoverflow.com/comment/39767507
type: Comment
comment on: http://stackoverflow.com/a/25480593
score: 0
type: AnswerComment
has text: 2014,02,12 -- output is Year = 2014 Month = 0 Day = 11 .. why not changing year as 2013 ..

http://stackoverflow.com/comment/39626690
comment on: http://stackoverflow.com/q/25405289
type: QuestionComment
type: Comment
has text: id `textCode` is inside fragment?
score: 0

http://stackoverflow.com/comment/39599182
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25390281
type: QuestionComment
has text: You cannot use `break` as a `goto`. It doesn't work that way.

http://stackoverflow.com/q/25437542
has answer: http://stackoverflow.com/a/25438020
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18129106
has comment: http://stackoverflow.com/comment/39687467
upvote count: 2
has comment: http://stackoverflow.com/comment/39687190
score: 2
tagged with: jpa
downvote count: 0
tagged with: maven
answer count: 1
has comment: http://stackoverflow.com/comment/39687279
has title: For security purposes, is there a way to make code fail if it's written a certain way?
favorite count: 0
has comment: http://stackoverflow.com/comment/39687118
type: Question
has body: I'm using JPA and Maven in a project. It's possible, but semantically wrong to write code that does this: entityManager.find(EntityWithRestrictedData.class, key); or entityManager.findAll(EntityWithRestrictedData.class); The project already has code that should be used instead: getEntityWithRestrictedDataONLYIfYouHaveAccess(key, user); Is there any way to have the build fail if someone uses the entity manager to find restricted data directly? Keep in mind that in my project there are other perfectly valid reasons to use find and findAll, just not with the EntityWithRestrictedData. EDIT: This question may be a duplicate of this, How to make a maven build fail if source code contains a keyword / regex
has comment: http://stackoverflow.com/comment/39687166

android-widget
tags question: http://stackoverflow.com/q/25509025
tags question: http://stackoverflow.com/q/25421748
type: Tag
tag name: android-widget
tags question: http://stackoverflow.com/q/25470933

http://stackoverflow.com/a/25448023
type: Answer
answers question: http://stackoverflow.com/q/25447910
upvote count: 1
downvote count: 0
has body: The only cases that I can imagine are serialization and JNI. With serialization, you create a new object by deserializing the whole object state from an input stream. No constructor is invoked in this case. With JNI, there is the AllocObject function, which allocates the space for a new object, also without calling a constructor. EDIT: A call to clone() may be considered as another case, but this depends on how the method is implemented.
score: 1

http://stackoverflow.com/comment/125906173
type: AnswerComment
comment on: http://stackoverflow.com/a/25434492
type: Comment
has text: Some teams enforce initializing objects to null to quiet the IDE complaining 'xyz variable might not have been initialized', so its a good practice to initialize them to null in those cases.
score: 0

http://stackoverflow.com/comment/39709118
type: QuestionComment
comment on: http://stackoverflow.com/q/25435960
has text: If you can't find the music assets, you may need to inspect the decompiled source to see how they are loaded.
score: 0
type: Comment

http://stackoverflow.com/comment/39904864
comment on: http://stackoverflow.com/a/25539283
type: Comment
score: 0
type: AnswerComment
has text: Yes, you are right. Thank you for your help. It is nice to get to a resolution with this one.

http://stackoverflow.com/a/25440571
type: Answer
answers question: http://stackoverflow.com/q/25440490
score: 0
has body: A nice example can be found in the docs. You need to call the execute() method on your task, not get(). I'd also recommend at least implementing the onPostExecute() method as well in your AsyncTask.

http://stackoverflow.com/q/25458810
answer count: 3
tagged with: java
has body: public class Computation extends Thread { private int num; private boolean isComplete; public Computation(int nu) { num = nu; } public void run() { System.out.println("Thread Called is: " + Thread.currentThread().getName()); } public static void main(String... args) { Computation [] c = new Computation[4]; for (int i = 0; i &lt; 3; i++) { c[i] = new Computation(i); c[i].start(); } } } My Question is in main function we are creating every time a new Computation object on which the thread is being started then why we need to snchrnoized the run method? As we know for every different class object 'this' reference is different so we don't need to synchronize. Also in another Example: public class DiffObjSynchronized implements Runnable { @Override public void run() { move(Thread.currentThread().getId()); } public synchronized void move(long id) { System.out.print(id + " "); System.out.print(id + " "); } public static void main(String []args) { DiffObjSynchronized a = new DiffObjSynchronized(); /**** output ****/ // 8 9 8 9 new Thread(a).start(); new Thread(new DiffObjSynchronized()).start(); } } Here is second example just like first we create a Thread on 2 different instances of class. Here we synchronize the move() method but by definition: "two different objects can enter the synchronized method at the same time" Please share your feedback?
tagged with: multithreading
has answer: http://stackoverflow.com/a/25458855
accepted answer: http://stackoverflow.com/a/25461487
type: Question
has answer: http://stackoverflow.com/a/25461487
possible better answer: http://stackoverflow.com/a/25458855
has title: Confusion Regarding java threads on same/different objects
has answer: http://stackoverflow.com/a/25458852
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25540377
has answer: http://stackoverflow.com/a/25540404
tagged with: methods
tagged with: recursion
has answer: http://stackoverflow.com/a/25540480
has body: I would like for you to help me correct the output on this method. The recursive version returns what I need, but the non_recursive version does not return the same result. Here is my code: public static double sum_nr(int n){ int result = 1; for(int i=n-1; i&gt;0; i--){ result += 1/i; } return result; } public static void main(String[] args){ Scanner scan = new Scanner(System.in); System.out.println("Is the string a palindrome or not? "); String test = scan.nextLine(); System.out.println("Answer: " + isPalindrome_r(test)); System.out.println("Answer: " + isPalindrome_nr(test)); System.out.println("What is the sum of n number: "); int test2 = scan.nextInt(); System.out.println("Answer: " + sum_r(test2)); System.out.println("Answer: " + sum_nr(test2)); } Recursive version when n = 10 is 1.6179775280898876 Non-recursive version n = 10 is 2.0 I want these two to both match up. Can you help me?
type: Question
tagged with: sum
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39877663
has answer: http://stackoverflow.com/a/25540391
has comment: http://stackoverflow.com/comment/39877692
score: 0
has title: Returning the sum of 1+1/2+1/3+...+1/n Series
answer count: 3

http://stackoverflow.com/q/25508873
answer count: 2
has answer: http://stackoverflow.com/a/25509035
has answer: http://stackoverflow.com/a/25509036
tagged with: java
has comment: http://stackoverflow.com/comment/39820079
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39819928
has title: Using exception handling to eliminate irrelevant exceptions in subclass constructor
has body: I'm writing a class in Java which is a subclass of another class I wrote, and its constructor explicitly calls the superclass's constructor. The constructor of the superclass may throw several types of exceptions when initialized directly, however when I initialize an instance of my subclass there are several exceptions that will never by thrown (by design). I tried catching these exceptions in the subclass's constructor but I received an error stating that "Constructor call must be the first statement in a constructor". Why can't I catch these exceptions? For example, the code below: public class Persian_Cat extends Cat { public Persian_Cat(File file) { try{ super(file); } catch(InvalidArgumentException e) { } catch(FileNotFoundException e) { } } } marks the statement super(file); as the error. How can I implement the subclass constructor so that it will know these exceptions are irrelevant? I need this because I don't wish to wrap this constructor in try{}...catch{} for every exception in my code later.
score: 6
upvote count: 6
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25509036
accepted answer: http://stackoverflow.com/a/25509035

http://stackoverflow.com/a/25428882
answers question: http://stackoverflow.com/q/25428454
has body: There might be some errors during maven packaging phase and the resulting executable jar file will be erroneous. Do the following: Always read maven log output when building and packaging Fix the packaging phase Include an assembly descriptor in order to assemble a bin-tar Include the spring boot jar
type: Answer
score: 0

system
tag name: system
type: Tag
tags question: http://stackoverflow.com/q/25465353

http://stackoverflow.com/q/25542795
type: Question
has answer: http://stackoverflow.com/a/25546671
tagged with: javascript
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/7878014
has body: My task was to generate Latitude and longitude when a user enters the address and store it in database.I looked around and Google Maps API has given the implementation for this. But the issue is it shows address on the map but not the coordinates.I am not very familiar with the Maps API but is there any way to generate the coordinates and display in the input feild. Thanks. Geocoding service
tagged with: google-maps-api-3
score: -1
upvote count: 0
tagged with: java
has title: Getting Latitude and longitude from google maps
answer count: 1
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/7878014

http://stackoverflow.com/q/25461328
type: Question
linked to: http://stackoverflow.com/q/1086054
has comment: http://stackoverflow.com/comment/39731927
has answer: http://stackoverflow.com/a/25461390
score: 0
has comment: http://stackoverflow.com/comment/39731578
answer count: 1
upvote count: 1
downvote count: 1
has title: How do I declare an array of bytes in Java?
favorite count: 0
type: AnsweredQuestion
tagged with: delphi
has comment: http://stackoverflow.com/comment/39731392
tagged with: java
has body: I have an algorithm written in Delphi and ask me to convert that to java equivalent. It has a line of code that I can't understand, could anyone help me convert this line of code to java ?! const list: array [1..37] of byte=(9,7,5,3,1,2,4,6,8,4,7,3,9,1,6,5,1,6,7,2,3,6,5,3,8,9,2,1,7,4,2,3,1,9,7,6,8);
accepted answer: http://stackoverflow.com/a/25461390

http://stackoverflow.com/a/25420161
has body: Many, many methods to do this, including a rewritten version of your own code // making use of lastIndexOf String subPath = path.substring(path.lastIndexOf("/")); // make use of file class String subPath = new File(path).getName(); // make use of String split String[] parts = path.split("/"); String subPath = parts[parts.length - 1]; // modification on your own code public static String splitPath(String path) { int index = path.indexOf("/"); if (index == -1) return path; else return splitPath(path.substring(index + 1)); } Considerations on your code public String splitPath(String path){ if (path == "") { return null; } if(path.indexOf("/") != -1){ String subPath = path.substring(path.indexOf("/") + 1); splitPath(subPath); } return path; } you == on a String. Never do that. Suppose you call splitPath("a/b"), then the first if is skipped, the second if is not, but in the second if, you do something with a subString, but never return it, and eventually simply return path anyway. However, a simple return wouldve sufficed: if(path.indexOf("/") != -1){ String subPath = path.substring(path.indexOf("/") + 1); return splitPath(subPath); //note the return. } return path; Which results in: public String splitPath(String path) { int index = path == null ? -1 : path.indexOf("/"); // null check if (index != -1) return splitPath(path.substring(index + 1)); return path; //or : // int index = path == null ? -1 : path.indexOf("/"); // null check // return index == -1 ? path : splitPath(path.subString(index + 1)); }
has comment: http://stackoverflow.com/comment/39656262
type: Answer
accepted answer of: http://stackoverflow.com/q/25419934
answers question: http://stackoverflow.com/q/25419934
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39766245
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25479635
has text: @icza You are correct and your answer reasonable. I actually need a custom dialog - at least the title/button text. Interestingly, I found by experimenting that if showDialog() is called before setApproveButtonText() and then showOpenDialog() is called, the setApproveButtonText() does not take effect. Not that I'd do this, just a strange observation. Thanks.

http://stackoverflow.com/a/25502081
score: 0
has body: Sure, all you need to do is public class Game extends JPanel { private AI ai; int[] intinfo = new int[]{486, 539, 591,643,696,749,801,853,907}; public Game() { this.ai = new AI(); ... } public void execute() { ai.AI(intinfo); } } ... game.repaint(); while(true) { game.execute(); Thread.sleep(50); } And of course, AI.java public class AI { int intinfo1; int intinfo2; int intinfo3; int intinfo4; public void AI(int[] intinfo) { int[] info = new int[10]; //the values of this will come from intinfo info1=1; //values of these four info will be returned to the intinfo info2=2; info3=3; info4=4; } ... } And you need to compile both classes with javac - how to compile multiple java source files in command line
has comment: http://stackoverflow.com/comment/39808399
answers question: http://stackoverflow.com/q/25501956
has comment: http://stackoverflow.com/comment/39808653
has comment: http://stackoverflow.com/comment/39808440
type: Answer

http://stackoverflow.com/a/25484123
has comment: http://stackoverflow.com/comment/39811109
has comment: http://stackoverflow.com/comment/39898440
answers question: http://stackoverflow.com/q/25461640
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39809572
has comment: http://stackoverflow.com/comment/39808241
has comment: http://stackoverflow.com/comment/39888191
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39809061
accepted answer of: http://stackoverflow.com/q/25461640
upvote count: 3
has comment: http://stackoverflow.com/comment/39899018
has body: Your temporal condition "next Friday at 21:30" is hard to realize in standard Java-library using java.util.Calendar and java.util.Date. In Joda-Time it also requires a non-trivial workaround (again with loop). In Java-8 (new time library JSR-310 in package java.time) an acceptable solution using specialized methods in TemporalAdjusters is possible, but since you operate on Android, this is not the way to go. Instead here an alternative solution in my library Time4J which does not need any error-prone loops or complex conditions: import static net.time4j.PlainDate.DAY_OF_WEEK; import static net.time4j.Weekday.FRIDAY; File myFile = new File(""); long timeSinceCreateFile = myFile.lastModified(); // conversion to global timestamp in Time4J-format Moment fileTSP = TemporalTypes.MILLIS_SINCE_UNIX.transform(timeSinceCreateFile); // what ever you need (or just TZID timezone = Timezone.ofSystem().getID();) TZID timezone = AMERICA.MONTREAL; // "next friday" is a local time condition =&gt; convert to local timestamp PlainTimestamp localTSP = fileTSP.toZonalTimestamp(timezone); PlainTime walltime2130 = PlainTime.of(21, 30); // move to next time 21:30 (possibly on next day) and then to next or same Friday localTSP = localTSP.with(PlainTime.COMPONENT.setToNext(walltime2130)) .with(DAY_OF_WEEK.setToNextOrSame(FRIDAY)); // convert current time to local timestamp and compare at 21:30 boolean downloadNeeded = SystemClock.inZonalView(timezone).now().isAfter(localTSP);
downvote count: 0

http://stackoverflow.com/q/25497728
has title: Set a value at most once with the builder pattern
tagged with: builder-pattern
accepted answer: http://stackoverflow.com/a/25498555
has answer: http://stackoverflow.com/a/25498099
has answer: http://stackoverflow.com/a/25498555
has body: Is there a standard practice in Java, while using the builder pattern, to ensure that a member variable is set at most once. I need to make sure that the setter is called 0 or 1 times but never more. I would like to throw a RuntimeException of some type but am worried about synchronization issues as well as best-practices in this area.
downvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/25497847
possible better answer: http://stackoverflow.com/a/25497781
answer count: 4
upvote count: 11
has answer: http://stackoverflow.com/a/25497781
type: Question

http://stackoverflow.com/q/25540847
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25540958
has title: How can i get a date of android device opening time?
has comment: http://stackoverflow.com/comment/39878854
downvote count: 1
has comment: http://stackoverflow.com/comment/39878898
has comment: http://stackoverflow.com/comment/39878762
has comment: http://stackoverflow.com/comment/39878732
has body: I was wondering that how can i programmatically get a date of android device service opened time and date of the first access to network on the device? Is it possible? plz help me...
has comment: http://stackoverflow.com/comment/39878810
tagged with: device
score: 1
tagged with: android
tagged with: java
answer count: 1
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/a/25408564
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/39657863
answers question: http://stackoverflow.com/q/25408311
has comment: http://stackoverflow.com/comment/39657664
accepted answer of: http://stackoverflow.com/q/25408311
has comment: http://stackoverflow.com/comment/39653948
has body: The akka way of passing data between threads, which is essentially what you are doing by blocking above is to compose futures or to send a message to an Actor. The following example has been taken from the Akka documentation. final ExecutionContext ec = system.dispatcher(); Future&lt;String&gt; f1 = future(new Callable&lt;String&gt;() { public String call() { return "Hello" + "World"; } }, ec); Future&lt;Integer&gt; f2 = f1.map(new Mapper&lt;String, Integer&gt;() { public Integer apply(String s) { return s.length(); } }, ec); f2.onSuccess(new PrintResult&lt;Integer&gt;(), system.dispatcher()); Notice that in this example data is being 'returned', or more precisely it is being handed off to another unit of work without a thread having to block and wait for a result. This is why onSuccess returns void, it is to be used at the end of a chain of composed futures. If it was to return a value, it would be like map and it would return another Future. Which would leave you with the same requirement of blocking. Thus to answer your question, no. There is no way to 'return' a value from an asynchronous future without blocking. Instead you should review why you need Response to be returned like that, and see if instead you can move the handling of Response into either onSuccess or map. A minor alternative is to return Future[Response] and let the caller worry about chaining the futures. The case that you have hit usually happens when mixing paradigms, and it is best avoided.
type: Answer
has comment: http://stackoverflow.com/comment/39658163
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/39795529
score: 0
comment on: http://stackoverflow.com/q/25495543
has text: Is there a way to check individual elements to see if they are not null?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25549579
type: AnsweredQuestion
score: 0
has body: I'm trying to catch key value pairs in a Map parameter at spring MVC side. This looks to me to be something simple but I can't wrap my head around it at the moment. Take following url www.goudengids.be.localhost:8080/ms/view/sendContactForm.ajah?pageId=711408&amp;listingId=685592&amp;siteId=353009&amp;url=http%3A%2F%2Fwww.goudengids.be.localhost%3A8080%2Fms%2Fms%2Fkbc-bank-versicherung-recht-4780%2Fms-353009-preview%2F&amp;moduleId=65920100&amp;mySiteId=353009&amp;pageShortId=1&amp;prefills[Naam]=janneke You'll notice at the end my latest attempt to get this working prefills[Naam]=janneke. I like to catch this in the following controller. public String getContactForm(@RequestParam(required = true) Long moduleId, @RequestParam(required = true) String url, @RequestParam(required=false) Map&lt;String,String&gt; prefills, Long mySiteId, Integer pageShortId, DefaultPageParameters defaultPageParameters, ModelMap model, HttpServletRequest request, HttpServletResponse response, Locale locale) throws Exception { However I'm recieving all parameters in the request in my prefills variable instead of just Naam,janneke. Is this even possible what I'm attempting or should I go with a large string with a token to tokenize ? prefills=naam:janneke|title:maan|subject:space
tagged with: java
has comment: http://stackoverflow.com/comment/39894746
accepted answer: http://stackoverflow.com/a/25562600
has comment: http://stackoverflow.com/comment/39919463
type: Question
has title: Catch GET request parameters in a Map<String,String>
answer count: 1
has answer: http://stackoverflow.com/a/25562600
tagged with: spring
has comment: http://stackoverflow.com/comment/39919236
has comment: http://stackoverflow.com/comment/39894690
tagged with: spring-mvc

http://stackoverflow.com/a/25401270
score: 0
has comment: http://stackoverflow.com/comment/39622384
type: Answer
has body: Assuming that leadTime is a field in your documents, your query has to look like this DBObject query=new BasicDBObject("group",group) .append("leadTime.date", new BasicDBObject("$gte", parameterDate)) ; The way you did it, MongoDB would have searched for a date field in your document root: { _id: "Foo", date: ISODate("2014-03-19T23:00:00Z"), [...] } Queries in MongoDB don't make a difference if the queried field is a single value or an array, so using the dot notation on a field which holds an array of subdocuments is perfectly valid.
answers question: http://stackoverflow.com/q/25400307
has comment: http://stackoverflow.com/comment/39619759

http://stackoverflow.com/comment/39860964
type: AnswerComment
comment on: http://stackoverflow.com/a/25530390
has text: A right operand that is too large always leads to a result that is too large. The standard might be extra explicit and call out the two situations, but there's no difference between them for signed types; one always causes the other (there is, however, a difference for unsigned types because operations on them never overflow). I feel that adding extra unnecessary wording will make the answer less valuable, not more. Thanks for the prefix suggestion, though.
type: Comment
score: 0

http://stackoverflow.com/a/25465748
score: 0
has body: You could have a class RainBow which would extend a concrete implementation of List. This is since a RainBow actually IS a list of colors. public class RainBow extends ArrayList&lt;Color&gt; { public void addColor(Color color) { this.add(color); } public Color getTypeOfColor(String typeOfColor){ for(Color c : this){ if(c.getClass().getSimpleName().equals(typeOfColor)){ return c; } } return null; } } You can then use this class like so : Red red = new Red(); Blue blue = new Blue(); Rainbow rainbow = new Rainbow(); rainbow.add(red); rainbow.add(blue); if (rainbow.getTypeOfColor("Yellow") == null) { //Color doesn't exist } if (rainbow.getTypeOfColor("Red") != null) { //Color exists } Be aware this uses the class names for the comparisation.
type: Answer
answers question: http://stackoverflow.com/q/25465590

http://stackoverflow.com/q/25449313
has title: NullPointerException on class variables and clear run for function variables
type: AnsweredQuestion
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/25449419
accepted answer: http://stackoverflow.com/a/25449419
tagged with: android
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25449516
possible better answer: http://stackoverflow.com/a/25449516
tagged with: initialization
type: Question
has comment: http://stackoverflow.com/comment/39708334
upvote count: 0
answer count: 2
has body: When I'm running the following, I'm getting NullPointerException Caused by: java.lang.NullPointerException at android.widget.ArrayAdapter.init(ArrayAdapter.java:310) at android.widget.ArrayAdapter.&lt;init&gt;(ArrayAdapter.java:166) at com.example.amirtau.helloworld.app.MainActivity$PlaceholderFragment.&lt;init&gt;(MainActivity.java:69) (line 69 is mentioned on the following code) public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { String[] data = { "Mon 6/23 - Sunny - 31/17", "Tue 6/24 - Foggy - 21/8", "Wed 6/25 - Cloudy - 22/17", "Thurs 6/26 - Rainy - 18/11", "Fri 6/27 - Foggy - 21/10", "Sat 6/28 - TRAPPED IN WEATHERSTATION - 23/18", "Sun 6/29 - Sunny - 20/7" }; List&lt;String&gt; weekForecast = new ArrayList&lt;String&gt;(Arrays.asList(data)); //line 69 ArrayAdapter&lt;String&gt; forecastAdapter = new ArrayAdapter&lt;String&gt;( getActivity(), // The current context (this activity) R.layout.list_item_forecast, // The name of the layout ID. R.id.list_item_forecast_textview, // The ID of the textview to populate. weekForecas…
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39612702
type: QuestionComment
has text: Environment.getExternalStorageDirectory() . If this gives a path to you. your are good to go to use this to have db there and things are completely public out here AFAIK. Let me know if you need code to do that
score: 0
comment on: http://stackoverflow.com/q/25397417
type: Comment

http://stackoverflow.com/q/25425419
accepted answer: http://stackoverflow.com/a/25435990
has answer: http://stackoverflow.com/a/25435990
downvote count: 1
favorite count: 0
type: Question
score: 5
has title: Jackson conditional @JsonUnwrapped
has answer: http://stackoverflow.com/a/37276723
tagged with: jackson
upvote count: 6
has answer: http://stackoverflow.com/a/79503803
type: AnsweredQuestion
has body: Can I use @JsonUnwrapped conditionally? I don't want to use it during serialization but would like to use it while deserializing the object. One way to do it is create two different classes or create a subclass overriding just that property which needs to behave different while serializing and deserializing. This doesn't sound right. Any other alternatives or Jackson way of tackling the problem?
answer count: 3
possible better answer: http://stackoverflow.com/a/37276723
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/25458445
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25458376
type: Answer
accepted answer of: http://stackoverflow.com/q/25458376
has body: You need to use the constructor Color(int, boolean) to supply the alpha value for your color. The constructor you are using changes the alpha value to 255.

http://stackoverflow.com/comment/39856991
type: Comment
type: QuestionComment
has text: you haven't shown any code, so i have no clue how it works.
comment on: http://stackoverflow.com/q/25527971
score: 0

http://stackoverflow.com/comment/39669115
comment on: http://stackoverflow.com/q/25427716
score: 2
has text: "But it is clear that if we don't use synchronized keyword with method requestStop the code will work fine" on your JVM with your architecture (x86 is outlier of memory models). Have you tried this on a big iron Azul machine and their own JVM? On Aarch64 or alpha that both have rather weak memory models? No? Well then how do you know it works? You can't prove that something works by testing with concurrent code, you can only prove that it's broken that way.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39787071
type: QuestionComment
comment on: http://stackoverflow.com/q/25491233
has text: C-Style doesn't mean C-style memory management. You can't equate C-Style syntax with C-style memory management.
score: 3
type: Comment

http://stackoverflow.com/comment/39895627
type: AnswerComment
comment on: http://stackoverflow.com/a/25550251
score: 0
type: Comment
has text: With the caveat that a "live reference" means any object that is reachable through strong references from a thread that is running or yet to be run. So there is a slight connection.

http://stackoverflow.com/q/25460816
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25461544
tagged with: increment
has title: what will be the reason behind the output of java code?
has answer: http://stackoverflow.com/a/25460859
has answer: http://stackoverflow.com/a/25460943
has answer: http://stackoverflow.com/a/25460873
has answer: http://stackoverflow.com/a/25460893
has body: Consider the following simple java code public static void main(string args[]) { int x=10; int y; y=x++; y=y--; System.out.println(y); } here output is 10. but actually y variable decrements. but according to me output should be 9. what is the reason?
score: 1
has comment: http://stackoverflow.com/comment/39730554
tagged with: java
tagged with: decrement
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39730572
tagged with: operators
favorite count: 0
type: Question

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/25467377
tags question: http://stackoverflow.com/q/25495157
tag name: android-gridview

http://stackoverflow.com/q/25477745
has title: How can I create new ArrayList<ArrayList<Integer>> from an old one without changing the old one?
has answer: http://stackoverflow.com/a/25477813
tagged with: java
tagged with: reference
has body: I have an ArrayList&lt;ArrayList&lt;Integer&gt;&gt; res whic contains some subsets of integers. Part of these subsets I keep in ArrayList&lt;ArrayList&lt;Integer&gt;&gt; prev. For example res = [[1], [1, 2], [2]] and prev = [[1, 2], [2]]. Then I want to create new ArrayList&lt;ArrayList&lt;Integer&gt;&gt; tmp which is a copy of prev, to add new element in each subset of tmp without changing prev and then to add tmp to the result. The code that I use is the following: ArrayList&lt;ArrayList&lt;Integer&gt;&gt; res = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); ArrayList&lt;ArrayList&lt;Integer&gt;&gt; prev = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); for (int i = 0; i &lt; S.length; i++) { ArrayList&lt;ArrayList&lt;Integer&gt;&gt; tmp = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); if(something){ tmp = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(prev); for(ArrayList&lt;Integer&gt; a: tmp){ a.add(S[i]); } res.addAll(tmp); prev = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(tmp); } So if res = [[1], [1, 2], [2]] and prev = [[1, 2], [2]] S[i] = 2 I want tmp to become [[1, 2, 2], [2, 2]] and then to add tmp to res. The problem is that when I add element to tmp, I change also prev and I change also res, which I don't want. So after the above iteration my res contains [[1], [1, 2, 2], [2, 2], [1, 2, 2], [2, 2]] instead of [[1], [1, 2], [2], [1, 2, 2], [2, 2]]. I tried changing this line tmp = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(prev); with tmp.addAll(prev); but it didnt work again. Where is my mistake? EDIT: I think I solved the problem - I changed the line tmp = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(prev); to for(ArrayList&lt;Integer&gt; a: prev){ tmp.add(new ArrayList&lt;Integer&gt;(a)); } However, I still need an explenation why this works, and why the previous doesnt work?
type: AnsweredQuestion
tagged with: list
answer count: 2
possible better answer: http://stackoverflow.com/a/25477813
has comment: http://stackoverflow.com/comment/39761853
has answer: http://stackoverflow.com/a/25478677
has comment: http://stackoverflow.com/comment/39762326
accepted answer: http://stackoverflow.com/a/25478677
type: Question
has comment: http://stackoverflow.com/comment/39761801
score: 0

http://stackoverflow.com/comment/39760901
has text: I ran your code here http://ideone.com/PN8BeJ and it appears to output your expected output.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25477134
type: Comment

http://stackoverflow.com/comment/39633389
score: 2
comment on: http://stackoverflow.com/q/25407059
type: Comment
type: QuestionComment
has text: the problem can be converted to a TSP which is NP-Complete so an optimal solution is impossible in a non trivial problem instance.

http://stackoverflow.com/q/25453125
accepted answer: http://stackoverflow.com/a/25454367
tagged with: mockito
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25454367
tagged with: unit-testing
favorite count: 0
type: Question
has title: Can I ignore aspect of a method while mocking it using Mockito?
tagged with: java
tagged with: aspects
score: 2
has comment: http://stackoverflow.com/comment/39716813
type: AnsweredQuestion
has body: I have a class with a few methods advised through an input validation aspect (validates whether all input parameters are not-null/non-empty strings). I am facing an issue while writing test case for them and want to verify if this is indeed a bad design issue. Here's a very simplified version of my class: public class A { public String one(String word) { // Some actions String val = two(word2); // Some more actions } protected String two(String word) { // Some actions } } Now while writing test cases for one() I use Mockito and want to mock calls to two(). So I use: @Spy A a; @Test void test() { doReturn("Bye").when(A).two(Mockito.anyString()); a.one("hello"); // Some validations } This test fails as the: doReturn() line fails with input being empty for two(). Should I not mock two() or can I make this work somehow? Edit: Adding a more specific example related to the two methods being present in two different classes as requested: Create a page through a WebService. This builds a putRequest, executes it and returns a response. public class AUtility implements BaseUtility { public Response create(Params params) { try { PutMethod putRequest = buildPUTRequest(params.getAttr1(), params.getAttr2()); return Utils.buildResponse(client.executeMethod(putRequest), params.getAttr3(), params.getAttr4()); } catch (Exception e) { throw new AppException(e); } } } The put request marshals the data into a file to write it through the HttpClient private PutMethod buildPUTRequest(final String url, final Object obj) throws IOException, JAXBException { // Create a temp file to store the stream File tempFile = File.createTempFile(APPLICATION_LABEL, XML_LABEL); decoder.marshal(obj, tempFile); // Build the put method return putMethod; } XMLMarshaller public interface XMLDecoder implement Decoder { public void marshal(Object obj, File tempFile) throws IOException, JAXBException { // Perform marshalling operations } } The test fails on line2 with the inputs being null. @Test public void crea…
upvote count: 2

http://stackoverflow.com/q/25461813
has body: I am trying to align my output so that it looks like this: 11 13 15 17 Right now, it only prints out like 11,13,15,17. What should I do with my code to make it properly aligned? I tried adding \n after true which didn't work. Code: boolean test { int z, for (z = 10, i &lt;= 30; i++) { if ((z % z== 0) &amp;&amp; (z % 1 == z)) } System.out.println(true); //number is prime System.out.println(false);//number is not prime
score: -5
answer count: 2
has title: How to vertically align the output in Java using boolean?
has answer: http://stackoverflow.com/a/25462026
tagged with: java
linked to: http://stackoverflow.com/q/2795065
upvote count: 1
has comment: http://stackoverflow.com/comment/39732269
favorite count: 0
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25461835
downvote count: 6
has comment: http://stackoverflow.com/comment/39732251

http://stackoverflow.com/comment/39740704
has text: @user1111929 Instead of looking through JavaScript, you can open up the developer tools and look at the request that's fetching the extra content and make that call yourself.
comment on: http://stackoverflow.com/a/25466325
type: AnswerComment
score: 3
type: Comment

http://stackoverflow.com/q/25465542
has body: I need the URI of a file (which I put in the resources directory). If I use MyClass.class.getClassLoader().getResource(resource) I get java.lang.IllegalArgumentException: URI is not hierarchical Otherwise, if I use ClassLoader.getSystemResource(resource) it returns null.
tagged with: classloader
upvote count: 2
has comment: http://stackoverflow.com/comment/39739586
type: UnansweredQuestion
tagged with: uri
linked to: http://stackoverflow.com/q/573679
downvote count: 0
has comment: http://stackoverflow.com/comment/39739109
has comment: http://stackoverflow.com/comment/39739983
linked to: http://stackoverflow.com/q/18055189
has comment: http://stackoverflow.com/comment/39739255
has answer: http://stackoverflow.com/a/44842093
has comment: http://stackoverflow.com/comment/39739222
score: 2
has comment: http://stackoverflow.com/comment/39739187
tagged with: illegalargumentexception
tagged with: java
has comment: http://stackoverflow.com/comment/39739177
has answer: http://stackoverflow.com/a/30976474
has title: "URI is not hierarchical" when loading resource
favorite count: 0
tagged with: resources
has comment: http://stackoverflow.com/comment/39739925
type: Question
answer count: 2

http://stackoverflow.com/comment/39751120
score: 0
type: Comment
has text: You resized ch to 3, but in multiply you reference to ch[3], which is 4-th channel.
type: QuestionComment
comment on: http://stackoverflow.com/q/25466319

http://stackoverflow.com/comment/39885415
type: Comment
has text: The same problem with the current development version Glassfish 4.1-bl3
type: QuestionComment
comment on: http://stackoverflow.com/q/25543619
score: 0

http://stackoverflow.com/a/25402322
type: Answer
answers question: http://stackoverflow.com/q/25401022
has body: Trying to force reconnect an open connection the way you are is definitely not going to do you and good. You need to tear down the connection and create a new one if you want to handle connection interruption yourself. What you really should do is figure out what is closing your connection on you, probably a firewall closing down the inactive connection or a load balancer. Look at your environment and see what else is in the mix that could be closing the connection on you. The broker can, if configured to do so, rebalance clients in a cluster. Are you using multiple clients in a clustered environment etc?
score: 1
has comment: http://stackoverflow.com/comment/39621099
downvote count: 1
has comment: http://stackoverflow.com/comment/39622092
upvote count: 2

http://stackoverflow.com/q/25424338
linked to: http://stackoverflow.com/q/16257306
has answer: http://stackoverflow.com/a/38563041
has comment: http://stackoverflow.com/comment/39690140
tagged with: nexus
has answer: http://stackoverflow.com/a/25442236
downvote count: 0
has answer: http://stackoverflow.com/a/58606684
score: 42
linked to: http://stackoverflow.com/q/5325407
tagged with: maven-3
favorite count: 0
has answer: http://stackoverflow.com/a/69693510
type: Question
tagged with: build
has body: I have the following in settings.xml paid-jars jars with license http://url:8081/nexus/content/repositories/paidjars/ !central Org-central mirror of central http://url:8081/nexus/content/repositories/central/ central In pom.xml I have two jars apache-commons.jar (which I assumes to be downloaded from central) licensed.jar (which I assume to be downloaded from paid-jars) But when I run maven clean install it tries to download licensed.jar from Org-central. How can I make it use paid-jars to download? Is it possible first it goes to Org-central and if fails it tries at paid-jars? If so, how? I don't want to put repo entries in pom.xml Settings.xml <?xml version="1.0" encoding="UTF-8"?> Proxy true http username ****** host.url 8080 local.net|internal.com paid-jars jars with license http://url:8081/nexus/content/repositories/paidjars/ !central Org-central mirror of central http://url:8081/nexus/content/repositories/central/ central compiler <JAVA_1_7_HOME>C:\Program Files (x86)\Java\jdk1.7.0_51\bin</JAVA_1_7_HOME>
has comment: http://stackoverflow.com/comment/39735035
has comment: http://stackoverflow.com/comment/39733967
has title: Maven Settings for multiple repositories
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25424626
answer count: 6
tagged with: repository
has answer: http://stackoverflow.com/a/73978327
upvote count: 42

http://stackoverflow.com/a/25405556
has comment: http://stackoverflow.com/comment/39629488
has body: The return type of your getInstance() method has to reflect the common type of all the class types you can return i.e. it's going to be a supertype or a common interface shared by all those classes. e.g. public Vehicle getInstance() { if (...) { return new Car(); } else { return new Bus(); } } So in the above, both Car and Bus would derive from Vehicle (Vehicle could be a superclass or an interface). Otherwise the contract between the method return type and what is being returned would be violated. Note that you can choose any super type in the inheritance hierarchy - anything that is common to both (if you return an Object or something similarly simplistic you can't usefully work with the object without casting it, and that's a sign that something's not right in your design) Your calling code will simply expect and receive a Vehicle (and not care whether it's a Car or a Bus) Vehicle v = Factory.getInstance(); v.turnIgnitionOn(); v.drive(); See this article for more info. Usefully, it uses the same Vehicle abstraction as I detailed above.
upvote count: 3
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/39627247
type: Answer
has comment: http://stackoverflow.com/comment/39627324
answers question: http://stackoverflow.com/q/25405469
has comment: http://stackoverflow.com/comment/39627675

http://stackoverflow.com/q/25484660
possible better answer: http://stackoverflow.com/a/25484840
has title: Working with file using Groovy
tagged with: jar
accepted answer: http://stackoverflow.com/a/25512809
has comment: http://stackoverflow.com/comment/39774209
has comment: http://stackoverflow.com/comment/39774116
has comment: http://stackoverflow.com/comment/39774456
type: AnsweredQuestion
score: 0
tagged with: groovy
has comment: http://stackoverflow.com/comment/39776288
has answer: http://stackoverflow.com/a/25484840
tagged with: java
has comment: http://stackoverflow.com/comment/39774316
has comment: http://stackoverflow.com/comment/39774762
tagged with: file
has answer: http://stackoverflow.com/a/25512809
has body: I want to perform some operation on a jar file like Adding folders/files and removing them. I can do that using Java. But I would like to achieve it using Groovy. But no idea about methods or classes. I am newbie to Groovy and willing to learn and enjoy it's features . Can someone provide me a very basic groovy script to add folder/file OR if possible simply provide me some links to work with jar file. That would be helpful !!
has comment: http://stackoverflow.com/comment/39775741
type: Question
answer count: 2

http://stackoverflow.com/comment/39751930
comment on: http://stackoverflow.com/a/25466342
has text: Glad I could help. I don't know whether 3G will work, as NAT's are everywhere. But it could be possible. If not, look into hole-punching with ICE.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25517933
type: Answer
has comment: http://stackoverflow.com/comment/39837601
answers question: http://stackoverflow.com/q/25517451
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39837312
has body: When you do: actions += "check_cup" -&gt; readf("coffee", 1, doTest) you're already evaluating the function readf and storing the "result" of Unit rather than storing the function. You want that to be: actions += "check_cup" -&gt; () =&gt; readf("coffee", 1, doTest) Then you're storing a function that takes no parameters, and when it is called, just calls readf with the params you supplied. And change the type of actions to Map[String, () => Unit]
has comment: http://stackoverflow.com/comment/39837510

http://stackoverflow.com/comment/39873774
score: 1
has text: Thanks, I figured. So does that mean "New IO 2" is superior in every way to the other two? I'm reading "The Java Tutorial" book and it teaches about NIO.2, but it also has a section on IO.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25537675

http://stackoverflow.com/q/25544053
tagged with: java
has answer: http://stackoverflow.com/a/25544434
answer count: 1
tagged with: keylistener
has comment: http://stackoverflow.com/comment/39884158
type: Question
type: UnansweredQuestion
has body: I just want to ask if you could invisibly type in the JFrame without any input fields and then a sudden action comes out? Just wondering. And if so, how is that possible?
tagged with: swing
score: 0
has title: Can you fire keyTyped() function without any input fields?

http://stackoverflow.com/q/25515187
answer count: 1
downvote count: 0
favorite count: 0
type: Question
tagged with: linux
has answer: http://stackoverflow.com/a/25515514
has body: I need to execute Linux command like this using Runtime.getRuntime().exec() : /opt/ie/bin/targets --a '10.1.1.219 10.1.1.36 10.1.1.37' Basically, this command is to connect each targets to server one by one (10.1.1.219, 10.1.1.36, 10.1.1.37). It works well in terminal, the result should be : ['10.1.1.219', '10.1.1.36', '10.1.1.37'] But if I execute the command using Runtime.getRuntime().exec(execute), like this : execute = "/opt/ie/bin/targets" + " " + "--a" + " " + "'" + sb + "'"; Java will treat the single quote as string to execute, the result will be : callProcessWithInput executeThis=/opt/ie/bin/targets --a '10.1.1.219 10.1.1.36 10.1.1.37' The output for removing undesired targets :["'10.1.1.219"] Anyone knows how to solve it? Thanks!
tagged with: java
has comment: http://stackoverflow.com/comment/39832474
accepted answer: http://stackoverflow.com/a/25515514
score: 2
has title: Single quote Issue when executing Linux command in Java
type: AnsweredQuestion
upvote count: 2

sql
tags question: http://stackoverflow.com/q/25425813
tags question: http://stackoverflow.com/q/25391409
tags question: http://stackoverflow.com/q/25503556
tags question: http://stackoverflow.com/q/25529314
tags question: http://stackoverflow.com/q/25458027
tags question: http://stackoverflow.com/q/25531959
tags question: http://stackoverflow.com/q/25458071
tags question: http://stackoverflow.com/q/25462646
tags question: http://stackoverflow.com/q/25543206
tags question: http://stackoverflow.com/q/25529020
tags question: http://stackoverflow.com/q/25476503
tags question: http://stackoverflow.com/q/25472511
tags question: http://stackoverflow.com/q/25438777
tags question: http://stackoverflow.com/q/25395999
tags question: http://stackoverflow.com/q/25428983
tags question: http://stackoverflow.com/q/25406365
tags question: http://stackoverflow.com/q/25415521
tags question: http://stackoverflow.com/q/25439565
tags question: http://stackoverflow.com/q/25542514
tags question: http://stackoverflow.com/q/25458843
tags question: http://stackoverflow.com/q/25399674
tags question: http://stackoverflow.com/q/25453594
tags question: http://stackoverflow.com/q/25481402
tags question: http://stackoverflow.com/q/25545569
tags question: http://stackoverflow.com/q/25399183
tags question: http://stackoverflow.com/q/25532955
tags question: http://stackoverflow.com/q/25533449
tags question: http://stackoverflow.com/q/25474261
tags question: http://stackoverflow.com/q/25539347
tags question: http://stackoverflow.com/q/25435849
tags question: http://stackoverflow.com/q/25545431
tags question: http://stackoverflow.com/q/25450452
tags question: http://stackoverflow.com/q/25408020
tags question: http://stackoverflow.com/q/25445577
tags question: http://stackoverflow.com/q/25483863
tags question: http://stackoverflow.com/q/25464593
tags question: http://stackoverflow.com/q/25485086
tags question: http://stackoverflow.com/q/25548808
tags question: http://stackoverflow.com/q/25550288
tags question: http://stackoverflow.com/q/25423130
tags question: http://stackoverflow.com/q/25547025
tags question: http://stackoverflow.com/q/25416475
tags question: http://stackoverflow.com/q/25543417
tags question: http://stackoverflow.com/q/25549378
tags question: http://stackoverflow.com/q/25524794
tags question: http://stackoverflow.com/q/25508326
tags question: http://stackoverflow.com/q/25404290
tags question: http://stackoverflow.com/q/25525072
tags question: http://stackoverflow.com/q/25500468
tags question: http://stackoverflow.com/q/25434269
tags question: http://stackoverflow.com/q/25523950
tags question: http://stackoverflow.com/q/25519401
tags question: http://stackoverflow.com/q/25499835
tags question: http://stackoverflow.com/q/25448100
tags question: http://stackoverflow.com/q/25495952
tags question: http://stackoverflow.com/q/25431210
tags question: http://stackoverflow.com/q/25515119
tag name: sql
tags question: http://stackoverflow.com/q/25545219
tags question: http://stackoverflow.com/q/25513074
tags question: http://stackoverflow.com/q/25405095
tags question: http://stackoverflow.com/q/25446926
type: Tag
tags question: http://stackoverflow.com/q/25432514
tags question: http://stackoverflow.com/q/25404511
tags question: http://stackoverflow.com/q/25526981
tags question: http://stackoverflow.com/q/25414358
tags question: http://stackoverflow.com/q/25544377
tags question: http://stackoverflow.com/q/25454582
tags question: http://stackoverflow.com/q/25538246
tags question: http://stackoverflow.com/q/25484733
tags question: http://stackoverflow.com/q/25546678
tags question: http://stackoverflow.com/q/25460137
tags question: http://stackoverflow.com/q/25484924
tags question: http://stackoverflow.com/q/25504685
tags question: http://stackoverflow.com/q/25528087
tags question: http://stackoverflow.com/q/25493837
tags question: http://stackoverflow.com/q/25529791
tags question: http://stackoverflow.com/q/25435331
tags question: http://stackoverflow.com/q/25479412

http://stackoverflow.com/a/25465055
answers question: http://stackoverflow.com/q/25465028
has body: You're not passing in Strings but rather undeclared variables. Change UserAccount user1 = new UserAccount(Rachel, Birthday); UserAccount user2 = new UserAccount(Brandi, Purple); // What are the Rachel, Birthday, Brandi and Purple? to UserAccount user1 = new UserAccount("Rachel", "Birthday"); // ah now they're Strings! UserAccount user2 = new UserAccount("Brandi", "Purple"); In the future, if you need to ask questions about compilation errors or thrown exceptions, please post the full message for us to evaluate. Otherwise you force us to guess which is no fun.
has comment: http://stackoverflow.com/comment/39739110
type: Answer
accepted answer of: http://stackoverflow.com/q/25465028
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39739480
has comment: http://stackoverflow.com/comment/39739172
has comment: http://stackoverflow.com/comment/39739285

http://stackoverflow.com/comment/39764066
comment on: http://stackoverflow.com/a/25478766
score: 0
type: AnswerComment
has text: Technically, maybe, but as a use, I can enter whatever I like, the field only provides post validation...what happens when the user removes the entire contents and tries updating the field?? This is also not a good solution if the OP is after entering a duration
type: Comment

http://stackoverflow.com/q/25438418
has comment: http://stackoverflow.com/comment/39701641
tagged with: java
has comment: http://stackoverflow.com/comment/39694036
answer count: 2
tagged with: cors
type: UnansweredQuestion
has body: I am having trouble consuming a rest service that did. Already implemented a CORS filter in my Java application, but when I use the $.ajax() it returns the problem of CORS. Using $.getJSON can access the method, however I can not add headers on it. I need to know how to add the header in $.getJSON or how to make it recognize the CORS I added in my Java service. I'm using Java 8, Wildfly 8.1-Final, RestEasy, etc. My ajax like this: var url = "http://pacoteiro-trysoft.rhcloud.com/api/v1/pacote/RC824435750CN"; $.ajax({ async : true, type:'GET', contentType: 'application/json', url: url, cache:false, dataType: 'json', headers: { "token":"123" }, success: function(data) { alert("Cadastrado com sucesso!", data); }, error: function(data) { alert("Erro!", data); } }); and my filter this way: @Provider public class ConfigureCORSFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext requestContext,ContainerResponseContext responseContext) throws IOException { responseContext.getHeaders().add("Access-Control-Allow-Origin", "*"); responseContext.getHeaders().add("Access-Control-Allow-Headers", "application/json, origin, content-type, accept, authorization"); responseContext.getHeaders().add("Access-Control-Allow-Credentials", "true"); responseContext.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD"); responseContext.getHeaders().add("Access-Control-Max-Age", "1209600"); } }
has title: How implements CORS with Javascript, jQuery?
has comment: http://stackoverflow.com/comment/39701822
tagged with: javascript
tagged with: jquery
tagged with: java-8
has answer: http://stackoverflow.com/a/25447510
has comment: http://stackoverflow.com/comment/39701664
type: Question
has comment: http://stackoverflow.com/comment/39688748
has answer: http://stackoverflow.com/a/25438537
score: 0
has comment: http://stackoverflow.com/comment/39701594
has comment: http://stackoverflow.com/comment/39688716
has comment: http://stackoverflow.com/comment/39701800

http://stackoverflow.com/comment/39848751
has text: Do you want keeping using cordova?
type: QuestionComment
comment on: http://stackoverflow.com/q/25524126
type: Comment
score: 0

http://stackoverflow.com/q/25491233
type: Question
has body: I know how C-style languages store the data in a variable. They use one or two blocks on the stack, and in the case of objects space is also allocated on the heap, for its fields. But where does java store whether two blocks make a double or an int? How does it know that a particular object reference in the stack points to an object. The thought that spawned this question is what happens if I do String s; If I understand correctly, this creates an object reference in the stack that is set to null, so two bytes of zeros, and no corresponding space on the heap. If so, how does Java "remember" that this reference belongs to a String? I can imagine that remembering types isn't necessary, and the bytecode just operates on raw data, and we know it does so correctly, because it compiles. On the other hand, that sounds like type erasure, which leads to lots of corner cases and unsafety. If this is the case, why is the type erasure on generics different from type erasure on the primitives and objects themselves? (ie. for the latter, you never ever have to think about it, and with generics it crops up all the time). NB: I say C-style, because I assume the solution is the same for all languages in that family. If there are different approaches, I'd like to know about the differences as well.
answer count: 2
possible better answer: http://stackoverflow.com/a/25491383
upvote count: 0
tagged with: types
has answer: http://stackoverflow.com/a/25491383
has title: How is type information stored in memory (if at all)
downvote count: 1
tagged with: jvm
accepted answer: http://stackoverflow.com/a/25491863
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25491863
has comment: http://stackoverflow.com/comment/39793375
tagged with: java
tagged with: http://stackoverflow.com/tag/c
tagged with: memory
has comment: http://stackoverflow.com/comment/39787071
favorite count: 0
has comment: http://stackoverflow.com/comment/39793488
score: -1

http://stackoverflow.com/a/25400689
has body: Hashmap of offsets of each line And that's the problem. The map may easily eat more memory than the file itself. Storing the offsets of every e.g. 1024th line would need 1024 times less memory. Reading a single line or a thousand from a disk takes about the same time because of: the smallest accessible unit is a block (used to be 512 B, but is 4KiB now) the transfer time for a block is negligible when compared to the seek time So round down to a multiple of 1024, find the line and process sequentially to the line you really wanted. You're using a HashMap&lt;Integer, Integer&gt;, which takes a lot of memory for the boxed ints. But your keys build a sequence, so why don't you use List&lt;Integer&gt; or even an int[]? You can reduce the memory consumption by a factor of maybe 4. I'd go for List&lt;int[]&gt; offsets accessed as follows: int getOffset(int line) { int listIndex = line &gt;&gt; 20; // one list entry per 1M lines int arrayIndex = (line &gt;&gt; 10) &amp; 1023; one array entry per 1k lines int remaining = line &amp; 1023; // lines to skip // TODO: handling of index bounds int offset = offsets.get(listIndex)[arrayIndex]; **seek to offset **skip remaining lines } You'll need 4 bytes (an int) for every 1024 lines and some more memory for every 1MiB. Unless you text file is multi-terrabyte, you need no LRU as everything nicely fits. For huge files replace int by long in the above text.
has comment: http://stackoverflow.com/comment/39620181
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25400548
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25400548

http://stackoverflow.com/a/25450641
has comment: http://stackoverflow.com/comment/39731062
has comment: http://stackoverflow.com/comment/39710948
score: 0
has comment: http://stackoverflow.com/comment/39712212
type: Answer
has body: You have to change some variables in your template file, it must be something like that: I set the variables you must change to Uppercase, so it is more easy for you to see. <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration> org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:**mysql**://**HEREYOUPUTIP:HERETHEPORT/YOURSCHEMA**?autoReconnect=true **THEUSEROFYOURDB** **YOURDBPASSOWRD** <mapping resource="Card.hbm.xml" /> </hibernate-configuration>
has comment: http://stackoverflow.com/comment/39711278
has comment: http://stackoverflow.com/comment/39711228
answers question: http://stackoverflow.com/q/25450510

http://stackoverflow.com/comment/39802272
has text: @NoobEditor That 1522 comes all from questions, none from answers.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/25499550

http://stackoverflow.com/comment/39651788
score: 1
has text: http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem. What is your real question?
type: Comment
comment on: http://stackoverflow.com/q/25418505
type: QuestionComment

http://stackoverflow.com/comment/39875070
type: QuestionComment
comment on: http://stackoverflow.com/q/25533928
has text: Thanks guys. I will look into creating a child context, although the problem I'm going to run into is that these dynamic beans may need to be available to the parent context(s) in some scenarios.
score: 0
type: Comment

http://stackoverflow.com/q/25408561
has comment: http://stackoverflow.com/comment/39634055
answer count: 1
has title: JSON data is not being loaded back into ArrayList
has comment: http://stackoverflow.com/comment/39633527
has comment: http://stackoverflow.com/comment/39633733
type: AnsweredQuestion
has body: I have successfully managed to save data entered by the user in my application into a JSON file in the application data folder. Now, I am trying to load the data (if it exists) back into the application after the application has been destroyed. This is the code I am using to save it into a JSON This is my JSON saving and loading class: public class CriminalIntentJSONSerializer { private Context mContext; private String mFilename; public CriminalIntentJSONSerializer(Context c, String f) { this.mContext = c; this.mFilename = f; } public void saveCrimes(ArrayList&lt;Crime&gt; crimes) throws JSONException, IOException { // Build an array in JSON JSONArray array = new JSONArray(); for (Crime c: crimes) { array.put(c.toJSON()); } //Write the file to disk Writer writer = null; try { OutputStream out = mContext.openFileOutput(mFilename, Context.MODE_PRIVATE); writer = new OutputStreamWriter(out); writer.write(array.toString()); } finally { if (writer != null) { writer.close(); } } } public ArrayList&lt;Crime&gt; loadCrimes() throws IOException, JSONException { ArrayList&lt;Crime&gt; crimes = new ArrayList&lt;Crime&gt;(); BufferedReader reader = null; try { // open and read the file into a StringBuilder InputStream in = mContext.openFileInput(mFilename); reader = new BufferedReader(new InputStreamReader(in)); StringBuilder jsonString = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { // line breaks are omitted and irrelevant jsonString.append(line); } // parse the JSON using JSONTokener JSONArray array = (JSONArray) new JSONTokener(jsonString.toString()).nextValue(); // build the array of crimes from JSONObjects for (int i = 0; i &lt; array.length(); i++) { crimes.add(new Crime(array.getJSONObject(i))); } } catch (FileNotFoundException e) { // we will ignore this one, since it happens when we start fresh } finally { if (reader != null) reader.close(); } return crimes; } } It seems there is something wrong with loadCrimes. I've tried debug…
has answer: http://stackoverflow.com/a/25409072
accepted answer: http://stackoverflow.com/a/25409072
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39633618
linked to: http://stackoverflow.com/q/7487460
type: Question
has comment: http://stackoverflow.com/comment/39633979
score: 0
has comment: http://stackoverflow.com/comment/39633811
has comment: http://stackoverflow.com/comment/39634006
has comment: http://stackoverflow.com/comment/39634155

http://stackoverflow.com/comment/40175770
comment on: http://stackoverflow.com/a/25651380
has text: For other examples, try: http://knotplot.com/ ; http://mirror.unl.edu/ctan/graphics/pgf/contrib/spath3/knots_doc.pdf ; http://knotilus.math.uwo.ca/doc/features.html ; http://cran.r-project.org/web/packages/Rknots/Rknots.pdf .
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39710947
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25450570
has text: Well what do you expect the recursive call to do? It's not changing the values within `c`, and it won't change any of your local variables... so what's the point?

http://stackoverflow.com/a/25405624
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25405289
has body: I recommend you to send a new Intent with some extra values to the activity and change you UI. This question may help you For you activity receive intent new to be on manifest.xml need to have this &lt;activity android:name=".acitvity" launchmode="singleTask"/&gt; And you when you send the intent and the values you need on you activity. Intent intent = new Intent(this,acitvity.class); intent.putExtra("key","value"); getApplicationContext().startActivity(intent);
type: Answer

http://stackoverflow.com/a/25953145
has body: It was a small error. I was able to fix the error by checking the filename for its size. And skipping the file upload steps in case it was empty.
type: Answer
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25468992
answers question: http://stackoverflow.com/q/25468992

http://stackoverflow.com/comment/126899195
score: 1
comment on: http://stackoverflow.com/q/25475972
type: QuestionComment
has text: https://stackoverflow.com/questions/71809915/why-does-jframe-pack-affect-the-location
type: Comment

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

http://stackoverflow.com/q/25490505
type: UnansweredQuestion
has body: I'm working in a multi module maven eap project. Previously it was implemented to use slf4j to use as logging framework. I changed it's logging configuration to use log4j2 as the underlying logging framework (still uses the slf4j). I referred to this document when I do so. But when I build the project and deploy it in jboss I get the following error. Class path contains multiple SLF4J bindings, Found binding in xxx/lib/log4j-slf4j-impl-2.0.2.jar/org/slf4j/impl/StaticLoggerBinder.class and xxx/lib/slf4j-log4j12-1.7.2.jar/org/slf4j/impl/StaticLoggerBinder.class P.S: I never add the slf4j-log4j12-1.7.2.jar dependency to pom.xml or in any of sub modules. I have no idea how that dependency is copied in to the lib folder. Any comments guys ?
has answer: http://stackoverflow.com/a/25490775
tagged with: maven
has title: slf4j-log4j12-1.7.2.jar unwanted dependency
tagged with: slf4j
score: 0
tagged with: java
answer count: 1
tagged with: log4j
type: Question

http://stackoverflow.com/q/25478434
tagged with: cordova
answer count: 2
tagged with: crosswalk-runtime
has answer: http://stackoverflow.com/a/40925577
tagged with: android
tagged with: webview
score: 4
upvote count: 4
linked to: http://stackoverflow.com/q/40802820
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/40925577
downvote count: 0
has title: Crosswalk call Java method from JavaScript
tagged with: java
has body: I'm using crosswalk now. I need to call a Java method when a user clicks a button in the HTML, which may look like: Start I'm not sure if Crosswalk extension is what I wanted, which seems to be so heavy-weighted just for calling a Java function. Is there a simpler way to do this? Or should I use Cordova with Crosswalk in this case?
has answer: http://stackoverflow.com/a/25479138
favorite count: 0
accepted answer: http://stackoverflow.com/a/25479138
type: Question

http://stackoverflow.com/comment/39809813
type: Comment
comment on: http://stackoverflow.com/a/25503180
type: AnswerComment
has text: Alright. Thanks for the answer. Is this amount of threads strange if my application consists of 3 threads with no clients connected (with the main thread)?
score: 0

http://stackoverflow.com/comment/39887130
type: Comment
comment on: http://stackoverflow.com/q/25521097
score: 0
type: QuestionComment
has text: I just want to know if I can access that html,

http://stackoverflow.com/q/25420441
upvote count: 2
tagged with: soap
tagged with: web-services
possible better answer: http://stackoverflow.com/a/25424393
accepted answer: http://stackoverflow.com/a/25428492
has answer: http://stackoverflow.com/a/25424393
score: 2
has answer: http://stackoverflow.com/a/25428492
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/39661981
tagged with: java
downvote count: 0
tagged with: jax-ws
tagged with: jaxb
has body: Is it possible to pass an enum as @WebParam in a SOAP webservice? @XmlEnum public enum TestEnum { TEST; } @WebService public class WebService { @WebMethod public void test(@WebParam TestEnum test) { Sysout(test); } } At least if I do it this way and test with soapUI with test the printout is always null.
favorite count: 0
type: Question
has title: Pass an enum as @WebParam?
has comment: http://stackoverflow.com/comment/39656905

http://stackoverflow.com/comment/39873891
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25506899
has text: Maybe you don't need access to gmail-specific features? Try a generic SMTP clients instead
type: Comment

http://stackoverflow.com/comment/39727028
comment on: http://stackoverflow.com/q/25458887
type: QuestionComment
has text: try call `this.notifyDataSetChanged();` after `ImageListAdapter.notifyDataSetChanged();`
score: 0
type: Comment

http://stackoverflow.com/comment/39848231
score: 2
type: Comment
has text: Both `K` and `h` are valid, just `K` is in the range of `0..11` and `h` is in the range of `1..12`.
type: AnswerComment
comment on: http://stackoverflow.com/a/25524443

http://stackoverflow.com/q/25416908
tagged with: java
answer count: 1
downvote count: 3
has title: Java related that includes using constructor and classes
favorite count: 0
linked to: http://stackoverflow.com/q/25416475
type: Question
has answer: http://stackoverflow.com/a/25416923
has comment: http://stackoverflow.com/comment/39649104
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39649096
score: -1
upvote count: 2
has body: I am self studying for AP computer science and I am having a little bit of trouble with this question. An organization raises money by selling boxes of cookies. A cookie order specifies the variety of cookie and the number of boxes ordered. The declaration of the CookieOrder class is shown below. public class CookieOrder { /** Constructs a new CookieOrder object. */ public CookieOrder(String variety, int numBoxes) { /* implementation not shown */ } /** @return the variety of cookie being ordered */ public String getVariety() { /* implementation not shown */ } /** @return the number of boxes being ordered */ public int getNumBoxes() { /* implementation not shown */ } // There may be instance variables, constr uctors, and methods that are not shown. } The MasterOrder class maintains a list of the cookies to be purchased. The declaration of the MasterOrder class is shown below. public class MasterOrder { /** The list of all cookie orders */ private List&lt;CookieOrder&gt; orders; /** Constructs a new MasterOrder object. */ public MasterOrder() { orders = new ArrayList&lt;CookieOrder&gt;(); } /** Adds theOrder to the master order. * @param theOrder the cookie order to add to the master order */ public void addOrder(CookieOrder theOrder) { orders.add(theOrder); } /** @return the sum of the number of boxes of all of the cookie orders */ public int getTotalBoxes() { /* to be implemented in part (a) */ } /** Removes all cookie orders from the master order that have the same variety of * cookie as cookieVar and returns the total number of boxes that were removed. * @param cookieVar the variety of cookies to remove from the master order * @return the total number of boxes of cookieVar in the cookie orders removed */ public int removeVariety(String cookieVar) { /* to be implemented in part (b) */ } // There may be instance variables, constr uctors, and methods that are not shown. } (a) The getTotalBoxes method computes and returns the sum of the number of boxes of all cookie o…

http://stackoverflow.com/q/25397227
has body: i was trying to get the available mixtures in MAC OSX using the below code. Even though i connected 3 different audio device, and able to see the same in system sound settings,below code doesn’t display all. i.e. mix.getMixerInfo()).isLineSupported(info) is not allowing to display anything and even not able to connect using java . The same is working fine with windows version. public static void main(String[] args) { String sf_ringtone = "/Users/abc.WAV"; AudioInputStream stream = null; try { stream = AudioSystem.getAudioInputStream(new File(sf_ringtone)); } catch (UnsupportedAudioFileException ex) { System.out.println(ex.getStackTrace().toString()); } catch (IOException ex) { System.out.println(ex.getStackTrace().toString()); } AudioFormat format=null; format = stream.getFormat(); if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) { format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, format.getSampleRate(), format.getSampleSizeInBits() * 2, format.getChannels(), format.getFrameSize() * 2, format.getFrameRate(), true); // big endian stream = AudioSystem.getAudioInputStream(format, stream); } DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat(), ((int) stream.getFrameLength() * format.getFrameSize())); ArrayList&lt;Mixer&gt; mixerList = (ArrayList&lt;Mixer&gt;) getAllMixer(); for(Mixer mix:mixerList) { System.out.println(" Mixture "+mix.getMixerInfo().getName()); } ArrayList&lt;String&gt; cmbRingtonePlayback = new ArrayList&lt;String&gt;(); for (Mixer mix : mixerList) { if (AudioSystem.getMixer(mix.getMixerInfo()).isLineSupported(info)) { System.out.println(supported mixture :: "+mix.getMixerInfo().getName()); } } } output: Mixture Java Sound Audio Engine Mixture Built-in Input Mixture JABRA TALK Mixture Logitech USB Headset supported mixture :: Java Sound Audio Engine Is this a limitation of sound API in mac osx ?, or is there any other way to do this in mac?
tagged with: macos
has title: how get available audio devices connected using java in mac osx
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/28667844
accepted answer: http://stackoverflow.com/a/28667844
answer count: 1
favorite count: 0
type: Question
tagged with: audio
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/39690558
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25439565
type: Comment
has text: Why do you need to do this in one statement?

http://stackoverflow.com/comment/39830485
type: Comment
type: AnswerComment
has text: Thanks gaurav, I believe I saw your post somewhere, maybe on ms forums, though I cannot remember. I have edited the question after your comments. Hoping that you could help. Thanks
comment on: http://stackoverflow.com/a/25462267
score: 0

http://stackoverflow.com/comment/39889363
comment on: http://stackoverflow.com/a/25536365
score: 0
type: AnswerComment
has text: @SimonRemington It doesn't make sense to put all this code in a constructor at all, since you are not really constructing an object, you are just getting inputs from the user and print some outputs. I'd put all this code in a static method. And instead of the recursive calls, put all the code in a while loop - `boolean needInput=true;while (needInput) {}`. Inside the loop, in any place you currently call the constructor, replace it with `continue`, which would proceed to the new iteration of the loop. set `needInput` to false when you which to quit the program.
type: Comment

http://stackoverflow.com/comment/39790978
comment on: http://stackoverflow.com/q/25493177
type: Comment
type: QuestionComment
score: 0
has text: @ViscountRandom this is a nasty bug! :-D

http://stackoverflow.com/q/25547630
has title: Error in casting during creation of the Ontology class
tagged with: agents-jade
has body: I have created a vocabulary as Network_Vocabulary interface I have created a class CustomerAgentStatus implements the AgentAction I have then created an ontology class defining the ontology as: I was getting an error as : java.lang.ExceptionInitializerError I then followed instructions as had been suggested in a similar problem as follows: http://jade.tilab.com/pipermail/jade-develop/2013q3/019284.html Accordingly i put the **ontology = NetworkOntology.getInstance();** inside the setup() method and surrounded it with try/catch After the stack Trace i got the following errors, I feel there is some error in the ontology class: I'm getting an error as: Java.Lang.ClassCastException: jade.content.schema.Concept Schema cannot be cast to jade .content.schema.PrimitiveSchema** My Ontology class implementation is as follows: package CellularNetwork; import jade.content.onto.*; import jade.content.schema.*; public class Network_Ontology extends Ontology implements Network_Vocabulary { public static final String ONTOLOGY_NAME = "Network-Ontology"; private static Ontology instance = new Network_Ontology(); public static Ontology getInstance() { return instance; } // Private constructor private Network_Ontology() { super(ONTOLOGY_NAME, BasicOntology.getInstance()); try{ AgentActionSchema cs = new AgentActionSchema(CUSTOMERAGENTSTATUS); add(cs, CustomerAgentStatus.class); cs.add(X_CO_ORDINATE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT)); cs.add(Y_CO_ORDINATE, (PrimitiveSchema) getSchema(BasicOntology.FLOAT)); cs.add(DIRECTION, (PrimitiveSchema) getSchema(BasicOntology.STRING)); cs.add(SPEED, (PrimitiveSchema) getSchema(BasicOntology.FLOAT)); cs.add(CURRENT_PROVIDER,(PrimitiveSchema) getSchema(BasicOntology.AID)); } catch (OntologyException oe) { oe.printStackTrace(); } } }// Network_Ontology
type: Question
has comment: http://stackoverflow.com/comment/39896370
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39895924
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/56209677

http://stackoverflow.com/q/25538711
tagged with: mapdb
score: 2
upvote count: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25865581
accepted answer: http://stackoverflow.com/a/25865581
answer count: 1
has comment: http://stackoverflow.com/comment/39901499
has body: so I have a list of around 20 million key value pairs, and I'm storing the data in several MapDB's differently to see how it affects my programs performance, and for experiment sake. The thing is, it takes quite a lot of time to insert (in random order) 20 million key-value pairs into a mapdb. So, I would like to sort the list of key-value pairs I have so I can insert them faster, and thus build databases faster out of them. So, how would I go about this? I'd like to learn how to do this for MapDB's BTreeSet and BTreeMap, or, MapDBs that use single key-value pairs and MapDBs that have multiple values for a single key. EDIT: I forgot to mention, the key-value pairs are String objects.
favorite count: 0
type: Question
has title: How to sort items for faster insertion in the MapDB BTree?
tagged with: java

http://stackoverflow.com/comment/39782200
has text: use `next()` instead of `nextLine()`
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25488821
type: QuestionComment

http://stackoverflow.com/q/25527205
type: Question
has comment: http://stackoverflow.com/comment/39853633
has comment: http://stackoverflow.com/comment/39853617
answer count: 0
has comment: http://stackoverflow.com/comment/39853232
has comment: http://stackoverflow.com/comment/39871377
type: UnansweredQuestion
has title: Strange behavior of Graphics2D.getDeviceConfiguration()
has comment: http://stackoverflow.com/comment/39853277
score: 0
has comment: http://stackoverflow.com/comment/39853981
has comment: http://stackoverflow.com/comment/39853582
tagged with: java
has body: This is a sketch of my program to illustrate the problem: view = getGraphicsConfiguration().createCompatibleImage(100, 100); // creating a BufferedImage with size 100x100 Rectangle r = view.createGraphics().getDeviceConfiguration().getBounds(); // this correctly returns a rectangle of 100x100, as in my understanding the device // is the BufferedImage and its size is 100x100 /* Later a new object is created, where 'view' again is assigned, so it is a different instance variable (even if it were the same object, I would not understand the behavior). */ view = getGraphicsConfiguration().createCompatibleImage(200, 200); // creating a BufferedImage with size 200x200 Rectangle r = view.createGraphics().getDeviceConfiguration().getBounds(); // now this again returns a rectangle of 100x100, though I would expect it to return // 200x200 (!?), for some reason the system seems to remember the old settings? I checked the GraphicsConfiguration returned by the two calls to getDeviceConfiguration() above. It is the same object. Thanks for any comments!

http://stackoverflow.com/q/25398773
has answer: http://stackoverflow.com/a/25398896
has comment: http://stackoverflow.com/comment/39614921
has answer: http://stackoverflow.com/a/25398825
score: 0
tagged with: java
answer count: 4
type: Question
tagged with: interface
tagged with: android-library
tagged with: android
has body: I having a pager adapter as following public class MainPagerFragmentAdapter extends FragmentPagerAdapter implements IdInterface { ContactsFragment contactSearch; public MainPagerFragmentAdapter(FragmentManager fragmentManager) { super(fragmentManager); } @Override public Fragment getItem(int position) { switch (position) { case 0: if (contactSearch == null) contactSearch = new ContactsFragment(); return contactSearch; } return null; } public void onRawIdAcquired(long arg0) { Log.d("LOG","id=" + arg0); } } this is my contacts fragment public class ContactsFragment extends Fragment implements LoaderManager.LoaderCallbacks&lt;Cursor&gt; { private long rawId; private SimpleCursorAdapter mAdapter; public static final String ARG_ID = "RAWID"; public static final String SORT_KEY_PRIMARY = "sort_key"; public static final Uri URI = ContactsContract.Data.CONTENT_URI; public static final String[] PROJECTION = new String[] { ContactsContract.Data._ID, ContactsContract.Data.RAW_CONTACT_ID}; public static final String SELECTION = ContactsContract.Data.MIMETYPE + " = ? "; public static final List&lt;String&gt; ARGS; static { ARGS = new ArrayList&lt;String&gt;(); ARGS.add(ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE); } private ListView mContactList; private View mContactFragmentView; private TextView noResultText; private Button searchOnlineBtn; IdInterface dataPasser; public ContactsFragment() { dataPasser = (IdInterface) null; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); mContactFragmentView = inflater.inflate(R.layout.fragment_contacts, container, false); mContactList = (ListView) mContactFragmentView .findViewById(R.id.contacts_list); String[] fromColumns = { SORT_KEY_PRIMARY }; int[] toViews = { R.id.contactName }; mAdapter = new ContactsCursorAdapter(getActivity(), R.layout.contact_list_item, null, fromColumns, toViews); mContactL…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25398954
has title: Android passing value with interface java nullpointerexception
has answer: http://stackoverflow.com/a/25419507

http://stackoverflow.com/q/25546399
accepted answer: http://stackoverflow.com/a/25550345
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25550345
tagged with: jslider
upvote count: 2
tagged with: curve
answer count: 1
downvote count: 0
favorite count: 0
type: Question
has title: How can I make a JSlider in a curve shape?
has comment: http://stackoverflow.com/comment/39890960
has body: I want to create a Java Application for my parent's Estate Agency holiday let online booking service. Unfortunately I can't yet post images but they want a kind of slider style booking service in which the user slides the bar to select price, bedrooms etc. The design they have given me uses curved sliders but I can't seem to find any help online. They want 5 sliders in a circle which displays the selected figures and has a button to confirm. Does anyone have any ideas? Would it involve drawing a circular curve or something like that? Also is it going to be more trouble than it's worth - after all there are online alternative booking systems but it would be nice to have a bespoke one created. Thanks for you help.
tagged with: java

http://stackoverflow.com/q/25396091
has comment: http://stackoverflow.com/comment/39611576
linked to: http://stackoverflow.com/q/25373449
upvote count: 0
has body: I'm trying to create an app that moves a shape left and right depending on the button pushed. I have an int shapesCond and int colorsCond that changes value depending on which option is selected from my JComboBox. If I only change the value for shapesCond in the "Rectangle" option of the JComboBox, and not in the "Circle" option, a rectangle is printed. But if I change the shapesCond values in both options or change the colorsCond values, my paintComponent(Graphics g) method won't print any shapes. public class DrawShapes extends JFrame { public static final int CANVAS_WIDTH = 500; public static final int CANVAS_HEIGHT = 300; public static final Color CANVAS_BACKGROUND = Color.YELLOW; private int x1 = CANVAS_WIDTH / 4; private int y1 = CANVAS_HEIGHT / 4; private int rectWidth = CANVAS_WIDTH / 2; private int rectHeight = CANVAS_HEIGHT / 2; private int x2 = CANVAS_WIDTH * (1/3); private int y2 = CANVAS_HEIGHT * (2/5); private int circWidth = CANVAS_WIDTH * (1/5); private int circHeight = CANVAS_HEIGHT / 3; private Color blue = new Color(0, 0, 225); private int shapesCond = 0; private int colorsCond = 0; private CanvasDrawArea canvas; public DrawShapes() { JPanel btnPanel = new JPanel(new FlowLayout()); String[] shapeName = {"Rectangle", "Circle"}; JComboBox shapes = new JComboBox(shapeName); shapes.setSelectedIndex(1); btnPanel.add(shapes); shapes.addActionListener(new ActionListener(){ //shapes combobox public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); //copies shapes combo box String msg = (String)cb.getSelectedItem(); switch(msg){ case "Rectangle": shapesCond = 1; break; case "Circle": shapesCond = 2; }//switch end } }); //action listener end String[] colorName = {"Red", "Blue", "Green"}; JComboBox colors = new JComboBox(colorName); //colors combobox colors.setSelectedIndex(1); btnPanel.add(colors); shapes.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource();…
answer count: 1
tagged with: swing
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/39611636
has comment: http://stackoverflow.com/comment/39611652
tagged with: if-statement
tagged with: java
has title: Conditional in paintComponent
has comment: http://stackoverflow.com/comment/39611076
accepted answer: http://stackoverflow.com/a/25396963
score: -1
tagged with: paintcomponent
has answer: http://stackoverflow.com/a/25396963
has comment: http://stackoverflow.com/comment/39610198
favorite count: 0
tagged with: jcombobox
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39611429
has comment: http://stackoverflow.com/comment/39611527
has comment: http://stackoverflow.com/comment/39610174

http://stackoverflow.com/q/25503059
type: Question
has comment: http://stackoverflow.com/comment/39810204
has comment: http://stackoverflow.com/comment/39810470
has comment: http://stackoverflow.com/comment/39839517
linked to: http://stackoverflow.com/q/25467163
has comment: http://stackoverflow.com/comment/39809787
accepted answer: http://stackoverflow.com/a/25519260
has comment: http://stackoverflow.com/comment/39810385
has comment: http://stackoverflow.com/comment/39810070
tagged with: android
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/39820879
has answer: http://stackoverflow.com/a/48181842
has comment: http://stackoverflow.com/comment/39808963
has comment: http://stackoverflow.com/comment/39811253
type: AnsweredQuestion
answer count: 2
score: 5
linked to: http://stackoverflow.com/q/25417439
has comment: http://stackoverflow.com/comment/39820897
has title: android Speech recognition API.System always recognizes default language
possible better answer: http://stackoverflow.com/a/48181842
downvote count: 0
has body: Here is how my code looks. //loc will be either "ru-RU" or "en-US" speechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, loc); speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, loc); speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, loc); Problem is that, when I am using the program with different phones it works well.But with my cell phone it always chooses default language. And rare times it is just mixing recognition languages. Like half of the result is in one language other half in another language. I dont know whether it is cause of system or from code itself? Plus It worked well before on my phone too. Can it be cause of some settings? How can I overcome and fix it? I need to know to inform users how to fix it if they will have the same problem How can I use voice recognition with other languages android SpeechRecognizer with Google Search version 3.6.14.1337016 can't recognize other voice language except default
has answer: http://stackoverflow.com/a/25519260
tagged with: speech-recognition
favorite count: 0

http://stackoverflow.com/q/25516168
accepted answer: http://stackoverflow.com/a/25561651
has answer: http://stackoverflow.com/a/25561651
score: 4
upvote count: 4
type: AnsweredQuestion
tagged with: java
downvote count: 0
tagged with: garbage-collection
answer count: 1
has body: Oracle's javadoc for GarbageCollectorMBean.getCollectionTime says, "Returns the approximate accumulated collection elapsed time in milliseconds." Is that specifically pause time or generally time spent by any of the garbage collector threads?
favorite count: 0
type: Question
has title: Java: does GarbageCollectorMBean.getCollectionTime return pause time or something else?

http://stackoverflow.com/a/53995751
downvote count: 0
upvote count: 1
score: 1
type: Answer
has body: Simple O(1) solution in Java: class Solution { public int solution(int X, int Y, int D) { return (Y-X) % D == 0 ? (Y-X) / D : (Y-X) / D + 1; } }
answers question: http://stackoverflow.com/q/25455903

http://stackoverflow.com/comment/39844598
type: QuestionComment
comment on: http://stackoverflow.com/q/25522311
score: 0
has text: when you autowire that same bean, are the dependencies not null?
type: Comment

http://stackoverflow.com/q/25394998
has comment: http://stackoverflow.com/comment/39608246
duplicate of: http://stackoverflow.com/q/21839182
tagged with: variadic-functions
favorite count: 0
has body: Why won't this compile? public class PrimitiveVarArgs { public static void main(String[] args) { int[] ints = new int[]{1, 2, 3, 4, 5}; prints(ints); } void prints(int... ints) { for(int i : ints) System.out.println(i); } } It complains about line 5, saying: method prints in class PrimitiveVarArgs cannot be applied to given types; required: int[] found: int[] reason: varargs mismatch; int[] cannot be converted to int but as far as I (and others on SO) know, int... is the same as int[]. This works if it's a non-primitive type, like String, but not on primitives. I can't even add this method: void prints(int[] ints) { for(int i : ints) System.out.println(i); } because the compiler says: name clash: prints(int[]) and prints(int...) have the same erasure cannot declare both prints(int[]) and prints(int...) in PrimitiveVarArgs so, why doesn't Java let you pass a native array to a varargs method? Also, if you would please, offer me a way to solve this issue (i.e. provide a way to pass variable arguments or an array to this method).
type: Question
tagged with: primitive-types
accepted answer: http://stackoverflow.com/a/25395038
linked to: http://stackoverflow.com/q/25397551
linked to: http://stackoverflow.com/q/2426455
has answer: http://stackoverflow.com/a/25395038
has comment: http://stackoverflow.com/comment/39613830
tagged with: arrays
has comment: http://stackoverflow.com/comment/39608452
has comment: http://stackoverflow.com/comment/39608165
has comment: http://stackoverflow.com/comment/39634056
upvote count: 6
linked to: http://stackoverflow.com/q/2925153
has title: Why won't Java pass int[] to vararg?
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/21839182
has comment: http://stackoverflow.com/comment/61961287
has comment: http://stackoverflow.com/comment/39608139
tagged with: java
downvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/39608211
has comment: http://stackoverflow.com/comment/39638211

http://stackoverflow.com/comment/39751601
type: QuestionComment
has text: A good exercise would be to step through the code in the debugger, and watch the variable values change.
comment on: http://stackoverflow.com/q/25472221
type: Comment
score: 1

http://stackoverflow.com/comment/39872187
comment on: http://stackoverflow.com/q/25537165
has text: I doubt it. The `Map` returns null because either the key is not present or the value for the key is indeed `null`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39652453
has text: Strictly speaking, there could be a base case if a sub item list is empty.
type: Comment
comment on: http://stackoverflow.com/a/25418918
type: AnswerComment
score: 2

http://stackoverflow.com/comment/39748610
has text: @LoganathanMohanraj . Yeah .that's my fault. Corrected it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25470465
type: Comment

http://stackoverflow.com/a/25501507
answers question: http://stackoverflow.com/q/25495368
score: 7
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39857436
upvote count: 7
has comment: http://stackoverflow.com/comment/39871363
has comment: http://stackoverflow.com/comment/39851280
has body: The SSLHandashskeException tells us that the SSL/TLS handshake has failed, which is because there was a ValidatorException that tells us that the "PKIX path building failed", because there was a SunCertPathBuilderException thrown because the Java API was "unable to find valid certification path to requested target". The Java API (ie. this is not done by Smack) could not build a valid certificate chain to the servers SSL/TLS certificate with the active SSLContext. That is why this exception is thrown. You need to provide either a valid certifcate (however that is defined by your currently used SSLContext) or tell Smack to use a SSLContext (ConnectionConfiguration.setCustomSSLContext(SSLContext)) that accepts your current server certificate
has comment: http://stackoverflow.com/comment/44472186
has comment: http://stackoverflow.com/comment/48477341
has comment: http://stackoverflow.com/comment/39832406
type: Answer
has comment: http://stackoverflow.com/comment/46603489
has comment: http://stackoverflow.com/comment/39850086
has comment: http://stackoverflow.com/comment/39844464
accepted answer of: http://stackoverflow.com/q/25495368
has comment: http://stackoverflow.com/comment/39833053
has comment: http://stackoverflow.com/comment/39813881
has comment: http://stackoverflow.com/comment/39813122

http://stackoverflow.com/a/25445971
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25429659
has body: There's a syntax error in your Pattern, as mentioned in the comments. Here's a walk-through: [-LBQTHWROMSNT](0MIL|[LBCDGJKMNPQSTUVWXYZ][NA][0137CUVRT][PCBMVWTHKNDG])(NR|RR)(?(?&lt;=A[A-Z0-9]{4})[OPLH]|$) Firstly, there's abundance in your character classes. [-LBQTHWROMSNT] can be shortened to [-L-OBQ-THW]; [LBCDGJKMNPQSTUVWXYZ] use a range at the last character section to become [LBCDGJKMNPQS-Z]. (NR|RR) can be changed to ([NR]R) as | alternation follows a backtracking nature and [] lists are optimal and well-suited for usages like these. The pattern syntax error is caused by (?(?&lt;=. This is because in regex patterns, (? is a special pattern syntax. The next character following ? will determine the nature of this group, and it must form a special syntax group - otherwise ? becomes a quantifier and it fails to follow a quantifiable token. In this case, your pattern failed to compile as (?( is no accepted syntax in Java. You might have meant to use a non-capturing group instead. -&gt; (?: ) Read more: Reference - What does this regex mean? Pattern (Java Platform SE 7) documentation
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25429659

http://stackoverflow.com/comment/40319171
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25715394
has text: Unless MOXy offers a configuration option to ignore unknown properties (i.e. as the Jackson object mapper framework does), you have to do some kind of "suboptimal" workaround. I did a quick Google search and a method-based version of the above is detailed here: http://blog.bdoughan.com/2011/06/extensible-models-with-eclipselink-jaxb.html
type: Comment

http://stackoverflow.com/a/25498849
downvote count: 0
answers question: http://stackoverflow.com/q/25491183
has body: Split both the strings and compare the individual words using foreach as shown below: String first = "hello world today"; String second = "Yet another hello worldly day today"; //split the second string into words List&lt;String&gt; wordsOfSecond = Arrays.asList(second.split(" ")); //split and compare each word of the first string for (String word : first.split(" ")) { if(wordsOfSecond.contains(word)) System.out.println(word); }
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25491183
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/39601459
comment on: http://stackoverflow.com/a/25391483
type: AnswerComment
score: 1
has text: Because PreparedStatement inherits from Statement, and thus also allows executing a SQL query without preparing it.
type: Comment

http://stackoverflow.com/comment/39821902
comment on: http://stackoverflow.com/q/25506342
type: Comment
has text: As i am using arraylist is this the reason for bad output
type: QuestionComment
score: 0

http://stackoverflow.com/a/25548951
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25546569
has body: 1.Is java client driver bindings is a sub set of selenium webdriver? can i run automated test scripts without java client driver jar? If you want to write your selenium test cases using java, yes it is necessary to have.So you can say java client driver bindings is a subset of selenium webdriver to write and execute your test cases using java. 2.What are the usage of selenium server and java client driver and how both differs from each other? Selenium Server.jar is used to run selenium server which was mandatory to run while there were Selenium RC only. Now with the arrival of Selenium 2.0 if your test cases are being executed on your local machine only you may not require Selenium Server. If you want to run your test cases on a remote machine using RemoteWebdriver then only you would be needing Selenium Server.You can say its more or less the part of Selenium Grid.
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25546569

http://stackoverflow.com/comment/39673261
score: 0
has text: This looks like https://bugs.openjdk.java.net/browse/JDK-8051402
comment on: http://stackoverflow.com/q/25414867
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25541699
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/39887528
tagged with: pdfbox
tagged with: image
type: Question
upvote count: 2
type: UnansweredQuestion
has title: How can I get Images coordinates in pdf into JSONfile?
answer count: 1
has answer: http://stackoverflow.com/a/27876998
has body: I have coded creating html page included images extracting a page in pdf document. I had tried to extract images from pdf and then I succeeded to extract images from pdf and to apply the images to html page using PDFBox lib. but I did not extract image coordinates in html page. So searched how to extract image coordinates in pdf, I tried to extract image coordinates in pdf using PDFBox Library. Below code : public static void main(String[] args) throws Exception { try { PDDocument document = PDDocument.load( "/Users/tmdtjq/Downloads/PDFTest/test.pdf" ); PrintImageLocations printer = new PrintImageLocations(); List allPages = document.getDocumentCatalog().getAllPages(); for( int i=0; i&lt;allPages.size(); i++ ) { PDPage page = (PDPage)allPages.get( i ); int pageNum = i+1; System.out.println( "Processing page: " + pageNum ); printer.processStream( page, page.findResources(), page.getContents().getStream() ); } } finally { } } protected void processOperator( PDFOperator operator, List arguments ) throws IOException { String operation = operator.getOperation(); if( operation.equals( "Do" ) ) { COSName objectName = (COSName)arguments.get( 0 ); Map xobjects = getResources().getXObjects(); PDXObject xobject = xobjects.get( objectName.getName() ); if( xobject instanceof PDXObjectImage ) { try { PDXObjectImage image = (PDXObjectImage)xobject; PDPage page = getCurrentPage(); Matrix ctm = getGraphicsState().getCurrentTransformationMatrix(); double rotationInRadians =(page.findRotation() * Math.PI)/180; AffineTransform rotation = new AffineTransform(); rotation.setToRotation( rotationInRadians ); AffineTransform rotationInverse = rotation.createInverse(); Matrix rotationInverseMatrix = new Matrix(); rotationInverseMatrix.setFromAffineTransform( rotationInverse ); Matrix rotationMatrix = new Matrix(); rotationMatrix.setFromAffineTransform( rotation ); Matrix unrotatedCTM = ctm.multiply( rotationInverseMatrix ); float xScale = unrotatedCTM.getXScale(); float yScale = unrotatedCTM…
favorite count: 0
score: 2
downvote count: 0

http://stackoverflow.com/comment/39751250
has text: @Dude please do yourself a favour and read about [`volatile`](http://stackoverflow.com/a/106787/2071828) in Java. There **is** a race hazard here. This is why I said that you should use the Interrupt API instead. But if you do not know about atomicity/visibility I would **strongly** suggest you read up before doing any threading at all!
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25471810
type: Comment

listview
tags question: http://stackoverflow.com/q/25475989
tags question: http://stackoverflow.com/q/25484282
tags question: http://stackoverflow.com/q/25447060
tags question: http://stackoverflow.com/q/25451349
tags question: http://stackoverflow.com/q/25464869
tags question: http://stackoverflow.com/q/25546781
tags question: http://stackoverflow.com/q/25424045
tags question: http://stackoverflow.com/q/25513188
tags question: http://stackoverflow.com/q/25544978
tags question: http://stackoverflow.com/q/25415570
tags question: http://stackoverflow.com/q/25430242
tag name: listview
tags question: http://stackoverflow.com/q/25441289
tags question: http://stackoverflow.com/q/25479970
tags question: http://stackoverflow.com/q/25394084
tags question: http://stackoverflow.com/q/25429570
tags question: http://stackoverflow.com/q/25431905
tags question: http://stackoverflow.com/q/25456705
tags question: http://stackoverflow.com/q/25540813
tags question: http://stackoverflow.com/q/25473037
type: Tag
tags question: http://stackoverflow.com/q/25509245
tags question: http://stackoverflow.com/q/25405444
tags question: http://stackoverflow.com/q/25491609
tags question: http://stackoverflow.com/q/25462039
tags question: http://stackoverflow.com/q/25541295

http://stackoverflow.com/comment/40020157
has text: @JulianReschke The evidence here is that `HttpServletRequest` doesn't agree.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25518037
type: Comment

http://stackoverflow.com/q/25475972
possible better answer: http://stackoverflow.com/a/25476122
has comment: http://stackoverflow.com/comment/39759429
has comment: http://stackoverflow.com/comment/126898237
has comment: http://stackoverflow.com/comment/39758888
tagged with: java
has body: I want to write a JFrame which has content of changing size. The JFrame should adjust to the size of its content. Additionally, the JFrame should not be resizable. Here is my code: public class MyFrame { public static void main(String[] args) { new MyFrame(); } private JFrame frame; private JLabel label; private boolean labelVisible = false; public MyFrame() { label = new JLabel("label"); frame = new JFrame(); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new GridLayout(0, 1, 5, 5)); frame.getContentPane().add(createButton()); frame.pack(); frame.setVisible(true); } private JButton createButton() { JButton button = new JButton("toggleLabel"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (labelVisible) { frame.getContentPane().remove(label); } else { frame.getContentPane().add(label); } labelVisible = !labelVisible; frame.pack(); System.out.println(frame.getLocation()); } }); return button; } } Here is the problem: If I resize the JFrame (by adding or removing a label), the JFrame changes its location (it moves down a bit). However, if I remove the line frame.setResizable(false), the location of the JFrame will not be changed anymore. Can I do anything about that? Can I have a JFrame that is not resizable by the user, but resizable by the code? Edit: Here is the output after clicking the button several times: java.awt.Point[x=75,y=62] java.awt.Point[x=75,y=90] java.awt.Point[x=75,y=118] java.awt.Point[x=75,y=146] java.awt.Point[x=75,y=174] java.awt.Point[x=75,y=202] java.awt.Point[x=75,y=230] java.awt.Point[x=75,y=286] java.awt.Point[x=75,y=286] java.awt.Point[x=75,y=314] java.awt.Point[x=75,y=342] As you can see, the y-coordinate increases with every click. Edit2: As @camickr pointed out in the comments, it seems to be a platform specific problem. I am using Ubuntu 14.04 64-bit with java-7-oracle 64-bit (1.7.0_67).
accepted answer: http://stackoverflow.com/a/25476265
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25476265
linked to: http://stackoverflow.com/q/71809915
answer count: 2
has answer: http://stackoverflow.com/a/25476122
tagged with: jframe
score: 0
tagged with: user-interface
has comment: http://stackoverflow.com/comment/39758485
has title: Not resizable JFrame changes location on pack()
tagged with: resize
tagged with: swing
has comment: http://stackoverflow.com/comment/39758755
has comment: http://stackoverflow.com/comment/126899195
has comment: http://stackoverflow.com/comment/39758696
type: Question

http://stackoverflow.com/a/25446321
downvote count: 0
answers question: http://stackoverflow.com/q/25445884
has comment: http://stackoverflow.com/comment/39702683
type: AcceptedAnswer
upvote count: 2
has body: Most Eclipse plugins can only be run in the Eclipse environment because they rely on the Eclipse/OSGi plugin infrastructure being initialized properly. Since JDIDebugModel.createLineBreakpoint requires an IResource object it can only be used in the Eclipse IDE (or an RCP based on the IDE) with a workspace. So, yes, you can use this in a Eclipse plugin which would have to be installed in to Eclipse or an Eclipse RCP.
type: Answer
has comment: http://stackoverflow.com/comment/39702425
accepted answer of: http://stackoverflow.com/q/25445884
score: 2

http://stackoverflow.com/q/25513629
tagged with: int
score: 1
tagged with: java
tagged with: size
has comment: http://stackoverflow.com/comment/39828866
tagged with: memory
has answer: http://stackoverflow.com/a/25513649
linked to: http://stackoverflow.com/q/383551
type: Question
tagged with: boolean
answer count: 2
has comment: http://stackoverflow.com/comment/39828785
has title: Memory / Size of a boolean vs int?
upvote count: 2
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/383551
has comment: http://stackoverflow.com/comment/39828878
downvote count: 1
favorite count: 0
has body: After thinking about ways to minimize my app size I wondered.. public int; public boolean; does one take up more memory than the other? if instead they are: public int = 0; public boolean = false; any difference there? What about using an integer instead of a boolean( 1 &amp; 2 ). Does that somehow take up less memory / space?
has answer: http://stackoverflow.com/a/25513662

http://stackoverflow.com/a/25518097
has comment: http://stackoverflow.com/comment/39837524
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25518066
score: 2
has body: Do you have an idea why I am getting the exception? Yea ... It is impossible for your eingabe string to contain a character that equals -1. (Even the character0xffff is going to convert into the integer 65535.) So your while loop is simply indexing off the end of the string. (And Java strings are not terminated by any particular character anyway. Java ain't C or C++.) Use eingabe.length() to tell you when to stop ... After an hour of looking for an solution in stackoverflow and other forums I gave up. Here's some free advice: What you are doing is NOT the right way to solve program problems. The right way to program is to read and understand your code, based on your knowledge of the Java language and the class libraries. If you don't have the knowledge yet ... Do the Oracle Java Tutorials, or buy and read a good beginners Java textbook. Read the javadocs for the classes that you are attempting to use. Googling for solutions to simple programming problems is probably a waste of time. You won't learn much, and there is a good chance you will find incorrect or inappropriate solutions, and/or you won't recognize the right solutions when you see them.
upvote count: 2

http://stackoverflow.com/comment/39612340
has text: Perhaps try http://stackoverflow.com/questions/3162399/gwt-confirmation-dialog-box - http://www.java2s.com/Code/Java/GWT/CreateCustomDialog.htm
comment on: http://stackoverflow.com/q/25397298
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39767953
type: Comment
score: 0
type: AnswerComment
has text: It is a List of List of Strings. Also if the proper method wasn't implemented, the compiler would have thrown an error stating the same.
comment on: http://stackoverflow.com/a/25481047

http://stackoverflow.com/a/25480263
has comment: http://stackoverflow.com/comment/39766701
answers question: http://stackoverflow.com/q/25480178
score: 1
has body: As per JAVA API for ObjectInputStream, the method readObject throws checked exceptions - IOException, ClassNotFoundException So either throw this exception from main method: public static void main(String[] args) throws IOException, ClassNotFoundException or handle it using try/catch blocks: try { listOfEmployeesIn[i] = (Employee) objIn.readObject(); } catch (ClassNotFoundException e) { e.printStackTrace(); }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25480178
has comment: http://stackoverflow.com/comment/39766765
has comment: http://stackoverflow.com/comment/39766551
upvote count: 2
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/39766502
has comment: http://stackoverflow.com/comment/39772655

http://stackoverflow.com/comment/39664689
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25425801
has text: Have you tried setting a breakpoint in this code and stepping through it to see what happens? Currently it will never display an exception because you're basically swallowing any `ClassNotFoundException`s or `SQLException`s that occur (writing the exceptions to the console which isn't any help for servlet code). Also, you should probably put the last four lines in your `while-loop` just *after* it instead.

http://stackoverflow.com/comment/39814520
score: 0
has text: @user725455 There should be same car. Could u show the Car class?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25505791

http://stackoverflow.com/q/25465320
has comment: http://stackoverflow.com/comment/39760300
linked to: http://stackoverflow.com/q/2925054
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39760253
has answer: http://stackoverflow.com/a/25497692
possible better answer: http://stackoverflow.com/a/25497692
linked to: http://stackoverflow.com/q/6543881
favorite count: 0
has answer: http://stackoverflow.com/a/25493743
accepted answer: http://stackoverflow.com/a/25493743
score: 9
type: Question
upvote count: 9
answer count: 2
has title: Comparing Java swing MVC with Android design pattern
tagged with: android
has comment: http://stackoverflow.com/comment/39972653
tagged with: swing
tagged with: design-patterns
tagged with: model-view-controller
has body: I'm doing a small research on design patterns in various platforms and I have prior experience in programming with Java. While reading these posts: MVC pattern on Android and MVC architecture in Android, I had an interesting question in mind: Why Java swing MVC can not be compared with Android development pattern? or Why we can't say that Android follows MVC? (in the context of overall "look and feel"). In one answer, someone clarified MVC as: Model: What to render View: How to render Controller: Events, user input OK. well, now what I understand is: Java Swing MVC: In Java swing MVC, component class is an abstract class for all attributes in visual environment. There is a distinct keyword called controls is used for some components such as buttons, lists etc. So, all controls and components are part of Model in MVC. Container inherits component. and there are several LayoutManagers that defines layouts and place of components in container. Also there are Listenershave to be registered with according EventSources. So, they all are the View in MVC. Class that implements Listener interface methods in which we put our main logic and there are some EventClasses for each event. They all are part of Controller in MVC. putting all these examples together in an image; in swing MVC we have: Android design pattern (visualizing as MVC): I think widgets are same as controls here. Also, there are some other EventSources.They all act as a Model. View package has viewgroups (that also contains several kinds of layouts.) and Listener interfaces. they all are the part of View in MVC. Same as swing MVC, we can say Listener interface methods and activities are the part of controller. putting all together in an image; in Android we have: As per above comparison, I consider following similarities: Container - same as View Layout managers - same as ViewGroup Listeners - overall same in both architecture controls - overall same as widgets Event delegation (registering appropriate listener…
type: AnsweredQuestion

http://stackoverflow.com/comment/39717645
type: Comment
score: 0
has text: yeah, the code here is for illustration; the actual code is too complicated to put here. I want to know, in generic, how to make List visible among threads; there may be no CountDownLatch in place
type: AnswerComment
comment on: http://stackoverflow.com/a/25453980

http://stackoverflow.com/comment/39694687
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25441650
has text: Thank you for your help. Just out of curiosity, how do we determine when we should manually dispose of listeners and when eclipse handles it implicitly?
score: 0

http://stackoverflow.com/comment/39753968
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25471271
has text: I have had VerifyErors before and switching from OpenJDK to Oracle JDK solved many issues for me...
score: 0

http://stackoverflow.com/q/25411322
score: 0
tagged with: batch-file
has body: I have this windows batch file which starts Java application java -jar bin/felix.jar msg "%username%" JVM version 1.8.0_20 is not installed Is there a way to display message when Java is not found on the computer?
tagged with: windows
tagged with: java
has answer: http://stackoverflow.com/a/25411515
tagged with: cmd
has title: Display error dialog from batch file
type: Question
type: UnansweredQuestion
answer count: 1
tagged with: powershell

http://stackoverflow.com/a/25545661
has body: You have 2 FrameLayouts, but you didn't specify their position. You can use android:layout_toRightOf property on the camera_previewr and point to camera_previewl as anchor. But RelativeLayout is not needed here if you just want to place 2 Views horizontally, use LinearLayout as root container instead with android:orientation="horizontal"
score: 0
has comment: http://stackoverflow.com/comment/39886771
answers question: http://stackoverflow.com/q/25545518
has comment: http://stackoverflow.com/comment/39886897
type: Answer

http://stackoverflow.com/q/25518253
tagged with: jaxb
downvote count: 1
linked to: http://stackoverflow.com/q/4312572
favorite count: 0
duplicate of: http://stackoverflow.com/q/5720501
type: Question
has body: Using JAXB, when there is two namespace in the object, I added package-info.java in the pakage, it remove one namespace prefix, like this Jaxb generated xml - problem with root element prefix My objects like this: @XmlRootElement(name="Message",namespace="http://404story.com/Order") public class Root { private String id; private Codes codes; public String getId() { return id; } public void setId(String id) { this.id = id; } } @XmlRootElement(name="Codes") public class Codes { @XmlElement(name = "Code", namespace = "http://404story.com/Code") protected List<String> Code; .... } package-info.java: @XmlSchema(namespace = "http://404story.com/Order", elementFormDefault = XmlNsForm.QUALIFIED) package com.xxxx; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlSchema; But when there is two namespaces, it turns to be like this: and some part will use <ns2:Code>xxx</ns2:Code>. Could you tell me how to remove the ns2 prefix? And put the namespace like: xxxx xxxx
type: UnansweredQuestion
has title: Jaxb generated xml - remove namespace prefix
tagged with: namespaces
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/5720501
answer count: 0
score: 2
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/39775795
score: 0
comment on: http://stackoverflow.com/q/25485309
type: Comment
has text: @daerin Thanks.. I looked at it initially.. it works.. but result is not paginated.. somehow I need `Page<Class>` entity to be returned
type: QuestionComment

http://stackoverflow.com/comment/74882073
comment on: http://stackoverflow.com/a/25471310
score: 0
type: AnswerComment
has text: Is there a way to always preserve the aspect ratio when resizing textures/backgrounds?
type: Comment

overlapping-matches
tag name: overlapping-matches
tags question: http://stackoverflow.com/q/25480496
type: Tag

http://stackoverflow.com/q/25432276
downvote count: 1
has comment: http://stackoverflow.com/comment/56251041
favorite count: 0
linked to: http://stackoverflow.com/q/18807276
has comment: http://stackoverflow.com/comment/39677970
possible better answer: http://stackoverflow.com/a/25438489
has body: I am currently doing a Java project which has been in development for a few months. The project is almost complete, and now I realized that Postgres is a case sensitive. During my login process, it can't differentiate between username and "UserName". I am using Java base, Hibernate and JPA as the backend implementation, and using Postgres as the database. I have been searching internet for the solutions, and most of the answer I get were suggesting me using solution: select loginId from user where lower(loginId)=loginid.toLowerCase(); or change the data type for the table column to citext. But is there any faster way of doing this? Or maybe is there any variable in Postgres.conf able to control case insensitive? Or in hibernate I able to control it easily? I understand that using method lower(loginId)=loginId.toLowerCase() is the easiest way to fix the problem, but there is a lot of code that I need to change in my project, which might take a long time to fix. Change the data type to citext is not really a good solution for a project which has implemented long ago. Is anyone here has a better solution to fix my current issue?
has answer: http://stackoverflow.com/a/25461597
type: Question
accepted answer: http://stackoverflow.com/a/25460823
tagged with: jpa
has answer: http://stackoverflow.com/a/25460823
upvote count: 1
has title: Case insensitive in Postgres
tagged with: postgresql
answer count: 3
has answer: http://stackoverflow.com/a/25438489
tagged with: case-insensitive
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/39682193
type: QuestionComment
score: 0
has text: same error :/ have i forgotten to do something in the PLayer2pong class ?
type: Comment
comment on: http://stackoverflow.com/q/25434353

http://stackoverflow.com/comment/39806425
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25501217
has text: *"Sorry if you thought the code was a little long winded"* It's not, and I never wrote anything like that. It is not Complete, Verifiable, nor an Example. Read the link.
score: 0

http://stackoverflow.com/q/25506618
downvote count: 1
favorite count: 0
tagged with: testng
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25508700
has answer: http://stackoverflow.com/a/25508700
upvote count: 1
tagged with: unit-testing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25506711
linked to: http://stackoverflow.com/q/22672263
has body: I would like to know, if it is possible to add parameters to Junit tests like you do it in testNg with the xml-Files. I know that you can have parameterized tests in Junit, but that's not what I want. A short example how I do it now: String example = "test" String name = "test ... @Test public void testCase(){ Page.addParameter(example); And I want to get rid of these variables in the method, and want to get it from a xml-File or an other method. Does anybody have an idea how to solve that?
has title: How to add parameters to JUnit tests? Is it possible to add them like in testNg?
has answer: http://stackoverflow.com/a/25506711
score: 0
tagged with: java
tagged with: junit
tagged with: selenium

http://stackoverflow.com/a/69660212
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25543910
has body: Same issue here. In my case it was caused by an abstract test class in a separate test package from which all my NG tests were derived. Once I moved that abstract class to the root of the test package, it worked.

http://stackoverflow.com/q/25479646
tagged with: http://stackoverflow.com/tag/c
tagged with: mapreduce
tagged with: hadoop
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25481753
answer count: 2
has answer: http://stackoverflow.com/a/25481753
has body: I am new to Hadoop. I want to cluster ~150 million items with each of them having ~30 attributes using Hierarchical Clustering. Total number of dimensions/attributes is ~5000. I have designed a multi-level solution by partitioning the whole data and performing clustering on each partitions and merging each cluster there after until desired number of clusters are retrieved. - Clustering is performed in each map task. So, each map task would be cpu-intensive. - I am stuck at deciding about which of the following options to use: - Map-Reduce in native Java. - Map-Reduce using Hadoop Streaming on C.(This is because of each task being cpu-intensive). Which option should I go with?. Is there any other way I could achieve my destination?
tagged with: java
downvote count: 0
has title: Hadoop Java vs C/C++ on cpu-intensive tasks
possible better answer: http://stackoverflow.com/a/25479783
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25479783
score: 5
upvote count: 5
tagged with: cluster-analysis

http://stackoverflow.com/q/25453916
type: AnsweredQuestion
has title: How do I take bytes and make a image file out of it in Java?
tagged with: java
tagged with: image-processing
tagged with: image
type: Question
accepted answer: http://stackoverflow.com/a/25454206
has answer: http://stackoverflow.com/a/25454206
score: 0
has comment: http://stackoverflow.com/comment/39717509
answer count: 1
has body: A person on my team is computing a task that results in an array of RGB bytes. The program runs headless environment on a server, so does that mean I can't import any awt classes? I want to use an OutputStream to send the bytes to browser in a HTTP GET. I have it all working with a PNG file that is saved on the server's HDD, but now I want to use a byte[] instead of a File. My code looks like this now for reading a file. I am having trouble making it work for a byte[]. I tried just feeding the outputstream some random bytes but I never get an image in the browser. I know it will not look like the file, but I expected something random to show up, but nothing did. File file = new File("images/test.png"); FileInputStream in = new FileInputStream(file); OutputStream out = new OutputStream(); byte[] buf = new byte[1024]; int count = 0; while((count = in.read(buf)) &gt;= 0) { out.write(buf, 0, count); } out.close; in.close;
tagged with: http://stackoverflow.com/tag/png
tagged with: http://stackoverflow.com/tag/jpeg
has comment: http://stackoverflow.com/comment/39717807

http://stackoverflow.com/comment/39710640
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25442822
score: 0
has text: Did you really try printing the person object after you load it (after em.find())? Don't assume, but please try.

http://stackoverflow.com/comment/39768835
comment on: http://stackoverflow.com/a/25479974
type: Comment
type: AnswerComment
score: 0
has text: initialized it to what?

http://stackoverflow.com/q/25403619
tagged with: java
tagged with: multipage
type: Question
type: UnansweredQuestion
answer count: 1
tagged with: windowbuilder
has answer: http://stackoverflow.com/a/25404094
tagged with: eclipse-plugin
has title: How to call createFormContent() method in FormPage class when using eclipse WindowBuilder
has body: How to call createFormContent() method in the class(extended by FormPage class) which is created by eclipse WindowBuilder plugin? I created a class to act as a swt gui using eclipse window Buider plugin, but I am unable to use it in my java class which is actually a multi page editor. I want to use that UI in a page in my multi page editor. How to do that? I think I should call that createFormContent(IManagedForm managedForm) method but what should be passed as the argument?
score: 0

http://stackoverflow.com/a/29474499
has body: In order to get warbler to work in our environment, we currently do: Install copies of gems locally in project: bundle install --path=./bundle Lock and cache gems in .vendor/cache (only have to run once) bundle package --all Finally, bundle update It feels bloated, but it is working for me currently.
type: Answer
answers question: http://stackoverflow.com/q/25430303
score: 0

http://stackoverflow.com/a/25503465
has comment: http://stackoverflow.com/comment/39810591
accepted answer of: http://stackoverflow.com/q/25502314
has comment: http://stackoverflow.com/comment/39810697
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25502314
type: Answer
has body: The only way I can think of to align the first column of each Composite is to set the GridData#widthHint to the same value. This value would have to be the maximal width of any of the elements in the first column. I gave it a try and came up with this solution (it's not optimized and consequently might not be the most efficient way to do it): private static Random random = new Random(System.currentTimeMillis()); public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new GridLayout(1, false)); Composite first = createComposite(shell); Composite second = createComposite(shell); synchronizeFirstColumn(2, first, second); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } private static Composite createComposite(Shell shell) { Composite comp = new Composite(shell, SWT.BORDER); comp.setLayout(new GridLayout(2, false)); comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); for (int i = 0; i &lt; 3; i++) { String content = UUID.randomUUID().toString(); content = content.substring(0, Math.round(random.nextFloat() * content.length())); Label label = new Label(comp, SWT.RIGHT); label.setText(content); label.setLayoutData(new GridData(SWT.END, SWT.TOP, false, false)); Text text = new Text(comp, SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); } return comp; } private static void synchronizeFirstColumn(int nrOfColumns, Composite... comps) { if (comps == null || comps.length == 0) return; int maxWidth = 0; for (Composite comp : comps) { Control[] controls = comp.getChildren(); for (int i = 0; i &lt; controls.length; i += nrOfColumns) { int width = controls[i].computeSize(SWT.DEFAULT, SWT.DEFAULT).x; if (width &gt; maxWidth) maxWidth = width; } } for (Composite comp : comps) { Control[] controls = comp.getChildren(); for (int i = 0; i &lt; controls.length; i …

http://stackoverflow.com/q/25431451
type: UnansweredQuestion
tagged with: spymemcached
has body: I want to know how the java coucbase client send values(byte arrays) to couchbase ? is it only a socket connection ? how the couchbase accepts it and read it? As far as I know the couchbase client has extended the spymemcache client.
has title: Couchbase client how connect to server
tagged with: couchbase
score: 0
has answer: http://stackoverflow.com/a/25451970
tagged with: java
answer count: 1
type: Question

http://stackoverflow.com/a/25526789
score: 2
has comment: http://stackoverflow.com/comment/39901906
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25526216
accepted answer of: http://stackoverflow.com/q/25526216
has comment: http://stackoverflow.com/comment/39921231
has body: This is what you could do In your BuildConfig.groovy add below lines under dependencies. runtime 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.0-RC2' Do a clean and compile after that and then it should pick up your classes.
type: Answer

http://stackoverflow.com/a/25533901
type: Answer
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25533244
has body: You could use an Eclipse scrapbook page: Create using "File / New / Other / Java / Java Run/Debug / Scrapbook Page" Then write some code, select it and right-click Execute to run it. This is not as interactive as javarepl, but it is native to Eclipse.
answers question: http://stackoverflow.com/q/25533244

http://stackoverflow.com/comment/39660076
has text: If you want to format your double result, take a look at http://stackoverflow.com/questions/8819842/best-way-to-format-a-double-value-to-2-decimal-places or http://stackoverflow.com/questions/4885254/string-format-to-format-double-in-java
comment on: http://stackoverflow.com/q/25423188
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25524032
tagged with: jsoup
has title: jsoup: How to extract correct data from this website
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39847639
linked to: http://stackoverflow.com/q/17060335
answer count: 0
tagged with: java
downvote count: 0
score: 1
has body: I am trying to extract data from a Spanish dictionary using jsoup. Essentially, the user will input words he wants to define as command line arguments and the program will return a formatted list of definitions. Here is what I have done so far: import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; public class Main { public static void main(String[] args) { String[] urls = new String[args.length]; for(int i=0; i&lt;args.length; i++) { urls[i] = "http://www.diccionarios.com/detalle.php?palabra=" + args[i] + "&amp;Buscar.x=0&amp;Buscar.y=0&amp;Buscar=submit&amp;dicc_100=on&amp;dicc_100=on"; try{ Document doc = Jsoup.connect(urls[i]).get(); Elements htmly = doc.getElementsByTag("html"); String untokenized = htmly.text(); System.out.println(untokenized); }catch (Exception e) { System.out.println("EXCEPTION: Word is probably not in this dictionary."); } } } } That url array gives the correct urls where the information for the definition is. Now, what I'm expecting to be returned is what you would get if you went to the try.jsoup website and used (for example) this : http://www.diccionarios.com/detalle.php?palabra=libro&amp;Buscar.x=0&amp;Buscar.y=0&amp;Buscar=submit&amp;dicc_100=on&amp;dicc_100=on as the link and typed in html as the CSS Query. I need that data so I can tokenize the definition from that. So I guess my question is, what method would I use to obtain the same data that you can see on the try.jsoup website. Thanks a lot! Edit: This is about interpreting the data from the url. The end result data I want (in this example) is "Conjunto de hojas escritas unidas o cosidas por uno de sus lados y cubiertas por tapas de cartón u otro material." That is the definition on the website. However, I noticed that on that try.jsoup website that if I put the html text in the CSS Query box then the result was a huge bunch of text. My assumption was that the following 2 lines of code would capture this huge bunch of text and save it as a st…
upvote count: 1
has comment: http://stackoverflow.com/comment/39850673
favorite count: 0
type: Question

http://stackoverflow.com/comment/39842194
type: QuestionComment
comment on: http://stackoverflow.com/q/25487368
score: 0
has text: I marked as a possible duplicate.Though I choose to workaround the problem using another solution , there is still no solution to the error posted in the question . I think my question is descriptive , and can help someone to find a correct solution .
type: Comment

http://stackoverflow.com/comment/39784330
comment on: http://stackoverflow.com/q/25489720
score: 0
type: Comment
type: QuestionComment
has text: Using an ExecutorService may be a more elegant solution for what you are trying to do.

http://stackoverflow.com/a/25507122
has body: Thanks to Thomas's comments I have implemented the interface provided by Hibernate that is CompositeUserType. It allow the use of your custom type in the HQL. I haven't noticed a drop of performance while I gained the semplicity to have the enum mapped automatically. You need only read this doc https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch06.html#types-custom
type: Answer
answers question: http://stackoverflow.com/q/25487259
accepted answer of: http://stackoverflow.com/q/25487259
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39687461
type: Comment
type: QuestionComment
score: 0
has text: Good. `JCheckBox num = new JCheckBox[10];` no difference
comment on: http://stackoverflow.com/q/25437673

http://stackoverflow.com/q/25549866
has body: I have a web page where there is a cascaded dropdown.(See screenshot:) The second one's data look like getting generated via ajax depending on selection of the first one. Here are the codes of the first select: -- Sales And For the second select, here is the code: <select class="form-control input-sm" name="aff_campaign_id" id="aff_campaign_id" onchange="load_text_ad_id(this.value); if($('#landing_page_style_type')){load_landing_page( $('#aff_campaign_id option:selected').val(), 0, $('input:radio[name=landing_page_type]:checked').val()?$('input:radio[name=landing_page_type]:checked').val():'landingpage');} if($('#unsecure_pixel').length != 0) { change_pixel_data();}"> -- iPhone on Amazon · $100.00 Now using web driver, when I do this: WebDriver driver=new FirefoxDriver(); JavascriptExecutor js=null; if (driver instanceof JavascriptExecutor) { js = (JavascriptExecutor)driver; } js.executeScript("document.getElementById('aff_campaign_id').value='1';" + "return document.getElementById('aff_campaign_id').value;") This does not change the value of the second cascaded select. It always returns "--",i.e. the default value. What can be done here to change the value of the select?
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25550411
answer count: 2
accepted answer: http://stackoverflow.com/a/25571039
tagged with: selenium
has title: Unable to set select value Using Javascript in selenium web driver
tagged with: javascript
upvote count: 1
has answer: http://stackoverflow.com/a/25571039
downvote count: 1
favorite count: 0
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/39898721
possible better answer: http://stackoverflow.com/a/25550411
type: Question
tagged with: java
tagged with: html-select

http://stackoverflow.com/a/25420710
has body: JPanel does not wait for you to call repaint() when a change is made. To prevent this, I think you can use RepaintManager as follows:- RepaintManager.currentManager(yourJPanel).markCompletelyClean(yourJPanel) There is another technique using two different JPanel instances. The basic idea is this: Set one visible and other invisible. Reflect the changes to the invisible (when invisible, panels does not update themselves) When you finish your game loop iteration switch their visibility and start over I don't know how the second one would affect the performance, though.
has comment: http://stackoverflow.com/comment/39656351
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/39692575
has comment: http://stackoverflow.com/comment/39656275
answers question: http://stackoverflow.com/q/25419808
has comment: http://stackoverflow.com/comment/39656059

http://stackoverflow.com/comment/39670392
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25428780
has text: this is what a debugger is for...
type: Comment

http://stackoverflow.com/comment/39691127
type: AnswerComment
comment on: http://stackoverflow.com/a/25439640
score: 0
type: Comment
has text: if it was used a reference, where is the reference being used?

http://stackoverflow.com/q/25550616
has comment: http://stackoverflow.com/comment/39896362
favorite count: 0
type: Question
score: 1
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39896955
has title: Displaying Jsoup elements
has comment: http://stackoverflow.com/comment/39898380
tagged with: jsoup
has answer: http://stackoverflow.com/a/26532891
type: UnansweredQuestion
has body: // I have this AsynchTask gets the body of a website blog. However, it doesn't show anything when method is initiated. protected Void doInBackground(Void... params) { try { Document document = Jsoup.connect(url).get(); Elements elements = document.select("div.pst-content safety clearfix entry-content p"); for(Element elements123 : elements){ title+=elements123.text(); System.out.println(elements123.text()); } } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { // Set title into TextView TextView txttitle = (TextView) findViewById(R.id.titletxt); txttitle.setText(title); // System.out.println(title); mProgressDialog.dismiss(); }
answer count: 1
downvote count: 0
tagged with: javascript
upvote count: 1
tagged with: jquery

http://stackoverflow.com/a/25440435
score: 2
answers question: http://stackoverflow.com/q/25440338
upvote count: 2
has body: This is the Java equivalent of your Perl script: public class Main { public static void main(String[] args) { String[] lines = { "Once upon a time in a galaxy far, far away, there lived\n", "this _idiot_ trying to _mark up_ a few lines of\n", "marked down text using yet another _language_.\n" }; for(String line : lines) { String output = line.replaceAll("_(.+?)_", "$1"); System.out.print(output); } } } It outputs: Once upon a time in a galaxy far, far away, there lived this idiot trying to mark up a few lines of marked down text using yet another language.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25440338

http://stackoverflow.com/comment/39701791
comment on: http://stackoverflow.com/q/25445004
type: QuestionComment
has text: Hi Michael, Your code is working but my NFC card uses NFCA technology due to which the toast shows "Card Type Not Supported". What can I do to add this type?
type: Comment
score: 0

android-4.4-kitkat
tags question: http://stackoverflow.com/q/25414352
tag name: android-4.4-kitkat
type: Tag
tags question: http://stackoverflow.com/q/25487092

dnssec
tag name: dnssec
tags question: http://stackoverflow.com/q/25425894
type: Tag

http://stackoverflow.com/comment/39688874
has text: x = 122 => (122 + 25) / 50 = 2.94 (quite different from the expected 150)
score: 0
comment on: http://stackoverflow.com/a/25438557
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39762124
has text: i added other answer !
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25477508
type: AnswerComment

http://stackoverflow.com/comment/39644171
has text: The first thing you need to know is every variable is a pointer to some point in memory. When you assign one variable to another, you are actually assigning the memory address of the variable on the right to the variable on the left. To means that know both variables point to the same location in memory and to what ever is contained there...
comment on: http://stackoverflow.com/q/25414129
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42480755
type: QuestionComment
has text: I can confirm that 2.1.7 is ok. Directly swapping to 2.2.2 causes the issue. Problem is, 2.1.7 has memory leak issues. Anyone know if there's a stable version of this?
score: 0
comment on: http://stackoverflow.com/q/25483312
type: Comment

http://stackoverflow.com/comment/39826585
comment on: http://stackoverflow.com/a/25512283
type: Comment
type: AnswerComment
score: 1
has text: Also, we need to check for `x != null` in in `go` method, otherwise it will throw a `MethodAmbiguityException`.

http://stackoverflow.com/a/25412491
has body: There is a private method TimeZone.getSystemTimeZoneID, which is not in Java standards. You may call it via Reflection: Method m = TimeZone.class.getDeclaredMethod("getSystemTimeZoneID", String.class, String.class); m.setAccessible(true); String javaHome = System.getProperty("java.home"); String systemTimeZone = (String) m.invoke(null, javaHome, null); There is a similar private method TimeZone.getSystemGMTOffsetID. It returns a string like GMT+08:00.
score: 0
answers question: http://stackoverflow.com/q/25398385
type: Answer

http://stackoverflow.com/q/25498542
tagged with: jakarta-mail
answer count: 2
has answer: http://stackoverflow.com/a/25499119
has body: How can I catch AuthenticationFailedExceptions? I basically have a login screen, and I get the text from the username and the text from the password. I am using Gmail authentication. Properties properties = new Properties(); properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.starttls.enable", "true"); properties.put("mail.smtp.host","smtp.gmail.com"); properties.put("mail.smtp.port","587"); Session session = Session.getInstance(properties, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } } ); How can I check if the authentication was successful? I know the error arises when a statement such as Transport.send(message) is called. But I wanted to check if authentication was successful - not actually send a message. Thanks!
score: 2
type: AnsweredQuestion
has title: JavaMail passwordauthentication before sending
tagged with: java
has comment: http://stackoverflow.com/comment/39800812
downvote count: 0
accepted answer: http://stackoverflow.com/a/25499215
tagged with: authentication
has comment: http://stackoverflow.com/comment/39801482
has answer: http://stackoverflow.com/a/25499215
favorite count: 0
possible better answer: http://stackoverflow.com/a/25499119
type: Question
upvote count: 2

http://stackoverflow.com/q/25461451
has answer: http://stackoverflow.com/a/25462293
tagged with: java
has title: How to hide/Shoe Jframe in NetBeans?
has comment: http://stackoverflow.com/comment/39731620
has body: I am designing a project in NetBeans. For that I need to display a jdialog as a login window at first. But if I run the project both jframe and jdialog will appear. How can I hide jframe and how to set jdialog as a starting one in my project? I wrote LoginDlg.setVisible(true); this.setVisible(false); In construcor.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39731586
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/39731610
has answer: http://stackoverflow.com/a/25461480
score: 0

http://stackoverflow.com/comment/39806003
type: Comment
type: QuestionComment
has text: Would you mind adding the code for the professionals here as no one'll answer such a broad question. Please add code and ask what it is not able to achieve!
comment on: http://stackoverflow.com/q/25501539
score: 0

http://stackoverflow.com/comment/39812423
type: Comment
has text: Alse read [Initial Threads](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html)
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25504664

http://stackoverflow.com/comment/40000612
type: Comment
has text: @user3792689 Sorry, no time to do it all. Added a short example code.
comment on: http://stackoverflow.com/a/25551440
type: AnswerComment
score: 0

http://stackoverflow.com/q/25466735
score: 3
tagged with: generic-list
tagged with: java
has comment: http://stackoverflow.com/comment/39741746
has comment: http://stackoverflow.com/comment/39741887
has answer: http://stackoverflow.com/a/25466944
tagged with: generics
linked to: http://stackoverflow.com/q/16707340
has comment: http://stackoverflow.com/comment/39741792
type: Question
has comment: http://stackoverflow.com/comment/39741878
has body: If I change ? to Object code compiles. Q1. Is there any way of changing unwind method signature to be applicable for the &lt;?&gt; getList()? Q2. If not, have you heard any design principles about designing parametrized API with &lt;?&gt;? public class Main { public static void main(String[] args) { unwind(getList()); } public static List&lt;List&lt;?&gt;&gt; getList() { return new LinkedList&lt;List&lt;?&gt;&gt;(); } public static&lt;T&gt; Collection&lt;T&gt; unwind(Collection&lt;? extends Collection&lt;T&gt;&gt; collection) { return collection.iterator().next(); } } PS. I've stuck on dealing with collection of results of several call to Future&lt;?&gt; java.util.concurrent.ExecutorService.submit(Runnable task) It would be much better for me to have Future&lt;Object&gt; result of the method. Is there any issue with API design here?
answer count: 2
has comment: http://stackoverflow.com/comment/39741831
upvote count: 3
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/39741860
has comment: http://stackoverflow.com/comment/39741708
has title: method is not applicable for generic method arguments
favorite count: 0
has answer: http://stackoverflow.com/a/25467036

sitemap
type: Tag
tag name: sitemap
tags question: http://stackoverflow.com/q/25528987

http://stackoverflow.com/a/25452102
type: Answer
answers question: http://stackoverflow.com/q/25451818
has body: In addition to other answers: Guava (since v15): for (File f : Files.fileTreeTraverser().preOrderTraversal(rootDir)) { // filter and process } Commons IO: for (File f : FileUtils.listFiles(rootDir, fileFilter, dirFilter)) { // process } Java 7: Files.walkFileTree(rootDir, fileVisitor);
score: 0

http://stackoverflow.com/comment/39689468
score: 0
type: Comment
type: QuestionComment
has text: Please suggest how to create the instance with predefined data.
comment on: http://stackoverflow.com/q/25425243

http://stackoverflow.com/comment/39763720
has text: Yes that could be a nice optimization
type: Comment
comment on: http://stackoverflow.com/a/25478667
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39782962
score: 0
type: AnswerComment
has text: Thanks a lot, i'll try to access the table as _User.
comment on: http://stackoverflow.com/a/25455528
type: Comment

http://stackoverflow.com/comment/39787710
comment on: http://stackoverflow.com/q/25491428
type: QuestionComment
has text: WebSocket is one option. Another one could be to use AsyncContext introduced in Java EE 6.
score: 0
type: Comment

http://stackoverflow.com/q/25472219
has answer: http://stackoverflow.com/a/25472353
accepted answer: http://stackoverflow.com/a/25472353
type: AnsweredQuestion
tagged with: actionlistener
score: 0
has body: I've written a program that uses a button to trigger a loop but I would like the button to be released before the loop is finished executing so that it can be re-triggered if necessary. here is the listener: // Play note btnPlay.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { strum(); } }); and this is the code it's executing: public void strum() { int f = (Integer)frequency.getValue(); double l = loss.getValue() / 1000.0; GuitarString note = new GuitarString(f, l); RealTimeAudio playback = new RealTimeAudio(); int playTime = playback.getSampleRate(); // arbitrarily set to 1 second note.pluck(); while (note.time() &lt; playTime) { playback.play(note.sample()); note.tic(); } } any recommendations would be greatly appreciated.
upvote count: 1
tagged with: java
downvote count: 1
has title: releasing actionlistener before it is finished perfoming action
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39751636
answer count: 1

http://stackoverflow.com/comment/39613958
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25398210
has text: @Arvy No. See [Painting in AWT and Swing](http://www.oracle.com/technetwork/java/painting-140037.html) for details how painting works in Swing. At any time, a repaint could be triggered, many of which are outside of your control, which could force the component to redraw itself. Painting is destructive process, not an accumulative one. The only chance you "might" have of doing something like this, is drawing to `BufferedImage` and painting that in your `paintComponent` method, but this brings other issues along with it...
type: Comment

http://stackoverflow.com/comment/39857973
comment on: http://stackoverflow.com/a/25529633
score: 0
type: AnswerComment
has text: Yes, you can start using GWT in an existing project.
type: Comment

http://stackoverflow.com/comment/39878317
has text: For convenience of use
comment on: http://stackoverflow.com/q/25540739
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25546092
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39889180
has comment: http://stackoverflow.com/comment/39889588
answer count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/39888159
has body: I have a JSP page that takes values from the user and shows it in next page (review page before saving). I have bean that has all the values mapped to the fields of the JSP. @Component @Scope("session") public class Campaign implements Serializable { protected List&lt;Reason&gt; reasons; ..... ..... } Reason.java @Component public class Reason implements Serializable { private static final long serialVersionUID = 1L; private int id; private String reason; private int retryDuration; .... } In the jsp a table populates the values of the Reasons. When I press submit, the reasons gets the populated values. If there were any validation error in other fields, the page reloads with the error labels displayed below the respective fields. Now if I delete a row in the table that populates the reasons and submit the form, the form still contains the values that was removed too. In the jsp the row is deleted, to check this, I even deleted rows in the jsp using firebug and submitted the page. Still I see the fields are not reset. why is this strange behavior? Am I missing anything in the configuration?
type: UnansweredQuestion
tagged with: spring
has title: Spring validator - bean values not reset
tagged with: spring-mvc
tagged with: spring-4

http://stackoverflow.com/a/25427469
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25427267
has body: This can be solved by implementing a FocusListener. the method public void focusGained(FocusEvent e) sets the opacity to 0.75 and the method public void focusLost(FocusEvent e) decreases the value according to your needs. detailed description could be found here
score: 1
answers question: http://stackoverflow.com/q/25427267
downvote count: 0
has comment: http://stackoverflow.com/comment/39668572
has comment: http://stackoverflow.com/comment/39668102
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/25546038
tagged with: criteria-api
has body: How do I get the number of parameter markers used in Criteria API? I am using Criteria API to create SQL statement with IN keyword that have many parameter markers. CriteriaBuilder cb = ... ... CriteriaBuilder.In&lt;String&gt; in = cb.in(...); ... for (...) { in.value(...); } I started getting SQLException "Prepared or callable statement has more than 2000 parameter markers." Is there a way to get the actual number of parameter markers used so far? I could count them by myself, but it is error prone.
type: Question
type: UnansweredQuestion
tagged with: jpa
has answer: http://stackoverflow.com/a/25558551
has title: JPA How to get the number of parameter markers used in Criteria API?
score: 0
tagged with: eclipselink
tagged with: java
answer count: 1

http://stackoverflow.com/a/25551104
score: 0
answers question: http://stackoverflow.com/q/25550578
type: Answer
has body: You'll need the complete JRE in order to create Java VM. JVM will not start if does not find matching JRE at the place relative to jvm.dll path. On Windows you can override the path where JVM looks for JRE using _ALT_JAVA_HOME_DIR environment variable, though this is a HotSpot internal option and is not guaranteed to work.

http://stackoverflow.com/a/25438783
has body: If you have a look at JOptionPane, it will eventually end up in showOptionDialog(Component, Object, String, int, int, Icon, Object[], Object) In this method, when parentComponent is null, it calls getRootFrame. This does some interesting work. Basically it works with SwingUtilities to "find" a suitable Frame to use. If one doesn't exist, it will frame a "shared" reference... This is generated via SwingUtilities.getSharedOwnerFrame, which will (eventually) create a Frame called SharedOwnerFrame, which has overriden the show method so that it can never be displayed... This is all done from within a package-private level, so you can't call any of this functionality yourself... Updated I should point out that the same instance of SharedOwnerFrame is used by all JOptionPanes
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39689473
has comment: http://stackoverflow.com/comment/39689523
has comment: http://stackoverflow.com/comment/39691433
accepted answer of: http://stackoverflow.com/q/25438732
score: 1
has comment: http://stackoverflow.com/comment/39691398
type: Answer
has comment: http://stackoverflow.com/comment/39689573
answers question: http://stackoverflow.com/q/25438732
has comment: http://stackoverflow.com/comment/39689494
has comment: http://stackoverflow.com/comment/39691421
has comment: http://stackoverflow.com/comment/39691482

http://stackoverflow.com/a/25466526
type: Answer
has body: You could make a custom Servlet filter intercepting calls to /something-else and forwarding (not redirecting) them to the actual MyPage.html URL. You could also make this filter configurable so it can translate any given URL without the browser ever knowing. Still, unless this translation is not an integral functionality of your application, you'd probably be better off simply redirecting in Apache or another web server in front of Tomcat.
answers question: http://stackoverflow.com/q/25463151
score: 0

http://stackoverflow.com/comment/39690003
type: AnswerComment
comment on: http://stackoverflow.com/a/25439078
score: 0
type: Comment
has text: @jdphenix Interesting - running that gives both InitialHeapSize and MaxHeapSize to be 2^32 (4294967296).

http://stackoverflow.com/a/25466019
answers question: http://stackoverflow.com/q/25465881
has comment: http://stackoverflow.com/comment/39757457
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39740228
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39740203
has body: Since you want to test the difference between using Iterator and using enhanced for loop (which uses Iterator behind the scenes for you), then you're doing it wrong. First because JIT has enough time to improve the results on the second approach rather than in the first and several other reasons explained here: How do I write a correct micro-benchmark in Java?. You could see very different results of this by doing these (again, as result of JIT): Add a loop that will increase the number of times to execute both iterations. This is, a for loop that covers all this code. Moving the enhanced for loop approach to be executed before. The best way to obtain real results for your test would be to split the approaches into different methods, then measure each (apart from the JVM warm up phase and other stuff covered in prev QA). Also, I recommend you to not reinvent the wheel and use a proper benchmark framework based on JUnit. Here are two of them: JUnitBenchmarks Caliper Related Q/As for benchmarking: arraylist vs linked list .why linked list is slower when we add in the end? Decreasing execution time of identical consecutive runs of a Java program
score: 4
has comment: http://stackoverflow.com/comment/39757166
has comment: http://stackoverflow.com/comment/39757327
has comment: http://stackoverflow.com/comment/39755877
has comment: http://stackoverflow.com/comment/39755336
has comment: http://stackoverflow.com/comment/39755816
has comment: http://stackoverflow.com/comment/39755789
has comment: http://stackoverflow.com/comment/39755321
has comment: http://stackoverflow.com/comment/39755742
has comment: http://stackoverflow.com/comment/39740587
has comment: http://stackoverflow.com/comment/39755909
has comment: http://stackoverflow.com/comment/39756648
accepted answer of: http://stackoverflow.com/q/25465881
upvote count: 4
has comment: http://stackoverflow.com/comment/39757383
has comment: http://stackoverflow.com/comment/39740570

http://stackoverflow.com/q/25402487
has comment: http://stackoverflow.com/comment/39626932
type: Question
answer count: 2
upvote count: 0
type: UnansweredQuestion
tagged with: arrays
score: -3
has comment: http://stackoverflow.com/comment/39627227
has body: I wonder if there is any way to merge two different arrays to one array without duplicates values. This must work in time efficiency of O(n+m). n= a.length (first array) m = b.length (second array) Nodes: each array including the result array is not necessary in order. assurance there is no duplicates value in each of the array itself. There is no limit for the place efficiency but it is not valid to use the solution of creating a new array in length of the maximum value in both array and then place each value in the right index according to the value. The reason being that if the maximum value is 1 billion it means that i need to create an array with billion cells.
favorite count: 0
has answer: http://stackoverflow.com/a/25402649
has answer: http://stackoverflow.com/a/25411975
has comment: http://stackoverflow.com/comment/39621417
tagged with: java
has comment: http://stackoverflow.com/comment/39621587
downvote count: 3
has title: merge two arrays without duplicates in java

http://stackoverflow.com/q/25423618
answer count: 1
downvote count: 1
favorite count: 0
type: Question
has title: Long function names in fortran/c/python and speed
linked to: http://stackoverflow.com/q/1017624
tagged with: fortran
tagged with: function
type: UnansweredQuestion
tagged with: python
tagged with: http://stackoverflow.com/tag/c
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/39660876
has comment: http://stackoverflow.com/comment/39664985
has body: This question is not at all related to this one When is a function name too long? Can execution speed suffer because you have a function with a long name that is going to be repeatedly called from numerous places thousands of times? Do optimization flags take care of this in compiled languages so that there is no problem? Then what about interpreted languages like python?
has answer: http://stackoverflow.com/a/25423686
linked to: http://stackoverflow.com/q/16920835
linked to: http://stackoverflow.com/q/3967247
tagged with: java
has comment: http://stackoverflow.com/comment/39662036

http://stackoverflow.com/a/25437710
downvote count: 0
has comment: http://stackoverflow.com/comment/39687492
has comment: http://stackoverflow.com/comment/39688002
has comment: http://stackoverflow.com/comment/39688111
upvote count: 3
has body: Here's a basic idea of one way you can accomplish this: Begin with the total number of cents you have, Check if you can subtract the largest denomination from that number? If you can, increment that denomination's counter and subtract it from cents, otherwise re-test with the next largest denomination. Repeat until amounts == 0 I would encourage you to run through this a few times by hand to verify it's validity. I would also like to point out the significance of three of the test values you were given; 100, 99, and 1. These values are edge cases, and are very common to test in software testing. Related information here. Amendment based on your edits: Do not use double or float here. Money is typically represented as some fraction of a number by people, but not so by computers. You need no other numeric type other than int. You are not wanting to ask the user for input (I'm assuming with CONSOLE.nextInt() you intended in.nextInt(). You want your program to calculate those values. Focus on thinking how you can use control statements like if, else if and while into implementing a solution. (Have you learned about these yet?)
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/39687946
answers question: http://stackoverflow.com/q/25437580

http://stackoverflow.com/comment/39786098
type: QuestionComment
type: Comment
has text: alright and is there any better way to get value from a cluster for a specific term, instead of looping the whole cluster?
score: 0
comment on: http://stackoverflow.com/q/25470629

http://stackoverflow.com/comment/39693651
type: QuestionComment
has text: all right. will edit my post now. Thanks for your concern.
score: 0
comment on: http://stackoverflow.com/q/25441289
type: Comment

http://stackoverflow.com/a/25479191
has comment: http://stackoverflow.com/comment/39766641
has body: try to get session value in controller from servlet request like below @Controller @RequestMapping("user") @SessionAttributes("current_user") public class UserController{ @RequestMapping(method=RequestMethod.GET) @ResponseBody public User testSession(HttpServletRequest request){ //false means do not create new session HttpSession session = request.getSession(false); return session != null?session.getAttribute("current_user"):null; } }
score: 0
has comment: http://stackoverflow.com/comment/39765019
type: Answer
answers question: http://stackoverflow.com/q/25478867
has comment: http://stackoverflow.com/comment/39767022

http://stackoverflow.com/a/25511128
score: 0
answers question: http://stackoverflow.com/q/25511062
has body: You've written the System.exit(0); AFTER the if-statement was complemted with an ";". Just delete the ";" behind the closing bracket of the if statement and it is fine. Would be like this then: if (e.getKeyCode() == KeyEvent.VK_Escape) System.exit(0);
type: Answer

http://stackoverflow.com/comment/39829382
type: Comment
comment on: http://stackoverflow.com/a/25513866
type: AnswerComment
has text: @MarkusMalkusch lol [Why not use Vectors](http://stackoverflow.com/questions/1386275/why-is-java-vector-class-considered-obsolete-or-deprecated)
score: 0

http://stackoverflow.com/q/25521097
has comment: http://stackoverflow.com/comment/39875522
tagged with: java
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
has comment: http://stackoverflow.com/comment/39880397
has title: how to get the result (html) of thymeleaf resolver?
favorite count: 0
has comment: http://stackoverflow.com/comment/39879911
has body: I want to resolve an html with thymeleaf and then have the result and do some other process of my own on it. How can I do that? It's like this: In my controller I add attributes to my model and thymeleaf resolves the html file based on those attributes like the following code Then the result will be like this and is sent as the response for the user Sample Name Well I want the result before it is sent for the user to do more manual edit on it for example.
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39887130
linked to: http://stackoverflow.com/q/35304089
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/39881950
answer count: 1
tagged with: thymeleaf
has answer: http://stackoverflow.com/a/45789326
score: 2

http://stackoverflow.com/q/25390590
favorite count: 0
type: Question
has body: I have a point with [x, y] coordinate, for example Point p = new Point(1, 2). I want to visualize it. However, I want this point to an oval, like in the picture below. How can I do that using java Swing?
has title: Draw points as ovals using java swing
score: 1
tagged with: java
type: AnsweredQuestion
answer count: 2
downvote count: 0
tagged with: point
possible better answer: http://stackoverflow.com/a/25391404
upvote count: 1
has answer: http://stackoverflow.com/a/25391404
tagged with: swing
has answer: http://stackoverflow.com/a/25390790
accepted answer: http://stackoverflow.com/a/25390790

http://stackoverflow.com/a/25502424
type: Answer
has comment: http://stackoverflow.com/comment/39808383
score: 0
has comment: http://stackoverflow.com/comment/39883098
has body: &lt;build&gt; ... &lt; sourceDirectory &gt; src/main/java &lt;/ sourceDirectory &gt; &lt; testSourceDirectory &gt; src/test/java &lt;/ testSourceDirectory &gt; &lt; resources &gt; &lt; resource &gt; &lt; directory &gt; src/main/resources &lt;/ directory &gt; &lt;/ resource &gt; &lt;/ resources &gt; &lt; testResources &gt; &lt; testResource &gt; &lt; directory &gt; src/test/resources &lt;/ directory &gt; &lt;/ testResource &gt; &lt;/ testResources &gt; ... &lt;/build&gt;
answers question: http://stackoverflow.com/q/25501962
has comment: http://stackoverflow.com/comment/39807610
has comment: http://stackoverflow.com/comment/39810274
has comment: http://stackoverflow.com/comment/39842532

jpa
tags question: http://stackoverflow.com/q/25509803
tags question: http://stackoverflow.com/q/25483783
tags question: http://stackoverflow.com/q/25459252
tags question: http://stackoverflow.com/q/25476186
tags question: http://stackoverflow.com/q/25399909
tags question: http://stackoverflow.com/q/25432276
tags question: http://stackoverflow.com/q/25488359
tags question: http://stackoverflow.com/q/25439813
tags question: http://stackoverflow.com/q/25419502
tags question: http://stackoverflow.com/q/25500571
tags question: http://stackoverflow.com/q/25486649
tags question: http://stackoverflow.com/q/25408818
tags question: http://stackoverflow.com/q/25486674
tags question: http://stackoverflow.com/q/25549894
tags question: http://stackoverflow.com/q/25546038
tags question: http://stackoverflow.com/q/25458071
tags question: http://stackoverflow.com/q/25468835
tags question: http://stackoverflow.com/q/25467921
tags question: http://stackoverflow.com/q/25509290
tags question: http://stackoverflow.com/q/25477734
tags question: http://stackoverflow.com/q/25501974
tags question: http://stackoverflow.com/q/25437964
tags question: http://stackoverflow.com/q/25454703
tags question: http://stackoverflow.com/q/25521405
tags question: http://stackoverflow.com/q/25535969
tags question: http://stackoverflow.com/q/25447878
tags question: http://stackoverflow.com/q/25497597
tags question: http://stackoverflow.com/q/25511928
tags question: http://stackoverflow.com/q/25464922
tags question: http://stackoverflow.com/q/25390430
tags question: http://stackoverflow.com/q/25446300
tags question: http://stackoverflow.com/q/25537533
tags question: http://stackoverflow.com/q/25400646
tags question: http://stackoverflow.com/q/25418459
tags question: http://stackoverflow.com/q/25529283
tags question: http://stackoverflow.com/q/25431570
tags question: http://stackoverflow.com/q/25392946
tags question: http://stackoverflow.com/q/25495128
tags question: http://stackoverflow.com/q/25451250
tags question: http://stackoverflow.com/q/25443336
tag name: jpa
tags question: http://stackoverflow.com/q/25425828
tags question: http://stackoverflow.com/q/25547132
tags question: http://stackoverflow.com/q/25420437
tags question: http://stackoverflow.com/q/25461413
tags question: http://stackoverflow.com/q/25462416
tags question: http://stackoverflow.com/q/25489359
tags question: http://stackoverflow.com/q/25402622
tags question: http://stackoverflow.com/q/25408206
tags question: http://stackoverflow.com/q/25545273
tags question: http://stackoverflow.com/q/25502398
tags question: http://stackoverflow.com/q/25469858
tags question: http://stackoverflow.com/q/25547859
tags question: http://stackoverflow.com/q/25514859
tags question: http://stackoverflow.com/q/25547025
tags question: http://stackoverflow.com/q/25454918
tags question: http://stackoverflow.com/q/25434550
tags question: http://stackoverflow.com/q/25406887
tags question: http://stackoverflow.com/q/25399345
tags question: http://stackoverflow.com/q/25541150
tags question: http://stackoverflow.com/q/25504422
tags question: http://stackoverflow.com/q/25545571
tags question: http://stackoverflow.com/q/25437542
tags question: http://stackoverflow.com/q/25505791
tags question: http://stackoverflow.com/q/25431210
tags question: http://stackoverflow.com/q/25535991
tags question: http://stackoverflow.com/q/25527463
tags question: http://stackoverflow.com/q/25504340
tags question: http://stackoverflow.com/q/25453660
tags question: http://stackoverflow.com/q/25421865
tags question: http://stackoverflow.com/q/25493316
tags question: http://stackoverflow.com/q/25525553
tags question: http://stackoverflow.com/q/25476515
type: Tag
tags question: http://stackoverflow.com/q/25420500
tags question: http://stackoverflow.com/q/25522869
tags question: http://stackoverflow.com/q/25406884
tags question: http://stackoverflow.com/q/25452866
tags question: http://stackoverflow.com/q/25514588
tags question: http://stackoverflow.com/q/25442822

http://stackoverflow.com/comment/39696235
comment on: http://stackoverflow.com/a/25442749
has text: I tried with your code, I get this error: `Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private myproj.models.UserDAO myproj.controllers.UserController.userDao;`
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39766217
type: Comment
type: AnswerComment
has text: I suppose that you meant to got for DeathWish.getInstanceListReference().remove(i)
score: 0
comment on: http://stackoverflow.com/a/25479301

http://stackoverflow.com/comment/39829957
comment on: http://stackoverflow.com/a/25493170
has text: Yeah, just replace your if condition inside the OnPageChangeListener with this: `if (pos == adapter.getCount() - 1) { mp.pause(); } else if (!mp.isPlaying()) { mp.start(); }` Add `mp.seekTo(0);` before `mp.start();` to let the music start from the beginning.
score: 0
type: Comment
type: AnswerComment

jna
tags question: http://stackoverflow.com/q/25422399
type: Tag
tags question: http://stackoverflow.com/q/25430266
tags question: http://stackoverflow.com/q/25454697
tag name: jna

http://stackoverflow.com/comment/39721182
type: Comment
has text: How does it fail? StackTrace, something?
type: QuestionComment
comment on: http://stackoverflow.com/q/25455771
score: 0

http://stackoverflow.com/comment/39669931
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25428573
has text: It may be better to loop over the string and have a comma counter instead of using regex, though in theory if you constructed the regex string dynamically it could work.
type: Comment

http://stackoverflow.com/comment/39848502
has text: really not the solution, solving just the actual OPs issue, proper solution is to store integer value in model and/or to override getColumnClass, more in Oracle tutorial - How to use Tables, for working code example(s)
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25524568

http://stackoverflow.com/a/26170584
type: Answer
answers question: http://stackoverflow.com/q/25430104
accepted answer of: http://stackoverflow.com/q/25430104
upvote count: 3
type: AcceptedAnswer
downvote count: 0
score: 3
has body: You already have the element selected in Java, so no need to use coords in JS. Just pass the WebElement to your JS, and then you can avoid .elementFromPoint(...) being null: js.executeScript("arguments[0].click()", button); Also, every time you execute a new JS from SE, there is some overhead time before the JS executes. You can get the second click faster, by doing both clicks in a single JS: js.executeScript("var clicks = 0; while (clicks &lt; 2) {arguments[0].click(); clicks++;}", button);

http://stackoverflow.com/a/25534169
has comment: http://stackoverflow.com/comment/39866022
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25533978
downvote count: 0
has comment: http://stackoverflow.com/comment/39866181
has body: Since the method contains() need to receive a CharSequence, probably your variable a is not an instance of CharSequence. So, do a validation: if(a instanceof CharSequence ){ boolean m=str[0].contains(a); } ---- Edit Try this: CharSequence a = 'a'.toString(); boolean m = str[0].contains(a);

http://stackoverflow.com/q/25439277
tagged with: java-stream
tagged with: java
has comment: http://stackoverflow.com/comment/39722986
has answer: http://stackoverflow.com/a/25452763
favorite count: 0
score: 30
type: Question
has answer: http://stackoverflow.com/a/25439951
has title: Lambdas, multiple forEach with casting
has answer: http://stackoverflow.com/a/25439984
type: UnansweredQuestion
downvote count: 0
tagged with: lambda
tagged with: java-8
answer count: 4
has answer: http://stackoverflow.com/a/25439912
has comment: http://stackoverflow.com/comment/39749988
upvote count: 30
has body: Need some help thinking in lambdas from my fellow StackOverflow luminaries. Standard case of picking through a list of a list of a list to collect some children deep in a graph. What awesome ways could Lambdas help with this boilerplate? public List&lt;ContextInfo&gt; list() { final List&lt;ContextInfo&gt; list = new ArrayList&lt;ContextInfo&gt;(); final StandardServer server = getServer(); for (final Service service : server.findServices()) { if (service.getContainer() instanceof Engine) { final Engine engine = (Engine) service.getContainer(); for (final Container possibleHost : engine.findChildren()) { if (possibleHost instanceof Host) { final Host host = (Host) possibleHost; for (final Container possibleContext : host.findChildren()) { if (possibleContext instanceof Context) { final Context context = (Context) possibleContext; // copy to another object -- not the important part final ContextInfo info = new ContextInfo(context.getPath()); info.setThisPart(context.getThisPart()); info.setNotImportant(context.getNotImportant()); list.add(info); } } } } } } return list; } Note the list itself is going to the client as JSON, so don't focus on what is returned. Must be a few neat ways I can cut down the loops. Interested to see what my fellow experts create. Multiple approaches encouraged. EDIT The findServices and the two findChildren methods return arrays EDIT - BONUS CHALLENGE The "not important part" did turn out to be important. I actually need to copy a value only available in the host instance. This seems to ruin all the beautiful examples. How would one carry state forward? final ContextInfo info = new ContextInfo(context.getPath()); info.setHostname(host.getName()); // The Bonus Challenge

http://stackoverflow.com/a/25487606
has comment: http://stackoverflow.com/comment/39779996
downvote count: 1
has comment: http://stackoverflow.com/comment/39781204
score: 3
has comment: http://stackoverflow.com/comment/39780987
accepted answer of: http://stackoverflow.com/q/25487464
has comment: http://stackoverflow.com/comment/39780886
type: Answer
has comment: http://stackoverflow.com/comment/39779933
answers question: http://stackoverflow.com/q/25487464
has body: You are looking for the Java Native Interface (JNI): https://en.wikipedia.org/wiki/Java_Native_Interface http://docs.oracle.com/javase/7/docs/technotes/guides/jni/ You'll need to wrap the JNI calls into a C library interface that you build. In particular, take a look at the invocation API that allows a C program to start a java JVM and execute java functions: http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html
upvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39779934
has comment: http://stackoverflow.com/comment/39781085
has comment: http://stackoverflow.com/comment/39780709
has comment: http://stackoverflow.com/comment/39779770
has comment: http://stackoverflow.com/comment/39779850

http://stackoverflow.com/comment/40079128
comment on: http://stackoverflow.com/a/25489079
type: AnswerComment
score: 0
has text: I should probably add that you can also avoid the `QueryBuilder` entirely by using the Lucene API to create a `Query` object directly, then passing that query object to `createFullTextQuery` with the classes you wish to search/return.
type: Comment

http://stackoverflow.com/comment/39665653
type: Comment
has text: I know of no other JPA provider that supports that vendor extension - the operative word being extension (i.e not part of the standard). As already said, JPA 2.1 allows a user to use standardised "function('extract', args)"
type: AnswerComment
comment on: http://stackoverflow.com/a/25422359
score: 0

http://stackoverflow.com/comment/39682010
type: Comment
score: 0
has text: Note that "complete" means that it reproduces **exactly** the problem which you are asking about. In this case, the code you have given will produce many compiler errors unrelated to your question because you are missing some key elements of syntax.
type: QuestionComment
comment on: http://stackoverflow.com/q/25434606

http://stackoverflow.com/q/25396472
has body: I've seen a lot of posts related to this issue but every desk check I've performed and suggestion I've implemented did not help. I can't figure out how I am violating the contract of the comparator. Granted I don't use comparators that often. I have a large ArrayList of objects that are sorted on every update because their positions frequently change. I have to render these objects form bottom-left to top-right order to preserve a 'depth' like look to a 2D program. Here is my comparator: @Override public int compare(RenderObject o1, RenderObject o2) { //if(o1 == null || o2 == null) // return 0; if(o1 == null) return -1; else if(o2 == null) return 1; //vertices in order top-left, top-right, bottom-right, bottom-left PointF[] bounds1 = o1.getVertices(), bounds2 = o2.getVertices(); //if(bounds1 == null || bounds2 == null || bounds1.equals(bounds2)) // return 0; if(bounds1 == null) return -1; else if(bounds2 == null) return 1; if(bounds1[0].x &gt;= bounds2[1].x || bounds1[3].y &lt;= bounds2[0].y) return 1; else if(bounds1[1].x &lt;= bounds2[0].x || bounds1[0].y &gt;= bounds2[3].y) return -1; return o1.getZOrder() &lt; o2.getZOrder() ? 1 : (o1.getZOrder() &gt; o2.getZOrder() ? -1 : 0); } Can someone please explain where the contract is violated. I tried desk checking with the same exact vertices for both o1 &amp; o2 and couldn't figure out how they are not equal. If it can't be helped I suppose I'll have to implement sorting manually, it would probably be more efficient since not all objects will move every update, but I would still like to fix this code, if for nothing else future reference. EDIT: Here is the actual error, but it's right where all other's stop with this issue. Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeLo(Unknown Source) at java.util.TimSort.mergeAt(Unknown Source) at java.util.TimSort.mergeForceCollapse(Unknown Source) at java.util.TimSort.sort(Unknown Source…
tagged with: java
has title: Collections.sort() Fails In large ArrayList, Frequently sorted
type: Question
score: 2
has comment: http://stackoverflow.com/comment/39612151
has comment: http://stackoverflow.com/comment/39611692
has comment: http://stackoverflow.com/comment/39611315
accepted answer: http://stackoverflow.com/a/25396501
answer count: 1
has answer: http://stackoverflow.com/a/25396501
tagged with: sorting
downvote count: 1
favorite count: 0
tagged with: arraylist
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/97933602
upvote count: 3

http://stackoverflow.com/a/25449559
has comment: http://stackoverflow.com/comment/39710533
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39710955
accepted answer of: http://stackoverflow.com/q/25449284
has comment: http://stackoverflow.com/comment/39709562
answers question: http://stackoverflow.com/q/25449284
has comment: http://stackoverflow.com/comment/39710350
has comment: http://stackoverflow.com/comment/39710960
type: Answer
score: 4
has body: The problem is the compareTo method, which performs comparisons based on age, but determines equality based on the Person's name, making it inconsistent with itself. After inserting the first 3 Persons, the tree looks something like this (forgive the poor ASCII art): (c,2) | /\ (a,1) (b,3) Then (a,4) is inserted, it's compared to (c,2) based on the age. The age (4) is bigger than (2), so we go to the right. The next comparison is with (b,3). (a,4) is again bigger, so it's added as a new node to the tree (since there's nothing else to compare to). If instead of adding (a,4) you'd add (a,0), then there would be a comparison with (a,1), and the result would be: a:1 c:2 b:3
upvote count: 4

http://stackoverflow.com/comment/39794949
type: Comment
comment on: http://stackoverflow.com/q/25474553
score: 0
has text: Any solutions relying on a Thread.sleep are, in my experience, going to be unsuitable for any audio playback solution like a microphone due to poor timer resolution. The best solution is going to involve constantly streaming audio, writing zeros for a computed number of samples and then writing out the waveform.
type: QuestionComment

http://stackoverflow.com/q/25490281
type: UnansweredQuestion
tagged with: php
has title: Fatal exception AsyncTask connection to phpmyadmin
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25490383
tagged with: android-asynctask
has body: I'm trying to do a log in an app that connects with phpmyadmin. When I start the app I get an exception. This is my code: public class MainActivity extends Activity { // Progress Dialog private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); EditText fname; EditText lname; EditText username; EditText password; EditText location; EditText contact; Button btnreg; Button btncancel; // url to create new product private static String url_new_user = "http://192.168.0.1XX/android_test/newUser.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Edit Text fname = (EditText) findViewById(R.id.fname); lname = (EditText) findViewById(R.id.lname); username = (EditText) findViewById(R.id.uname); password = (EditText) findViewById(R.id.pass); location = (EditText) findViewById(R.id.addr); contact = (EditText) findViewById(R.id.contact); // Create button btnreg = (Button) findViewById(R.id.btnreg); btncancel = (Button) findViewById(R.id.btncancel); // button click event btnreg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // creating new product in background thread new CreateNewProduct().execute(); } }); btncancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); Intent i = new Intent(getApplicationContext(), MainActivity.class); startActivity(i); } }); } /** * Background Async Task to Create new product * */ class CreateNewProduct extends AsyncTask&lt;String, String, String&gt; { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(MainActivity.this); pDialog.setMessage("Registering New User.."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } /** * Creating product * */…
type: Question
tagged with: phpmyadmin
tagged with: android

http://stackoverflow.com/comment/39829194
type: AnswerComment
comment on: http://stackoverflow.com/a/25513837
score: 3
has text: Although it's worth noting the Oracle JDK's implementation of this method uses a ternary operator.
type: Comment

http://stackoverflow.com/comment/39901906
type: AnswerComment
score: 0
has text: do i have to add sth. to the application.properties file ? since that change the app doesnt compile on live server throwing : java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(
type: Comment
comment on: http://stackoverflow.com/a/25526789

http://stackoverflow.com/q/25400869
type: AnsweredQuestion
upvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/25404652
tagged with: java
has answer: http://stackoverflow.com/a/25403531
accepted answer: http://stackoverflow.com/a/25403531
downvote count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/39667008
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/25404652
has body: I have a Jsp page in which there is a table that is populated from the database. I want to Implement a search based on the fields on this table please tell me how to do this. My Jsp page is given below &lt;html&gt; &lt;jsp:include page="Headj.jsp"/&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; function deletedata(prdid) { var url = "Con_Product?action=delete&amp;prdid=" + prdid; window.location = url; } function editdata(prdid) { var url = "Editprd.jsp?prdid=" + prdid + "&amp;type=p&amp;pg=prd"; window.location = url; } &lt;/script&gt; &lt;div id="maindiv" class="container-fluid"&gt; &lt;jsp:include page="Headerj.jsp"/&gt; &lt;div id="menu_content"&gt; &lt;jsp:include page="Menuj.jsp"/&gt; &lt;div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"&gt; &lt;h1 class="page-header"&gt;Product&lt;/h1&gt; &lt;ul class="nav nav-tabs" role="tablist"&gt; &lt;li class="active"&gt;&lt;a href="#"&gt;Display&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="Insertprd.jsp?pg=prd&amp;type=m"&gt;Add New&lt;/a&gt;&lt;/li&gt; &lt;!--&lt;li&gt;&lt;a href="#"&gt;Messages&lt;a&gt;&lt;li&gt;--&gt; &lt;/ul&gt; &lt;br&gt; &lt;div class="panel panel-default"&gt; &lt;div class="panel-body" style="padding: 3px;"&gt; &lt;strong style="font-size: 20px; font-family: sans-serif; color: #3b6282; margin-left: 10px;"&gt;Display Products&lt;/strong&gt; &lt;form class="navbar-right form-inline"&gt; &lt;div class="form-group"&gt; &lt;select class="form-control"&gt; &lt;option&gt;Choose Option&lt;/option&gt; &lt;option&gt;1&lt;/option&gt; &lt;option&gt;2&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;div class="input-group"&gt; &lt;input type="text" class="form-control" placeholder="Search..."&gt; &lt;/div&gt; &lt;/div&gt; &lt;button type="submit" class="btn btn-info"&gt;&lt;span class="glyphicon glyphicon-search"&gt;&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="alert-success"&gt;&lt;p&gt;${param.message}&lt;/p&gt;&lt;/div&gt; &lt;%…
has comment: http://stackoverflow.com/comment/39618710
linked to: http://stackoverflow.com/q/3177733
score: -1
has title: Searching in JSP
has comment: http://stackoverflow.com/comment/39618636
tagged with: servlets

http://stackoverflow.com/q/25534550
has comment: http://stackoverflow.com/comment/39866913
tagged with: java
downvote count: 0
upvote count: 1
has body: This Q rather looks for a verification. The Java docs on switch statement reads like multiple default blocks are OK: The body of a switch statement is known as a switch block. A statement in the switch block can be labeled with one or more case or default labels. " are there any case(s) that 2+ default blocks can exist in a switch stat? can't be to my knowledge. furthermore-- wouldn't make sense.
has answer: http://stackoverflow.com/a/25534651
tagged with: switch-statement
favorite count: 0
type: Question
answer count: 5
has answer: http://stackoverflow.com/a/25534866
has answer: http://stackoverflow.com/a/25534698
has title: Multiple blocks in switch stat?
has answer: http://stackoverflow.com/a/25534673
has answer: http://stackoverflow.com/a/25534652
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/39632314
comment on: http://stackoverflow.com/q/25407420
has text: I think there's a good start with [JSONiq][1], which seems to provide the same update functions as found in [Xquery update][2]. Something like `update value of ... with ...`. [Zorba][3] looks like a good implementation of JSONiq and there's a [Java binding][4]. I have not tried yet, it's just an idea, if it works I'll post an answer. [1]: http://www.jsoniq.org/docs/JSONiq-usecases/html-single/index.html#update.example [2]: http://www.w3.org/TR/xquery-update-10/#id-replacing-node-value [3]: http://www.zorba.io/home [4]: http://docs.zorba.io.s3-website-us-east-1.amazonaws.com/3.0.0/java/
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39838701
score: 0
has text: @shekharsuman: where is it mentioned system.gc?
type: QuestionComment
comment on: http://stackoverflow.com/q/25518875
type: Comment

http://stackoverflow.com/q/25526981
score: 0
tagged with: oracle-database
tagged with: sql
tagged with: java
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/39853364
has body: I have to check/join in TABLE_A and TABLE_B where TABLE_A.name like TABle_B.name. I have the algorithm for the like, but the main problem i cant handle the different encoding. Because when the tables was done. It was import from different excels, csv-s, java uploads simple oracle insert etc. And some of them was &amp;ä&amp;đ&amp;&gt;yc&amp;äđ encoded so I cant handle ßruce =? Bruce Ryán =? Ryan etc. but worse. I found some ASCII functions and others in other topics but i could not manage it. So if you have some magic tricks for it in oracle sql developer or maybe in java Thanks.
type: Question
has answer: http://stackoverflow.com/a/25527595
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39854032
has title: Handle differently encoded records in Oracle

http://stackoverflow.com/q/25543910
has answer: http://stackoverflow.com/a/59892197
has comment: http://stackoverflow.com/comment/49535905
has answer: http://stackoverflow.com/a/36892659
has comment: http://stackoverflow.com/comment/39888091
has answer: http://stackoverflow.com/a/50915209
has answer: http://stackoverflow.com/a/37852334
upvote count: 39
has answer: http://stackoverflow.com/a/69660212
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/44904043
has answer: http://stackoverflow.com/a/49360865
has answer: http://stackoverflow.com/a/61364218
has answer: http://stackoverflow.com/a/28669666
has answer: http://stackoverflow.com/a/33739070
has answer: http://stackoverflow.com/a/54376195
has answer: http://stackoverflow.com/a/44758897
has answer: http://stackoverflow.com/a/26399098
has answer: http://stackoverflow.com/a/79095295
has answer: http://stackoverflow.com/a/32435000
has answer: http://stackoverflow.com/a/32458465
has answer: http://stackoverflow.com/a/52915094
has body: When i'm trying to run the test suite, am getting this exception. We are using maven project here and i am done with refreshing, cleaning, reinstalling testNG and then imported the maven projects but then also am getting the same exception. Please suggest any ways that am missing here. Error console: org.testng.TestNGException: Cannot find class in classpath: EmpClass at org.testng.xml.XmlClass.loadClass(XmlClass.java:81) at org.testng.xml.XmlClass.init(XmlClass.java:73) at org.testng.xml.XmlClass.&lt;init&gt;(XmlClass.java:59) at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:543) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:766) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1350) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2778) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SA…
has comment: http://stackoverflow.com/comment/117478780
has answer: http://stackoverflow.com/a/56375995
tagged with: testng
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/25751231
has title: Error: org.testng.TestNGException: Cannot find class in classpath: EmpClass
has answer: http://stackoverflow.com/a/30207705
has comment: http://stackoverflow.com/comment/39892321
has comment: http://stackoverflow.com/comment/39884351
has answer: http://stackoverflow.com/a/59085024
has answer: http://stackoverflow.com/a/35085466
answer count: 35
has answer: http://stackoverflow.com/a/34715846
has answer: http://stackoverflow.com/a/37444197
tagged with: java
has answer: http://stackoverflow.com/a/26097072
has answer: http://stackoverflow.com/a/27824371
has answer: http://stackoverflow.com/a/34895676
tagged with: selenium
has answer: http://stackoverflow.com/a/67417580
downvote count: 0
has comment: http://stackoverflow.com/comment/39889179
has answer: http://stackoverflow.com/a/45518702
has answer: http://stackoverflow.com/a/52961508
has answer: http://stackoverflow.com/a/29859947
has answer: http://stackoverflow.com/a/54182248
has answer: http://stackoverflow.com/a/52425274
has answer: http://stackoverflow.com/a/76531872
has answer: http://stackoverflow.com/a/57334399
favorite count: 0
score: 39
type: Question

http://stackoverflow.com/q/25425130
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25425131
type: AnsweredQuestion
score: 107
has answer: http://stackoverflow.com/a/25425131
tagged with: java
tagged with: synchronization
type: Question
upvote count: 109
has body: In my code I have a loop that waits for some state to be changed from a different thread. The other thread works, but my loop never sees the changed value. It waits forever. However, when I put a System.out.println statement in the loop, it suddenly works! Why? The following is an example of my code: class MyHouse { boolean pizzaArrived = false; void eatPizza() { while (pizzaArrived == false) { //System.out.println("waiting"); } System.out.println("That was delicious!"); } void deliverPizza() { pizzaArrived = true; } } While the while loop is running, I call deliverPizza() from a different thread to set the pizzaArrived variable. But the loop only works when I uncomment the System.out.println("waiting"); statement. What's going on?
has title: Loop doesn't see value changed by other thread without a print statement
tagged with: busy-waiting
tagged with: multithreading
downvote count: 2

http://stackoverflow.com/q/25535579
type: Question
has body: Explaining the issue with an example: public class DataWrapper&lt;T&gt; { T data; }; DataWrapper&lt;Object&gt; obj1 = new DataWrapper&lt;Object&gt;(); List&lt;DataWrapper&lt;?&gt;&gt; anyDataList = Arrays.asList(obj1); //this doesn't work DataWrapper&lt;Integer&gt; objInt = new DataWrapper&lt;Integer&gt;(); anyDataList = Arrays.asList(obj1, objInt); //this work I couldn't understand why "Arrays.asList(obj1)" doesn't work?
has title: Java generics: Unbounded wildcard is not working with Object type argument
has answer: http://stackoverflow.com/a/25535670
tagged with: java
upvote count: 4
tagged with: generics
has comment: http://stackoverflow.com/comment/39868814
downvote count: 0
linked to: http://stackoverflow.com/q/2745265
type: UnansweredQuestion
answer count: 1
score: 4
has comment: http://stackoverflow.com/comment/39868720
has comment: http://stackoverflow.com/comment/39868850
favorite count: 0

http://stackoverflow.com/q/25492108
has title: Can we debug classes present in rt.jar?
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25492274
type: Question
upvote count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39788980
tagged with: java
downvote count: 0
has body: I have atteched the source file to project. I want to debug a method of say ArrayList. I placed a breakpoint also in that method but on debugging it gives error -unable to install breakpoint in eclipse due to missing line number attributes.Its a desktop application.
has comment: http://stackoverflow.com/comment/39788781
score: 1

http://stackoverflow.com/q/25522808
answer count: 1
has body: I've just upgraded to java 8. Previously I was using the nashorn script engine and the following would work: engine.eval("format('%04d-%02d-%02d', 1966, 07, 18);"); Now I get: &lt;eval&gt;:1 ReferenceError: "format" is not defined I've googled around for over a day now, but I just can't find an example of this. Is this still supported? Very grateful for any help.
has title: Format number with javax.script
type: Question
score: 0
linked to: http://stackoverflow.com/q/1056728
tagged with: java
has comment: http://stackoverflow.com/comment/39846048
has answer: http://stackoverflow.com/a/25523220
type: UnansweredQuestion

http://stackoverflow.com/a/25410693
answers question: http://stackoverflow.com/q/25410679
has body: Try this: public void methodExample(int[] array1) Explanation: The type is the same that you used for declaring a value that will be passed as parameter (for the moment I'm ignoring covariant arrays), for instance if you do this: int[] array1 = new int[4]; ... Then, at the time of passing it as a parameter we'll write it like this: methodExample(array1) Also notice that the size of the array must not be passed as parameter, and that by convention the [] part goes right after the type of the array's elements (in fact, int[] is the type of the array), and not after the array's name.
has comment: http://stackoverflow.com/comment/39703443
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39637233
downvote count: 0
has comment: http://stackoverflow.com/comment/39697600
has comment: http://stackoverflow.com/comment/39637343
type: Answer
has comment: http://stackoverflow.com/comment/39637239

http://stackoverflow.com/comment/39747037
type: Comment
comment on: http://stackoverflow.com/a/25469696
score: 0
type: AnswerComment
has text: printing all records[i] using rdataToString() i get four lines like "10 mx2.fastwebnet.it.", where only the 3rd numeric-char after "mx" changes. For spamhaus (the only that shows a positive) i get only two records: the first one is ""http://www.spamhaus.org/query/dbl?domain=buyapprove.com"", the second one is "127.0.1.2"

http://stackoverflow.com/comment/97811392
comment on: http://stackoverflow.com/a/54955227
type: AnswerComment
score: 0
type: Comment
has text: it worked for the code `if ( msg[2:] == b"Hello" )` but what are the hidden characters?

http://stackoverflow.com/comment/39663595
comment on: http://stackoverflow.com/a/25423502
type: Comment
has text: @ankur-singhal I have the `@ComponentScan` in the class myproject.Application: https://gist.github.com/anonymous/5cfff2ea24e2f83cd653
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39644425
type: QuestionComment
score: 0
has text: @dst the question is about how to run a jar with admin rights on windows so the answer may be a windows specific method, hence the tag. And that kind of tying is going to be platform specific anyway I'm afraid. The op can remove it if he feels it is not appropriate.
comment on: http://stackoverflow.com/q/25414029
type: Comment

http://stackoverflow.com/comment/39812187
comment on: http://stackoverflow.com/a/25445029
has text: @Anu Just look at the last line of the code sample you posted in your question!?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40019902
comment on: http://stackoverflow.com/a/25518037
type: Comment
has text: (1) RFC 2616 is obsolete. (2) Payload format and method names are completely orthogonal concepts. You can use application/x-www-form-urlencoded with any request method that allows a request body (whether it's a good idea is a different question)
score: 0
type: AnswerComment

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/25392897
tag name: google-oauth

http://stackoverflow.com/a/25415335
has comment: http://stackoverflow.com/comment/39646384
answers question: http://stackoverflow.com/q/25415177
has comment: http://stackoverflow.com/comment/39646264
type: Answer
has comment: http://stackoverflow.com/comment/39656213
has body: You are forgetting to call the super.setStringPainted(b): public void setStringPainted(boolean b) { super.setStringPainted(b); isStringToBePainted = b; } It's a bit unclear what you're trying to do, but you might want to look into overriding ProgressBarUI, instead of the component. Take a look at: http://docs.oracle.com/javase/6/docs/api/javax/swing/plaf/basic/BasicProgressBarUI.html
score: 0
has comment: http://stackoverflow.com/comment/39646219

http://stackoverflow.com/comment/55945606
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25601833
has text: I don't get. I have the same problem but only on Linux. On Windows it works fine, so, I don't think the problem is the template, but the loading of the extension.
type: Comment

file-io
tags question: http://stackoverflow.com/q/25466859
tags question: http://stackoverflow.com/q/25437205
tags question: http://stackoverflow.com/q/25519376
tags question: http://stackoverflow.com/q/25455650
type: Tag
tags question: http://stackoverflow.com/q/25453802
tag name: file-io
tags question: http://stackoverflow.com/q/25546869
tags question: http://stackoverflow.com/q/25397031
tags question: http://stackoverflow.com/q/25546781
tags question: http://stackoverflow.com/q/25400548
tags question: http://stackoverflow.com/q/25540751

http://stackoverflow.com/comment/39705726
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25447981
score: 0
has text: @JeroenVannevel Isn't clone implemented by a native method? http://stackoverflow.com/questions/6825982/how-does-clone-work-under-the-hood

http://stackoverflow.com/q/25499184
has answer: http://stackoverflow.com/a/25499322
has comment: http://stackoverflow.com/comment/39801805
answer count: 4
has body: class X { public static void main(String...a) { String a = "meow"; String ab = a + "deal"; String abc = "meowdeal"; System.out.println(ab == abc); } } Am getting an output as false... why. Am preparing for ocjp. I thin we have to get true. Beacuse ab contains "meowdeal". When am trying to assign "meowdeal" to abc this literal is already tehre in string pool. So ab and abc both are pointing to the same object. Then we have to get true.
has title: Strings literals in java
upvote count: 2
has comment: http://stackoverflow.com/comment/39802017
downvote count: 5
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/25499220
tagged with: string
has comment: http://stackoverflow.com/comment/39801751
favorite count: 0
has answer: http://stackoverflow.com/a/25499273
type: Question
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/25499319
tagged with: java
duplicate of: http://stackoverflow.com/q/513832

exception
tags question: http://stackoverflow.com/q/25518066
tags question: http://stackoverflow.com/q/25503983
tags question: http://stackoverflow.com/q/25428050
tags question: http://stackoverflow.com/q/25398119
tags question: http://stackoverflow.com/q/25466848
tags question: http://stackoverflow.com/q/25544578
tags question: http://stackoverflow.com/q/25535320
tags question: http://stackoverflow.com/q/25480178
tags question: http://stackoverflow.com/q/25541697
tags question: http://stackoverflow.com/q/25451275
tags question: http://stackoverflow.com/q/25455565
tags question: http://stackoverflow.com/q/25495754
tags question: http://stackoverflow.com/q/25412227
tags question: http://stackoverflow.com/q/25454428
tags question: http://stackoverflow.com/q/25397800
tags question: http://stackoverflow.com/q/25523082
tags question: http://stackoverflow.com/q/25453467
tags question: http://stackoverflow.com/q/25447804
tags question: http://stackoverflow.com/q/25422084
tags question: http://stackoverflow.com/q/25464893
tags question: http://stackoverflow.com/q/25485260
tags question: http://stackoverflow.com/q/25450955
tags question: http://stackoverflow.com/q/25542291
tags question: http://stackoverflow.com/q/25440498
tags question: http://stackoverflow.com/q/25540068
tags question: http://stackoverflow.com/q/25465131
tag name: exception
tags question: http://stackoverflow.com/q/25395095
tags question: http://stackoverflow.com/q/25458325
tags question: http://stackoverflow.com/q/25421486
tags question: http://stackoverflow.com/q/25435785
tags question: http://stackoverflow.com/q/25483872
tags question: http://stackoverflow.com/q/25398074
type: Tag
tags question: http://stackoverflow.com/q/25493948
tags question: http://stackoverflow.com/q/25509581
tags question: http://stackoverflow.com/q/25543219
tags question: http://stackoverflow.com/q/25480766
tags question: http://stackoverflow.com/q/25427876
tags question: http://stackoverflow.com/q/25436065
tags question: http://stackoverflow.com/q/25412189
tags question: http://stackoverflow.com/q/25421974
tags question: http://stackoverflow.com/q/25494768
tags question: http://stackoverflow.com/q/25414107
tags question: http://stackoverflow.com/q/25532010
tags question: http://stackoverflow.com/q/25474156
tags question: http://stackoverflow.com/q/25511460

http://stackoverflow.com/comment/39740269
type: QuestionComment
has text: what do you mean by "i cannot scroll back to lower numbers"
score: 0
comment on: http://stackoverflow.com/q/25465942
type: Comment

http://stackoverflow.com/comment/39650410
score: 0
type: Comment
type: QuestionComment
has text: Join two files mp3 (music), in a unique file, containing the two mp3 files...
comment on: http://stackoverflow.com/q/25417588

http://stackoverflow.com/comment/39779453
comment on: http://stackoverflow.com/a/25486972
type: AnswerComment
has text: Tried with super still the same error at compilation. Cannot convert from ArrayList<C> to ArrayList<? super A>.
score: 0
type: Comment

http://stackoverflow.com/comment/39601021
has text: You need to install a JDK to get compiler options.
comment on: http://stackoverflow.com/q/25391207
type: Comment
type: QuestionComment
score: 0

jframe
tags question: http://stackoverflow.com/q/25419041
tags question: http://stackoverflow.com/q/25456007
tags question: http://stackoverflow.com/q/25503833
tags question: http://stackoverflow.com/q/25521269
tags question: http://stackoverflow.com/q/25458599
tags question: http://stackoverflow.com/q/25419072
tag name: jframe
tags question: http://stackoverflow.com/q/25405780
tags question: http://stackoverflow.com/q/25532169
tags question: http://stackoverflow.com/q/25511062
tags question: http://stackoverflow.com/q/25398124
tags question: http://stackoverflow.com/q/25539229
tags question: http://stackoverflow.com/q/25455483
tags question: http://stackoverflow.com/q/25475972
tags question: http://stackoverflow.com/q/25465087
tags question: http://stackoverflow.com/q/25488090
tags question: http://stackoverflow.com/q/25393089
type: Tag
tags question: http://stackoverflow.com/q/25534100
tags question: http://stackoverflow.com/q/25462390
tags question: http://stackoverflow.com/q/25537439
tags question: http://stackoverflow.com/q/25500265

http://stackoverflow.com/comment/39698498
score: 1
comment on: http://stackoverflow.com/q/25422223
type: Comment
type: QuestionComment
has text: @AndrewThompson is correct; as a guide to your debugging efforts, the accepted answer in the [example cited](http://stackoverflow.com/a/20603012/230513) shows how to examine the output of your `Process`, which you presently ignore; you should also study his helpful links.

http://stackoverflow.com/q/25468811
has title: How to add elemts to arraylist
has answer: http://stackoverflow.com/a/25468853
has answer: http://stackoverflow.com/a/25468995
score: 1
tagged with: java
downvote count: 0
upvote count: 1
has body: Prog1: public class TestArrayList { ArrayList&lt;TestVO&gt; list=new ArrayList&lt;TestVO&gt;(); TestVO test5=new TestVO(); public ArrayList&lt;TestVO&gt; getArrayList2() { test5.setName("jagadeesh"); test5.setPhnNo("123456789"); list.add(test5); test5.setName("Prasana"); test5.setPhnNo("987456321"); list.add(test5); return list; } } Prog2: public class TestVO { String name; String phnNo; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPhnNo() { return phnNo; } public void setPhnNo(String phnNo) { this.phnNo = phnNo; } } prog3: public class TestMain { public static void main(String[] args) { TestArrayList aList=new TestArrayList(); ArrayList&lt;TestVO&gt; test=aList.getArrayList2(); for (TestVO testVO : test) { System.out.println("name is: "+testVO.getName()); System.out.println("name is: "+testVO.getPhnNo()); } } } output: name is: Prasana name is: 987456321 name is: Prasana name is: 987456321 while executing above program, I am not understaning why second element replacing first element also. please help me how to fix this?? problem adding elements to array list
has comment: http://stackoverflow.com/comment/39745235
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25468847
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25468841
has answer: http://stackoverflow.com/a/25468906
tagged with: arraylist

http://stackoverflow.com/comment/39724290
comment on: http://stackoverflow.com/q/25457423
type: QuestionComment
has text: Inside the class declaration outside of the method.
score: 0
type: Comment

http://stackoverflow.com/a/25478741
answers question: http://stackoverflow.com/q/25476503
has body: Something as below HQL/SQL SELECT u.UserName,a.street from USER_DETAILS u inner join u.Address ua where u.UserName='user1' and ua.city='City1'; Criteria API Criteria c = session.createCriteria(UserDetails.class, "u"); c.createAlias("user.Address", "ua"); c.add(Restrictions.eq("u.UserName", "user1") c.add(Restrictions.eq("ua.city", "City1"); Have a look here for more info.
type: Answer
score: 0

http://stackoverflow.com/comment/39854099
type: QuestionComment
score: 0
has text: With the code i have already- how do i actually incorporate the functions into my app?
comment on: http://stackoverflow.com/q/25513453
type: Comment

http://stackoverflow.com/q/25421914
answer count: 1
tagged with: orm
accepted answer: http://stackoverflow.com/a/25422024
has body: Is there any FILE-DB library that can be safely queried and updated by multiple java processes (not multiple threads). It seems that MapDB and JSON do not support modifying access from multiple processes. Optionally, I prefer a solution with ORM support. Thanks.
type: Question
has comment: http://stackoverflow.com/comment/39657739
tagged with: rdbms
downvote count: 0
tagged with: database
upvote count: 1
has title: File database in java with concurrent (multi-process) access
favorite count: 0
has answer: http://stackoverflow.com/a/25422024
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json

opengl-es
tags question: http://stackoverflow.com/q/25493935
type: Tag
tags question: http://stackoverflow.com/q/25502996
tags question: http://stackoverflow.com/q/25511521
tag name: opengl-es
tags question: http://stackoverflow.com/q/25507900

http://stackoverflow.com/comment/39689201
comment on: http://stackoverflow.com/a/25422752
score: 0
type: Comment
has text: Sorry, how can I achieve this if I want to define the value of route_directory after the dowloadFolderButton is pressed???
type: AnswerComment

http://stackoverflow.com/comment/39786463
type: Comment
comment on: http://stackoverflow.com/a/25480604
score: 0
type: AnswerComment
has text: Yeah, I tried this too. All approaches with AssetManager that I found on google I tried.

http://stackoverflow.com/a/25520913
answers question: http://stackoverflow.com/q/25490849
type: Answer
has body: I finally found the solution to my problem, though I do not know why it is a solution. The GraphicalEditor class sets the viewer as the site's selection provider in the createPartControl(Composite) method. I overwrote this method to configure the viewer by myself, but I did not set the selection provider here, but later on in another method. Changing this somehow solved the problem.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25490849
score: 0

http://stackoverflow.com/comment/39865657
type: QuestionComment
has text: @JigarJoshi It's of type String. The more important question is what is the type of 'a'.
type: Comment
comment on: http://stackoverflow.com/q/25533978
score: 1

http://stackoverflow.com/comment/39673926
has text: i cant believe that.... wow im such an idiot... basic proof reading i was sure i had but maybe it was such an obvious error that i completely missed it. That was it...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25430391
type: Comment

http://stackoverflow.com/q/25471759
has comment: http://stackoverflow.com/comment/39751193
has comment: http://stackoverflow.com/comment/39751209
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39750831
upvote count: 1
has title: replace programmatic spring @Configuration
has comment: http://stackoverflow.com/comment/39779481
favorite count: 0
linked to: http://stackoverflow.com/q/1667153
type: Question
has comment: http://stackoverflow.com/comment/39752091
has comment: http://stackoverflow.com/comment/39781806
has body: I have some proj_SDK.jar which built with Spring. I have the sources of that jar so I see the following configuration class: package com.my.private; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; /** * Configuration of Spring Beans file name. * */ @Configuration @ImportResource({"classpath:base-core-beans.xml", "classpath:base-security-context.xml"}) public class XmlConfig { } But the thing is that I don't want to load the base-security-context.xml context file. I would like to have only the base-core-beans.xml context. What can I do load the base-core-beans.xml only? Some (maybe) helpful details: I'm building a web-application, so eventually I will also have web.xml file
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39766307
downvote count: 0
tagged with: spring
has comment: http://stackoverflow.com/comment/39770559
tagged with: spring-mvc

http://stackoverflow.com/comment/39730759
has text: @Fabrizio, one contributing factor to the performance is that `list.get(index)` is a linear time operation for a `LinkedList`. Given that you are looping over the whole list, this makes your algorithm as written quadratic. If you use Mr. D Luffy's approach here, using iterators, it will become overall linear and *much* faster.
type: Comment
score: 4
comment on: http://stackoverflow.com/a/25460850
type: AnswerComment

http://stackoverflow.com/comment/39800160
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25497786
has text: @KDM why would you use a synchronized list, when what you want is an immutable list of immutable beans?
score: 0

http://stackoverflow.com/q/25448179
score: 1
tagged with: java
tagged with: h2
has answer: http://stackoverflow.com/a/25450493
tagged with: eclipse
tagged with: servlets
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39706589
accepted answer: http://stackoverflow.com/a/25450493
tagged with: tomcat
has body: I'm having a strange problem with H2 database connection from a Java servlet (running on Tomcat). The scenario is as following: First, I run the servlet on the Tomcat 7.0, everything is fine. I can access the static webpage on the localhost. Then, when I try to execute a communication with servlet via HTML form, everything breaks, and I get an exception: java.lang.ClassNotFoundException: org.h2.Driver at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) .... and so on. The thing is, I have the h2 jar file in the classpath (using Eclipse: right click on project -> Properties -> Libraries tab -> Add (External) JARs...). What I really can't understand is that if I run the same code from a non-servlet class (as Java Application), everything works fine and I can connect to the database. The code I'm using to connect is: try { Class.forName("org.h2.Driver").newInstance();//it breaks here } catch(Exception Ex) { Ex.printStackTrace(); } try { connection = DriverManager.getConnection(url, username, password); } catch(Exception Ex){ Ex.printStackTrace(); } I'm using the exact same connection URL, username and password as for the H2 console, to which I can connect without any problems. Thanks!
possible better answer: http://stackoverflow.com/a/28287319
has title: Unable to connect to H2 from a Tomcat Java servlet
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28287319
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25433371
answer count: 0
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/39679393
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39679958
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39679178
has body: I have a Java app being deployed via Java Web Start. It creates Desktop shortcut on the first run. A few users have complained that when they start the application(via the shortcut) the app fails to launch and they get this error. Any idea what might be causing this? This in on a shared computer with multiple users.
has comment: http://stackoverflow.com/comment/39679778
downvote count: 0
has title: Cached Java Webstart App does not start
tagged with: java-web-start
has comment: http://stackoverflow.com/comment/39679336
has comment: http://stackoverflow.com/comment/39679443

http://stackoverflow.com/comment/39831976
type: Comment
type: QuestionComment
has text: List<TextPoint> type will preserve the order.
comment on: http://stackoverflow.com/q/25514862
score: 2

http://stackoverflow.com/q/25538609
tagged with: java
answer count: 1
tagged with: nutch
has body: Nutch Gurus, If I change files such as robots.txt, or regex-urlfilter.txt and any such resources, which command do I need to invoke? I was not sure from the nutch instructions. I am guessing it is parser job, but I am not sure. Kartik From the instructions # echo " crawl one-step crawler for intranets" echo " inject inject new urls into the database" echo " hostinject creates or updates an existing host table from a text file" echo " generate generate new batches to fetch from crawl db" echo " fetch fetch URLs marked during generate" echo " parse parse URLs marked during fetch" echo " updatedb update web table after parsing" echo " updatehostdb update host table after parsing" echo " readdb read/dump records from page database" echo " readhostdb display entries from the hostDB" echo " elasticindex run the elasticsearch indexer" echo " solrindex run the solr indexer on parsed batches" echo " solrdedup remove duplicates from solr" echo " parsechecker check the parser for a given url" echo " indexchecker check the indexing filters for a given url" echo " plugin load a plugin and run one of its classes main()" echo " nutchserver run a (local) Nutch server on a user defined port" echo " junit runs the given JUnit test" echo " or" echo " CLASSNAME run the class named CLASSNAME" echo "Most commands print help when invoked w/o parameters."
tagged with: mapreduce
tagged with: web-crawler
has title: What Nutch command do I need to invoke from the command line if I update the url filter text
type: Question
has answer: http://stackoverflow.com/a/26272343
type: UnansweredQuestion
score: 0

http://stackoverflow.com/q/25405289
has body: I have an issue which I cannot seem to get my head around. The background to it is that I am trying to update a view on an Android Wear device I have a WearableListenerService called MessageListener which has an onMessageReceived function as follows: public void onMessageReceived(MessageEvent messageEvent) { Log.v("WEAR", "MessageListener Triggered"); MessageObject msg = processMessageEvent(messageEvent); // handle only wear messages if (msg.getTarget().equals("wear")) { Log.v("WEAR:", "COMMAND RECEIVED: " + msg.getCommand()); Log.v("WEAR:", "TARGET RECEIVED: " + msg.getTarget()); Log.v("WEAR:", "MESSAGE RECEIVED: " + msg.getMessage()); if (msg.getCommand().equals("SMS")) { Log.v("WEAR:", "SMS COMMAND RAN. " + msg.getMessage()); // do something } else if (msg.getCommand().equals("CODE")) { // do something Log.v("WEAR:", "CODE RECEIVED: " + msg.getMessage()); Main.textCode.setText(msg.getMessage()); } } } This code works fine until it gets to Main.textCode.setText(msg.getMessage()); where it crashes with a NullPointerException. msg.getMessage is populated as it outputs the message into the verbose log as per the code. In my Main class, I am declaring the textCode as a TextView, public static TextView textCode; and then in onCreate, I am setting the textCode to the xml element: textCode = (TextView) findViewById(R.id.textCode); The full error is: 08-20 13:45:41.689 2248-2262/com.domain.cinesaver E/AndroidRuntime﹕ FATAL EXCEPTION: WearableListenerService Process: com.domain.cinesaver, PID: 2248 java.lang.NullPointerException at com.domain.cinesaver.MessageListener.onMessageReceived(MessageListener.java:50) at com.google.android.gms.wearable.WearableListenerService$a$2.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61)
linked to: http://stackoverflow.com/q/8357200
has answer: http://stackoverflow.com/a/33607265
has comment: http://stackoverflow.com/comment/39628204
answer count: 2
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39628058
tagged with: wear-os
type: Question
has comment: http://stackoverflow.com/comment/39627688
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39626690
has comment: http://stackoverflow.com/comment/39628426
tagged with: android
has comment: http://stackoverflow.com/comment/39628335
has answer: http://stackoverflow.com/a/25405624
has comment: http://stackoverflow.com/comment/39627126
has title: Appending TextView from Service?

http://stackoverflow.com/comment/39638146
has text: @laune That would be fine, but how do I tell the EE6 container which `JAXBContext` to use? Is it just as simple as creating an `@Provider`?
score: 0
comment on: http://stackoverflow.com/q/25410831
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25419435
type: Question
tagged with: hadoop
answer count: 0
has title: Job failed with large volume of small data: java.io.EOFException
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has body: I have encounter a weird problem, I got a hive MR job which would always failed if there are large number of input file(e.g. 1500 input files), but always succeed if there is only a little input files(e.g. 50 input files). according to the running status attached below, I have found that all the reducer has been failed, and the error is EOFException, which make me more confused. Is there any suggestion to fix this? Logs from syslog of job: 2014-08-21 10:45:46,520 INFO org.apache.hadoop.io.compress.CodecPool: Got brand-new compressor 2014-08-21 10:45:46,794 INFO org.apache.hadoop.hdfs.DFSClient: Exception in createBlockOutputStream java.io.EOFException 2014-08-21 10:45:46,794 INFO org.apache.hadoop.hdfs.DFSClient: Abandoning block blk_5374920402716501410_79091174 2014-08-21 10:45:49,054 INFO org.apache.hadoop.hdfs.DFSClient: Exception in createBlockOutputStream java.io.EOFException 2014-08-21 10:45:49,054 INFO org.apache.hadoop.hdfs.DFSClient: Abandoning block blk_8556910516797493817_79091178 2014-08-21 10:45:49,995 INFO org.apache.hadoop.hdfs.DFSClient: Exception in createBlockOutputStream java.io.IOException: Bad connect ack with firstBadLink 10.0.3.8:50010 2014-08-21 10:45:49,995 INFO org.apache.hadoop.hdfs.DFSClient: Abandoning block blk_87853064200958346_79090990 2014-08-21 10:45:49,999 INFO org.apache.hadoop.hdfs.DFSClient: Waiting to find target node: 10.0.3.25:50010 2014-08-21 10:45:52,808 INFO org.apache.hadoop.hdfs.DFSClient: Exception in createBlockOutputStream java.io.EOFException 2014-08-21 10:45:52,809 INFO org.apache.hadoop.hdfs.DFSClient: Abandoning block blk_-4129790945127001814_79091181 2014-08-21 10:45:55,080 INFO org.apache.hadoop.hdfs.DFSClient: Exception in createBlockOutputStream java.io.EOFException 2014-08-21 10:45:55,081 INFO org.apache.hadoop.hdfs.DFSClient: Abandoning block blk_-2690563202614665609_79091181 2014-08-21 10:45:56,014 INFO org.apache.hadoop.hdfs.DFSClient: Exception in createBlockOutputStream java.io.EOFException 2014-08-21 10…
favorite count: 0
tagged with: hive
has comment: http://stackoverflow.com/comment/39889641
score: 1
tagged with: java
tagged with: hiveql
tagged with: hadoop-plugins
has comment: http://stackoverflow.com/comment/40058359

http://stackoverflow.com/a/25445258
type: Answer
has body: Maybe this is the code you want: import java.util.Scanner; public class WTF { public static void main(String[] args) { new WTF().doIt(); } private void doIt() { Scanner sc = new Scanner(System.in); int row = 8; int column = 5; int count = 0; for (int i = 0; i &lt; row; i++) { System.out.println("Please enter the row no. " + (i + 1) + ":"); String str = sc.nextLine(); // cut the string to 5 chars str = str.substring(0, column); char[] charArray = str.toCharArray(); for (char c : charArray) { if ('c' == c) { count++; } } } System.out.println("The number of c entered is: " + count); } }
score: 0
answers question: http://stackoverflow.com/q/25445024

http://stackoverflow.com/q/25458071
tagged with: entity
has answer: http://stackoverflow.com/a/25458240
score: 0
has title: Create and save an object to a table using JPA but have the table name as a parameter
tagged with: sql
tagged with: java
answer count: 1
tagged with: jpa
linked to: http://stackoverflow.com/q/8649059
type: Question
type: UnansweredQuestion
tagged with: hibernate
has body: So I know that if I've an object (lets say Message object) properly annotated I can just do: EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(databaseName); EntityManager entityManager = entityManagerFactory.createEntityManager(); EntityTransaction transaction = entityManager.getTransaction(); try { transaction.begin(); Message msg = new Message("Message"); entityManager.persist(msg); transaction.commit(); } And the table will be created with whatever value there is in Message annotation. In this case let's say Message's object has this annotation for the table name: @Table(name = "tableMessage") Therefore, the table tableMessage will be created and the Message object will be saved into the table tableMessage. My question is, let's say I've a text field where the user will input the name for the table to where he wants to save the Message object (and create the table if it does not exist). How can I do this? If I knew before hand I could just go to the Message class and change it manually but I don't know. PS; I'm using hibernate as my implementation for the JPA.

http://stackoverflow.com/q/25474730
tagged with: picklist
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/29822334
type: UnansweredQuestion
score: 1
tagged with: java
has body: I'm coming crazy as I can't figure out what's going wrong with my picklist. When I press the submit button, the targetList is empty. This creates of course a conversion error: {0}: Conversion error occurred. I've simplified the code posted below, but it should contain all necessary elemetns. picklist.xhtml &lt;p:pickList id="pickListQuestions" value="#{questionController.surveyQuestionPickList}" var="question" itemLabel="#{question.question}" itemValue="#{question}" converter="questionConverter"/&gt; &lt;h:commandButton id="questionSubmit" value="Add questions" action="#{questionController.addQuestions()}" /&gt; questionConverter.java import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.convert.FacesConverter; import com.survey.jsfController.ApplicationController; import com.survey.model.Question; @FacesConverter("questionConverter") public class QuestionConverter implements Converter { public Object getAsObject(FacesContext fc, UIComponent uic, String value) { if (value != null &amp;&amp; value.trim().length() &gt; 0) { return ApplicationController.getQuestionService().retrieveById(Long.parseLong(value)); } return null; } public String getAsString(FacesContext fc, UIComponent uic, Object object) { if (object == null || object.equals("")) { return ""; } else { return String.valueOf(((Question) object).getId()); } } } questionController.java import java.io.Serializable; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.RequestScoped; import javax.faces.context.FacesContext; import org.primefaces.model.DualListModel; import com.survey.model.Answer; import com.survey.model.Question; import com.survey.model.QuestionType; import com.survey.model.Survey; @RequestScoped /…
has title: JSF Picklist empty hence conversion error

http://stackoverflow.com/a/26854024
downvote count: 0
upvote count: 1
score: 1
has body: You can create a custom parameter -Dbrowser=chrome or -Dbrowser=firefox. Based on the value in the Dbrowser you need to initialize appropriate driver in the setup() method. -Dbrowser can be read using the System.getProperty("browser") code.
answers question: http://stackoverflow.com/q/25427975
type: Answer

http://stackoverflow.com/comment/39750541
type: Comment
has text: @REG1 I think that both of your two questions are answered. Mark the answear as the correct one, and if you have more questions, open a new question ;)
type: AnswerComment
comment on: http://stackoverflow.com/a/25471070
score: 0

http://stackoverflow.com/comment/39769543
comment on: http://stackoverflow.com/a/25481781
has text: IF I use the String.getBytes() method, it returns the ASCII representation and not the Byte representation for examples String s = "BACB" //byte0 = 0xBA (decimal 186) //byte1 = 0xCB (decimal 203) byte[] barray = s.getBytes(Charset.forName("UTF-8")); //barray[0] = 66 //barray[1] = 65 //barray[2] = 67 //barray[3] = 66
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/39745658
type: QuestionComment
score: 0
has text: Why - the hell - did this question got 6 upvotes? Both topics in this question (equality vs. identity, wrapper classes) were asked so many times in the past that this question never should have been asked.
type: Comment
comment on: http://stackoverflow.com/q/25468794

http://stackoverflow.com/comment/39787445
score: 0
has text: I am still having trouble, my app stops working... I used debbug tool, so it now just freezes, but not stops... And, if I delete this code, nothing happens (doesn't bug) Does string.format requires something like import or?
type: Comment
comment on: http://stackoverflow.com/a/25491081
type: AnswerComment

http://stackoverflow.com/q/25541670
score: 2
has comment: http://stackoverflow.com/comment/39880152
upvote count: 2
tagged with: tcp
has comment: http://stackoverflow.com/comment/39880250
has comment: http://stackoverflow.com/comment/39879920
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25544683
has title: Connecting android to remote sqlserver
favorite count: 0
type: Question
has body: I am trying to connect to an SQL Server remote database but I can't create new connection in Android although I can connect through a Java application with exact the same code. DriverManager.getConnection() throws an exception. Here's my code public DatabaseManipulation() { URL=String.format(URL,localDatabaseName); Connect(); } public void Connect() { try { connection = DriverManager.getConnection(URL, DATABASE_USERNAME, DATABASE_PASSWORD); statement=connection.createStatement(); } catch(Exception e) { Log.d("con",e.getMessage); } } Exception: "The TCP/IP connection to the host 192.168.100.23, port 1433 has failed. Error: "/192.168.100.23:1433 - Network is unreachable. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall."."
tagged with: sql-server
has comment: http://stackoverflow.com/comment/39880381
type: UnansweredQuestion
tagged with: android
tagged with: java

http://stackoverflow.com/q/25525878
type: AnsweredQuestion
has title: Java properties file that uses percent sign "%"
has answer: http://stackoverflow.com/a/25525969
answer count: 2
score: 1
possible better answer: http://stackoverflow.com/a/25525963
tagged with: java
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25525963
favorite count: 0
type: Question
has body: In my properties file I have key=cheese key%dutch=gouda key%french=brie I can reference in my jsp code : &lt;t:if condition="${key eq 'cheese'}"&gt; but how to reference (this doesn't work): &lt;t:if condition="${key%dutch eq 'cheese'}"&gt;
tagged with: jsp
tagged with: properties
accepted answer: http://stackoverflow.com/a/25525969

http://stackoverflow.com/comment/39988202
type: AnswerComment
has text: @b16db0 on Windows it might not, no reason it should use any kind of randomization. But the only way for the JIT or the compiler to know that would be to recursively check every single method/variable that's being used by ```getCanonicalPath()```.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25442486

ondraw
type: Tag
tag name: ondraw
tags question: http://stackoverflow.com/q/25536289

http://stackoverflow.com/comment/39801210
type: QuestionComment
has text: I discovered something very interesting: as you both already assumed, the code is not in sync indeed. The problem is that i don't know why. I restarted even the whole computer and did "Save All" and "Sync" in my IDE and still no change.
comment on: http://stackoverflow.com/q/25472534
score: 0
type: Comment

http://stackoverflow.com/comment/39861391
type: Comment
type: AnswerComment
has text: @Oran `float` != `Float`, and `double` != `Double`. It also could be impacted by third party libraries that expect the other type.
comment on: http://stackoverflow.com/a/25531458
score: 0

http://stackoverflow.com/q/25405966
tagged with: asp.net-web-api
upvote count: 7
downvote count: 1
favorite count: 0
has body: As mentioned in the topic, can someone explain the relationship between the client API and the server API? For example, we have a web with its server written in java and use Axis2. I get access to the source code and find there is a folder called 'client_API' and all the codes are written in JAVA. What exactly does client API do? It works at server side or client side?(From its name I think it should work on the client side, but the client side is just a user's browser, but how could a browser read the JAVA code?).
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25407692
has comment: http://stackoverflow.com/comment/39628249
has comment: http://stackoverflow.com/comment/39628902
has answer: http://stackoverflow.com/a/25406139
possible better answer: http://stackoverflow.com/a/25406139
tagged with: java
has title: difference between client API and server API
tagged with: client-side
answer count: 4
has comment: http://stackoverflow.com/comment/39628262
has answer: http://stackoverflow.com/a/25406120
type: Question
has answer: http://stackoverflow.com/a/25407692
has answer: http://stackoverflow.com/a/25406119
tagged with: .net
score: 6

http://stackoverflow.com/q/25495550
has answer: http://stackoverflow.com/a/25495781
has body: I have very simple imageview app that is suppose to set the wallpaper when the user click on any image. However, my problem is that as I am displaying full image in viewpager. And when user click on the image it takes the whole screen of the device or emulator. In other words image appear to be distorted or cut in Home screen. Can any one please suggest the code on how to fix this issue or what am I missing in my code ?... I believe that I have to change ImageAdpater code.. But I am not sure.... Following are my codes.. Mainactivity.java import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.view.Menu; import android.view.MenuItem; import android.widget.ShareActionProvider; public class MainActivity extends Activity { MediaPlayer oursong; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); oursong = MediaPlayer.create(MainActivity.this, R.raw.a); oursong.start (); ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); ImageAdapter adapter = new ImageAdapter(this); viewPager.setAdapter(adapter); } private ShareActionProvider mShareActionProvider; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate menu resource file. getMenuInflater().inflate(R.menu.activity_main, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_item_share); // Fetch and store ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider(); // Return true to display menu return true; } // Call to update the share intent private void setShareIntent(Intent shareIntent) { if (mShareActionProvider != null) { mShareActionProvider.setShareIntent(shareIntent); } } @Override protected void onPause(){ super.onPause(); oursong.release(); } } Imageadapter.java import java.io.IOException; import android.app.Wallpaper…
score: 0
has title: Setting screen fit wallpaper in imageview android app
tagged with: android
tagged with: java
tagged with: gallery
type: Question
has answer: http://stackoverflow.com/a/25495802
answer count: 2
tagged with: android-viewpager
type: UnansweredQuestion

http://stackoverflow.com/q/25390281
has body: Is it possible to improve this Java code by not using labels (and not repeating too much code or creating too many methods)? void func() { Object r; Object s; if (r == null ) { try { some code 1 modifying the value of s; } catch (Exception e) { some code 2; break lab1; } if ( s == null ) { some code 3; break lab2 } } lab1: some code 4; lab2: some code 5; } Edit: I made a mistake using break/label. I used them like a goto (code after lab1 must be executed also if r!=null. This is not their purpose, and such code cannot compile because the break cannot reference a label forward. I understand there is no goto equivalent (a statement that can branch anywhere) in Java. I wrote the code using a custom Exception1 that forces the outer if to be exited: try { if (r!=null) { throws new Exception1(); } try { some code 1; } catch (Exception e1) { some code 2; throws new Exception1(); } if (s == null) { some code 3; } } catch (Exception1 e2) { some code 4; } some code 5; This would not be a winner at a code-fashion contest, but at least it works. Thanks for your answers and comments.
possible better answer: http://stackoverflow.com/a/25390373
type: Question
tagged with: try-catch
tagged with: code-maintainability
has answer: http://stackoverflow.com/a/25390373
has comment: http://stackoverflow.com/comment/39599068
tagged with: if-statement
has answer: http://stackoverflow.com/a/25390514
has comment: http://stackoverflow.com/comment/39599675
tagged with: label
accepted answer: http://stackoverflow.com/a/25390440
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25390440
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39599182
tagged with: java
has title: How to exit if and try/catch and branch elsewhere (like a goto) in Java?

http://stackoverflow.com/comment/39601200
type: AnswerComment
comment on: http://stackoverflow.com/a/25391384
type: Comment
has text: Ingres and Vectorwise do. I believe SQL server does as well.
score: 0

http://stackoverflow.com/comment/39717956
has text: This problem has nothing to do with JDBC, the driver, the port, etc.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25454093

relative-path
type: Tag
tag name: relative-path
tags question: http://stackoverflow.com/q/25546869

http://stackoverflow.com/comment/39882986
type: Comment
has text: _The new string will use the same char[], and won't create a new one_ Actually, it does. The `String` constructor creates a new `char[]` and _copies_ the content to it, it doesn't reuse the existing one.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25543346

http://stackoverflow.com/comment/39675023
type: Comment
type: QuestionComment
has text: Yes: escape the quotes...
comment on: http://stackoverflow.com/q/25431049
score: 1

http://stackoverflow.com/comment/39693556
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25441310
has text: Use a lock file, open a socket, render some aspect that an instance of the application needs to check before continuing to load and stop if it can't satisfy that check...

http://stackoverflow.com/comment/39768578
comment on: http://stackoverflow.com/q/25481288
type: QuestionComment
has text: My other guess would be that `k` in `int k = Integer.parseInt(input.substring(i, i+8), 2);` produces a character that is outside of the character range, thus java does not know how to interpret the character and puts a `?` instead.
score: 0
type: Comment

http://stackoverflow.com/q/25508668
has comment: http://stackoverflow.com/comment/39820139
tagged with: java
has answer: http://stackoverflow.com/a/25509207
type: Question
tagged with: netbeans
has comment: http://stackoverflow.com/comment/39819789
tagged with: graphic
has comment: http://stackoverflow.com/comment/39820172
possible better answer: http://stackoverflow.com/a/25509207
tagged with: swing
has comment: http://stackoverflow.com/comment/39819996
accepted answer: http://stackoverflow.com/a/25509283
type: AnsweredQuestion
has body: What I did is: I created a subclass of java.swing.JPanel public class TableInterfaceBDD extends javax.swing.JPanel I then created all of my textfield areas, my Jtable, etc. in that class. Then I created a subclass of java.swing.JFrame, which will be my main class public class MainTableInterface extends javax.swing.JFrame and I wrote this code in MainTableInterface: public MainTableInterface() { initComponents(); TableInterfaceBDD pan = new TableInterfaceBDD(); this.setContentPane(pan); this.setVisible(true); this.validate(); } But my graphical interface that I worked on TableInterfaceBDD doesn't show up. Can you help me with that?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25509283
has title: show graphical interface of a jpanel in a jframe

http://stackoverflow.com/a/25411025
type: Answer
answers question: http://stackoverflow.com/q/25410788
accepted answer of: http://stackoverflow.com/q/25410788
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: This is because the MainActivity doesn't implement that method. As described in this link the tools:context attribute expects an Activity, not a Fragment. You could do that instead : public class CardBackFragment extends Fragment implements OnClickListener { public CardBackFragment() {} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_coindice, container, false); v.findViewById(R.id.coin2).setOnClickListener(this); return v; } public void onClick(View view){ switch (view.getId()) { case R.id.coin2: break; } } }

http://stackoverflow.com/a/25437753
score: 2
type: Answer
answers question: http://stackoverflow.com/q/25437673
has comment: http://stackoverflow.com/comment/39687583
upvote count: 2
has body: What you probably want is this: JCheckBox[] checkboxesArray = new JCheckBox[10]; int i, count; for (i=0; i&lt;10; i++){ /* display a checkbox... */ /* Finished displaying checkboxes, now you wait for user to finish input... */ for (i=0; i&lt;10; i++){ if (checkboxesArray[i].isSelected()) count += 10; } s = "Price for this is RM " + count; JOptionPane.showMessageDialog(null, s);
has comment: http://stackoverflow.com/comment/39687626
downvote count: 0

http://stackoverflow.com/comment/39602496
score: 0
comment on: http://stackoverflow.com/a/25392059
type: Comment
has text: 2nding Xinzz's comment. I *always* use brackets, including for just one line.
type: AnswerComment

http://stackoverflow.com/comment/39760651
comment on: http://stackoverflow.com/q/25476873
score: 1
type: Comment
has text: I think the third test doesn't make sense. If there's a literal \ within the curly braces the value within the curly braces is not *variable*
type: QuestionComment

http://stackoverflow.com/comment/39776889
score: 0
type: Comment
has text: I saw that documentation as well, but wasn't sure exactly how it applies to this particular behavior. It is helpful to hear that such behavior is possible.
comment on: http://stackoverflow.com/a/25462440
type: AnswerComment

http://stackoverflow.com/comment/39716253
comment on: http://stackoverflow.com/a/25449776
type: Comment
has text: thanks. I'll read about it. Can you please see my question here: http://stackoverflow.com/questions/25449502/gsonbuilder-setdateformat-doesnt-change-the-string-that-i-get-from-the-s maybe I the date format doesn't fit?
score: 0
type: AnswerComment

http://stackoverflow.com/a/25537880
answers question: http://stackoverflow.com/q/25537857
has comment: http://stackoverflow.com/comment/39876917
has comment: http://stackoverflow.com/comment/39873870
downvote count: 6
score: -5
accepted answer of: http://stackoverflow.com/q/25537857
has comment: http://stackoverflow.com/comment/39873221
has comment: http://stackoverflow.com/comment/39876572
type: Answer
has body: remove first line "package hello;"
has comment: http://stackoverflow.com/comment/39874214
has comment: http://stackoverflow.com/comment/39873945
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39876951
has comment: http://stackoverflow.com/comment/39873328
upvote count: 1

http://stackoverflow.com/q/25390782
has body: I need to maintain a list of objects in a multi-threaded environment. I have read about CopyOnWriteArrayList and it seemed to be an option to go for. The problem is, I needed to sort the list, too. I cannot use Collections.sort() for CopyOnWriteArrayList as it doesn't support the set() operation. I have found few ways to sort the CopyOnWriteArrayList. But performance-wise, they don't look to be good. My question: is there an alternative data-structure which will come handy in this situation? Basically, I need to keep a sorted list in an multi-threaded environment. A list adapter will use that data structure. So, it should have provide methods like "get(position)". I recently read about another data structure ConcurrentSkipListSet. Can anyone explain what are the pros and cons of it? Will it be a good fit for my problem?
linked to: http://stackoverflow.com/q/6720396
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39600147
tagged with: sorting
tagged with: data-structures
has title: Sorting a CopyOnWriteArrayList
linked to: http://stackoverflow.com/q/1904439
score: 2
has answer: http://stackoverflow.com/a/28022164
downvote count: 0
has comment: http://stackoverflow.com/comment/39632502
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39629294
has comment: http://stackoverflow.com/comment/39601722
has comment: http://stackoverflow.com/comment/39629543
favorite count: 0
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/33031713

http://stackoverflow.com/comment/39797753
score: 0
comment on: http://stackoverflow.com/a/25496926
type: Comment
type: AnswerComment
has text: Thank you so much dude, but you were 7 seconds too late (he he). I figured it out after a while. But thanks, have a nice one. @mattingly980

http://stackoverflow.com/q/25478948
has answer: http://stackoverflow.com/a/25479182
has comment: http://stackoverflow.com/comment/39764158
type: Question
tagged with: serialization
upvote count: 0
answer count: 2
has answer: http://stackoverflow.com/a/25479022
type: UnansweredQuestion
tagged with: volatile
has title: Is there any relationship between transient & volatile variables and serial version uid?
score: -3
tagged with: transient
tagged with: serialversionuid
linked to: http://stackoverflow.com/q/910374
has body: Actually I want to know about the concept of serialization and in what way that the transient&amp;local variables are related to serialversionuid and how the serialization is actually happening?
downvote count: 3
tagged with: java
favorite count: 0

http://stackoverflow.com/comment/39777264
type: QuestionComment
has text: @user3280711 In that case I can post an answer, please see if it's what you need.
comment on: http://stackoverflow.com/q/25474272
score: 0
type: Comment

http://stackoverflow.com/q/25513074
has body: I am accessing HSQLDB through A jdbc drive in my java program. The script file of the database is as follows. CREATE SCHEMA PUBLIC AUTHORIZATION DBA CREATE CACHED TABLE TBL1(ID CHAR(5),NAME VARCHAR(11),ZIP VARCHAR(11)) CREATE UNIQUE INDEX IDX_ID ON TBL1(ID) CREATE CACHED TABLE TBL2(ID CHAR(5),STREET CHAR(5)) CREATE INDEX IDX_RS_ID ON TBL2(ID) CREATE CACHED TABLE TBL3(ID VARCHAR(8) NOT NULL PRIMARY KEY,LON FLOAT,LAT FLOAT) CREATE GLOBAL TEMPORARY MEMORY TABLE OVERLAY(ID CHAR(8),AROUTE CHAR(10),ZROUTE CHAR(10),TYPE CHAR(8)) ON COMMIT PRESERVE ROWS SET TABLE TBL1 INDEX'4490648 5643624 0' SET TABLE TBL2 INDEX'529105280 529105280 0' SET TABLE TBL3 INDEX'775814624 0' CREATE VIEW OVERLAYSPAN (ID,STREET) AS SELECT DISTINCT ID, NAME FROM OVERLAY AS O, TBL2 as R WHERE O.ID = R.ID CREATE USER SA PASSWORD "" GRANT DBA TO SA SET WRITE_DELAY 10 In the java program, I am first removing all entries (1000 entries) from TBL1 and reinserting new entries (1500) in the same table. The program executes normally, but, when I am attempting to re-execute the same program, I am getting the following error. java.sql.SQLException: error in script file line: 9 S1000 General error java.lang.NullPointerException in statement [SET TABLE TBL2 INDEX'529105280 529105280 0'] Here is the fill stack trace from the program. java.sql.SQLException: error in script file line: 9 S1000 General error java.lang.NullPointerException in statement [SET TABLE TBL2 INDEX'529105280 529105280 0'] at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.jdbcConnection.&lt;init&gt;(Unknown Source) at org.hsqldb.jdbcDriver.getConnection(Unknown Source) at org.hsqldb.jdbcDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at HSQLTesting.main(HSQLTesting.java:98) Where at line 98, the program is attempting to make a connection with the database. Connection sqlconnect = DriverManager.getConnection("jdbc:hsqldb:file:C:/b…
type: Question
score: 0
answer count: 0
tagged with: sql
type: UnansweredQuestion
has title: NullPointerException while accessing HSQLDB database
tagged with: hsqldb
has comment: http://stackoverflow.com/comment/39828113
tagged with: java
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39829161
has comment: http://stackoverflow.com/comment/39828859

http://stackoverflow.com/q/25420843
tagged with: java
has answer: http://stackoverflow.com/a/25421591
answer count: 1
tagged with: google-cloud-storage
favorite count: 0
has body: can i use "Whitelisting by IP Address (Server-side applications)" for Google Cloud Storage JSON API? i followed the steps here: "https://developers.google.com/console/help/" but it didn't work. And i can't find documentation on this. here is what i've: i've created a project and added some objects there, gave the objects these permissions AllUsers - read i want to allow access to requests from certain IPs, so i decided to use "Whitelisting by IP Address" but it didn't work...i took the object MediaLink, copied it to the broweser and i was able to access it, even though the PC IP address was not defined in the server Key i generated. the link i used it: object-Media-Link?key=myKey Thanks, Snabel
type: Question
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has title: "Whitelisting by IP Address (Server-side applications)" for Google Cloud Storage JSON API
score: 1

http://stackoverflow.com/q/25507047
has title: JNI UnsatisfiedLinkError issue
tagged with: dll
type: UnansweredQuestion
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/25507294
tagged with: http://stackoverflow.com/tag/c
tagged with: eclipse
score: 0
tagged with: java
answer count: 1
has body: I am creating a Java program using JNI to gather data via a C program. I have gone through this JNI tutorial (https://thenewcircle.com/static/bookshelf/java_fundamentals_tutorial/_java_native_interface_jni.html), and everything compiles correctly. However, when I try to run the Java program in Eclipse, I keep getting this error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no TurtleTrackerImpl in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at main.TurtleTracker.(TurtleTracker.java:28) at main.Driver.main(Driver.java:54) I include the library using System.loadLibrary("TurtleTrackerImpl") in the Java class of the same name. I have printed out the library path to make sure it is correct (C:\Users\duril_000\workspace\ArenaTracker\ArenaTracker\src), and I have checked for the existence of the libTurtleTrackerImpl.jnilib within that path (it exists and I can even print out its contents within Eclipse). There are a lot of other similar issues online, but I have not been able to find any where the library path was correct and the issue persisted. Please assist--I cannot think of what would be wrong? Let me know if more info is needed.
type: Question

http://stackoverflow.com/q/25466319
has comment: http://stackoverflow.com/comment/39751269
has comment: http://stackoverflow.com/comment/39751120
score: 2
has comment: http://stackoverflow.com/comment/39755219
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/39751146
has title: Result showing lining on image
has answer: http://stackoverflow.com/a/25846819
linked to: http://stackoverflow.com/q/23801988
has comment: http://stackoverflow.com/comment/39752731
has comment: http://stackoverflow.com/comment/39751216
answer count: 1
has comment: http://stackoverflow.com/comment/39830552
has comment: http://stackoverflow.com/comment/39768037
has body: I am using opencv with android ndk , Below is my jni code: void Vignete(Mat&amp; img1, Mat&amp; img2, Mat&amp; out) { resize(img1, img1, img2.size()); img1.convertTo(img1,CV_32FC4,1.0/255.0); img2.convertTo(img2, CV_32FC4, 1.0/255.0); vector&lt;Mat&gt; ch; Mat I1; split(img2,ch); Mat alpha1 = ch[3]; Mat alpha = alpha1.clone(); Mat ch0 = ch[0]; Mat ch1 = ch[1]; Mat ch_2 = ch[2]; Mat ch_3 = ch[3]; cv::multiply(alpha,ch0,ch0); cv::multiply(alpha,ch1,ch1); cv::multiply(alpha,ch_2,ch_2); cv::multiply(alpha,ch_3,ch_3); vector&lt;Mat&gt; newVec; newVec.push_back(ch0); newVec.push_back(ch1); newVec.push_back(ch_2); newVec.push_back(ch_3); merge(newVec, I1); vector&lt;Mat&gt; ch2; Mat I2; split(img2,ch2); Mat ch_0 = ch2[0]; Mat ch_1 = ch2[1]; Mat ch_21 = ch2[2]; Mat ch_31 = ch2[3]; cv::multiply(1.0-alpha,ch_0,ch_0); cv::multiply(1.0-alpha,ch_1,ch_1); cv::multiply(1.0-alpha,ch_21,ch_21); cv::multiply(1.0-alpha,ch_31,ch_31); vector&lt;Mat&gt; newVec1; newVec1.push_back(ch_0); newVec1.push_back(ch_1); newVec1.push_back(ch_21); newVec1.push_back(ch_31); merge(newVec1, I2); Mat result = I1+I2; result.convertTo(out, CV_8UC4, 255); } Below is my jni calling method : JNIEXPORT jint JNICALL Java_org_opencv_samples_NativeActivity_CvNativeActivity_Vig( JNIEnv* env, jobject, jint width, jint height, jint i, jint j, jintArray in,jintArray inn, jintArray out) { jint* _in = env-&gt;GetIntArrayElements(in, 0); jint* _inn = env-&gt;GetIntArrayElements(inn, 0); jint* _out = env-&gt;GetIntArrayElements(out, 0); Mat mSrc(height, width, CV_8UC4, (unsigned char*) _in); Mat nSrc(i, j, CV_8UC4, (unsigned char*) _inn); Mat bgra(height, width, CV_8UC4, (unsigned char*) _out); Vite(mSrc,nSrc, bgra); jint retVal; int ret = 1; retVal = jint(retVal); return retVal; } Result : My java calling , where img1 is image in snapshot and img2 image 2 is vignette of 4 channel is input and out is output InputStream is , Vign; is = this.getResources().openRawResource(R.drawable.me); final Bitmap bmInImg = BitmapFact…
downvote count: 1
has comment: http://stackoverflow.com/comment/39752133
has comment: http://stackoverflow.com/comment/39830452
tagged with: android-ndk
favorite count: 0
has comment: http://stackoverflow.com/comment/39746799
has comment: http://stackoverflow.com/comment/39750965
type: Question
has comment: http://stackoverflow.com/comment/39774152
has comment: http://stackoverflow.com/comment/39751263
tagged with: opencv
has comment: http://stackoverflow.com/comment/39752934
has comment: http://stackoverflow.com/comment/39792864
has comment: http://stackoverflow.com/comment/39751614
has comment: http://stackoverflow.com/comment/39744733
accepted answer: http://stackoverflow.com/a/25846819
tagged with: java-native-interface
tagged with: java
has comment: http://stackoverflow.com/comment/39953483
tagged with: computer-vision
has comment: http://stackoverflow.com/comment/39949202

http://stackoverflow.com/comment/39805793
score: 0
comment on: http://stackoverflow.com/q/25501539
type: Comment
has text: Can you show us what you tried?
type: QuestionComment

http://stackoverflow.com/q/25433095
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/39678922
has title: Android Button Background
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39679253
has comment: http://stackoverflow.com/comment/39678672
has body: i am new to android development, i am trying to create an application in which i use my own design for button for this i use background image for button, but when i put background image for button then it delete R.java file from gen folder and show error in main activity R.layout.activity_main. Please help me i am very stress. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.ele.masjidddd.MainActivity" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textView1" android:layout_marginTop="62dp" android:layout_toRightOf="@+id/textView1" android:background="@drawable/timetablebtn" android:text="Button" /&gt; &lt;/RelativeLayout&gt; this is my mainactivity xml code Thanks
has answer: http://stackoverflow.com/a/25433768
has comment: http://stackoverflow.com/comment/39679352
tagged with: android-layout
score: 0
has comment: http://stackoverflow.com/comment/39680034
tagged with: android
tagged with: java

http://stackoverflow.com/q/25406227
tagged with: java
has comment: http://stackoverflow.com/comment/39629876
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25406550
tagged with: google-app-engine
type: UnansweredQuestion
has title: Set Max Age for GAE Datastore Entries
has body: I'm writing a program using Java Google App Engine. I'd like to have certain types of entities automatically removed from a datastore once they reach a certain age, to prevent using unnecessary memory. Here's the very unexciting way I'm creating entities: DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Entity entity = new Entity("thingamabob","special_thingamabob"); datastore.put(entity); In this case, I'd want to have special_thingamabob automatically go away from the datastore after, say, 12 hours. I know I could give each entity a timestamp and then use cron to query every hour for timed-out entities, but is there an easier way?
score: 0

http://stackoverflow.com/q/25432381
has answer: http://stackoverflow.com/a/25433131
possible better answer: http://stackoverflow.com/a/25433131
tagged with: jcombobox
tagged with: tostring
type: AnsweredQuestion
answer count: 2
has body: The object class that I am working with already has its .toString() method overridden, giving its name. But I am using same object in a JComboBox and I need to display another String. Is there a way to accomplish this?
tagged with: java
has comment: http://stackoverflow.com/comment/39677414
downvote count: 0
has comment: http://stackoverflow.com/comment/39682376
score: 1
upvote count: 1
tagged with: swing
favorite count: 0
accepted answer: http://stackoverflow.com/a/25432426
type: Question
has title: Add an object to a JComboBox but show a string without overriding the object's .toString() method
has answer: http://stackoverflow.com/a/25432426

http://stackoverflow.com/comment/39613037
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25395933
has text: i see this point mentioned on the forum "Create or extract files from Split Zip files (Ex: z01, z02,...zip)" but it does not say if you can extract files based on the type of file or by specifying a substring in the file name inside the zip folder

http://stackoverflow.com/q/25480135
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39766951
has comment: http://stackoverflow.com/comment/39792105
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39766349
has answer: http://stackoverflow.com/a/25480349
has comment: http://stackoverflow.com/comment/39766473
has comment: http://stackoverflow.com/comment/39791798
tagged with: shuffle
has body: My program runs sometimes, but other times it runs infinitely because the random number generator keeps generating the same number again and again. public static String[] shuffleElements(final String[] elements) { String[] shuffledArray = new String[elements.length]; Set&lt;Integer&gt; generatedIndices = new HashSet&lt;Integer&gt;(); for(int i=0;i &lt; elements.length; i++) { int index = -1; do{ index = r.nextInt(elements.length); System.out.println(i + ", " + index); }while(index == i || generatedIndices.contains(index)); generatedIndices.add(index); assignments[i] = elements[index]; } return shuffledArray; } How do I fix this problem? Is there a better way of doing this?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39766555
has answer: http://stackoverflow.com/a/25480252
has title: Shuffling an array using random numbers

http://stackoverflow.com/q/25502705
type: Question
has comment: http://stackoverflow.com/comment/39809933
has body: I am having an outlook account which has nearly 2500 contacts. I am trying to fetch those contacts using EWS managed API for java. But it only returns me 1000 contacts. I did some research and found that it can be done by setting the offset value, I tried the same but haven't been successful. Any help would be really appreciated. Thanks :) Below is the piece of code I am using. ItemView view = new ItemView(numItems); FindItemsResults&lt;Item&gt; findResults = service.findItems(new FolderId(WellKnownFolderName.Contacts, new Mailbox("a@b.com")),view); ArrayList&lt;Item&gt; contact = findResults.getItems();
has comment: http://stackoverflow.com/comment/39809200
has comment: http://stackoverflow.com/comment/39809313
has answer: http://stackoverflow.com/a/25589652
has title: Retrieve more than 1000 contacts using EWS
tagged with: exchangewebservices
has comment: http://stackoverflow.com/comment/39808378
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25589652
score: 1
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39809051
downvote count: 0
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/25512243
has body: I'm trying to figure out how the Android OS assigns ports via the ServerSocket constructor. (Link: http://developer.android.com/reference/java/net/ServerSocket.html) Specifically, using the 2nd constructor, the documentation claims that "If port == 0, a port will be assigned by the OS." Does anyone know how this port is assigned by the Android OS? Based on running a significant amount of netstat -a commands on the Android terminal, it appears to be a random selection. Can anyone confirm this? I'd like to know what I can expect when a 0 is entered for this parameter. Thanks in advance!
type: Question
has title: Android ServerSocket Port Selection
score: 0
tagged with: sockets
tagged with: port
tagged with: android
tagged with: java
tagged with: serversocket
has answer: http://stackoverflow.com/a/25512634
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39826304

http://stackoverflow.com/comment/39806387
score: 0
comment on: http://stackoverflow.com/q/25501176
type: Comment
type: QuestionComment
has text: I think i got the answer: this is not possible like i thought. From the maual of elasticsearch: The script_score function allows you to wrap another query and customize the scoring of it optionally with a computation derived from other NUMERIC field values in the doc using a script expression.

http://stackoverflow.com/q/25520000
has comment: http://stackoverflow.com/comment/39843290
upvote count: 2
has comment: http://stackoverflow.com/comment/39844012
accepted answer: http://stackoverflow.com/a/25529336
tagged with: rx-java
has comment: http://stackoverflow.com/comment/39843420
has title: Chaining two Observables to return another
type: AnsweredQuestion
tagged with: reactive-programming
score: 2
has comment: http://stackoverflow.com/comment/39842760
answer count: 2
tagged with: retrofit
tagged with: java
has body: I have two observables named A&lt;'ModelA'> and B&lt;'ModelB'>. Each of them performs a request to a different REST service, so they extend a different model like expressed above. The request performed by any of them may fail. Now, I need to be able to chain both of them and return a ModelC object. So, the pseudo-coded stream would be something like this: A&lt;'ModelA'> performs the request, if it fails does something, if not then passes its result (responseModelA) to B&lt;'ModelB'> so it can perform another REST request which involves using part of responseModelA. If B fails something happens, if not then combines its response (responseModelB) together with responseModelA (manually, setting the POJO fields) to create ModelC which is what the subscriber should recieve as a parameter on it's call() method. Is this remotely possible to code using rxJava? I'm quite stucked into this so I'm open to any sugestions. Thanks.
has comment: http://stackoverflow.com/comment/39841281
downvote count: 0
has answer: http://stackoverflow.com/a/25529336
has comment: http://stackoverflow.com/comment/39843625
possible better answer: http://stackoverflow.com/a/25527206
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25527206

http://stackoverflow.com/a/25730045
answers question: http://stackoverflow.com/q/25523527
type: Answer
score: 0
has body: When a component is created it takes soem time until is ready, use the creationComplete event and add a handler to do your work,

http://stackoverflow.com/comment/39830655
type: Comment
has text: @user3907211 did you try to check these values?
type: AnswerComment
comment on: http://stackoverflow.com/a/25475833
score: 0

http://stackoverflow.com/comment/39733999
type: Comment
comment on: http://stackoverflow.com/a/25462686
score: 0
type: AnswerComment
has text: Well, I don't really have point 2 in mind (particularly because I'm not about to stop using Tomcat), 3 confirms my suspicions pointed out in second part of my question. But can you answer whether a bean's non-primitive information/fields will be managed correctly across pages if they are not serializable, i.e., will I have to write beans for them too?

http://stackoverflow.com/a/26912102
type: AcceptedAnswer
upvote count: 7
score: 7
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25411782
has body: The Xposed Module in itself is installed as an application, so you can add activities and retrieve the context like in any normal application. It depends on where you want to launch the Toast messages. As you seem to know, every application runs on its own process (and VM) and each process/app has its own copy of your Xposed module classes. If you built your Xposed module with activities, then you can retrieve the context (e.g. retrieving context) normally within your xposed app. BUT, since these activities are running within their own process (installed xposed module), this context will not be accessible in other apps running a copy of your Xposed module code. So, in applications you are actually hooking (the ones you handle in "handleLoadPackage"), you can always hook Activity or broadcast receivers methods to retrieve their context (check this).
has comment: http://stackoverflow.com/comment/42396366
answers question: http://stackoverflow.com/q/25411782

http://stackoverflow.com/comment/39625624
type: QuestionComment
comment on: http://stackoverflow.com/q/25404511
type: Comment
has text: Hm... then why don't you use just one connection?
score: 2

http://stackoverflow.com/a/49803083
downvote count: 0
upvote count: 1
has body: I like the answers above. I wrestled with the same problem on my Windows 10 machine using the -cp or -classpath switch with java. But in the end, since I wanted the com.mysql.jdbc.Driver available for all my runnable classes, I just created the CLASSPATH environmental variable in the machine's environmental variable list. You have to be sure and add the current directory path . to the list otherwise the JVM can't find the class [for the main function] when you issue the command "java MainClassName" at the command prompt. I am using eclipse and adding the external jar files to a project is easy and the projects run fine in the IDE without the CLASSPATH variable defined, but they still don't run in a command prompt window without the CLASSPATH variable defined. I also found that with the UcanAccess [a solution for ODBC in JE 8 and greater] driver I had to include all 5 jar files in the CLASSPATH variable. I haven't tried building an executable jar file yet to see if I need the CLASSPATH variable. That is my next item to check.
score: 1
answers question: http://stackoverflow.com/q/25471814
type: Answer

http://stackoverflow.com/comment/39669478
type: AnswerComment
comment on: http://stackoverflow.com/a/25427964
has text: I am getting error: `error: cannot find symbol symbol: class CSVAPI`
type: Comment
score: 0

http://stackoverflow.com/comment/39823474
score: 0
comment on: http://stackoverflow.com/q/25510530
has text: Does it work if you rather extend `AbstractRepositoryEventListener`?
type: Comment
type: QuestionComment

resultset
tags question: http://stackoverflow.com/q/25396727
tags question: http://stackoverflow.com/q/25533924
tags question: http://stackoverflow.com/q/25471265
tags question: http://stackoverflow.com/q/25405095
tags question: http://stackoverflow.com/q/25395999
tags question: http://stackoverflow.com/q/25402830
tags question: http://stackoverflow.com/q/25425801
tag name: resultset
type: Tag

http://stackoverflow.com/q/25536008
has title: JAXB Marshals root element without a close tag if it only has an attribute
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25652085
accepted answer: http://stackoverflow.com/a/25536925
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3023676
upvote count: 5
has answer: http://stackoverflow.com/a/25536925
has body: I am using JAXB / Moxy to marshal a class into XML. When the root element only contains an attribute the output is as follows: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;procedure xmlns="http://xml.test.com/api/request" name="TestProcedure"/&gt; The desired output contains the closing tag for procedure: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;procedure xmlns="http://xml.test.com/api/request" name="TestProcedure"&gt;&lt;/procedure&gt; This is getting sent to a third party system. Even though both are well formed XML, it still needs the closing tag. I saw this post: JAXB marshals XML differently to OutputStream vs. StringWriter but did not see a difference in output between the outputstream and strings when running locally. This seems to deal only with elements and attributes, but not the root element: Represent null value as empty element in xml jaxb I still setup a DescriptorCustomizer and looked through the ClassDescriptor in the debugger, but didn't see any properties to set like the XMLDirectMapping. My domain object looks like @XmlRootElement(name = "procedure") public class ProcRequest { protected String procName; protected String requestId; protected List&lt;Param&gt; parameter; @XmlAttribute public String getProcName() { return procName; } public void setProcName(String procName) { this.procName = procName; } @XmlAttribute public String getRequestId() { return requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } @XmlElement public List&lt;Param&gt; getParam() { if (this.param == null) { this.param = new ArrayList&lt;Param&gt;(); } return param; } public void setParam(List&lt;Param&gt; param) { this.param = param; } } And my service contains: ProcRequest procRequest = new ProcRequest(); procRequest.setProcName("TestProcedure"); JAXBContext jaxbContext = JAXBContext.newInstance(ProcRequest.class); Marshaller moxyMarshaller = jaxbContext.createMarshaller(); moxyMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUT…
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/25652085
answer count: 2
score: 5
tagged with: java
downvote count: 0
tagged with: jaxb
linked to: http://stackoverflow.com/q/17366054
tagged with: moxy

http://stackoverflow.com/q/25524850
has body: I have a class like this: public class revision{ long number; String comment; ... getters and setters } and I want the xstream result to give be like this: &lt;revision comment="value of comment"&gt; 121556 &lt;/revision&gt; However, since number is field it forces me to write it in a &lt;number&gt; tag. I used this to build the xml: XStream xstream = new XStream(new DomDriver("UTF-8")); xstream.useAttributeFor(Revision.class, "comment"); is there a possibility to not show the tag?
tagged with: xstream
accepted answer: http://stackoverflow.com/a/25525076
has answer: http://stackoverflow.com/a/25525076
score: 2
type: AnsweredQuestion
has title: How to omit a tag with Xstream?
favorite count: 0
upvote count: 2
tagged with: java
answer count: 1
downvote count: 0
type: Question

http://stackoverflow.com/comment/39837887
score: 0
type: QuestionComment
has text: I'm not using Mavericks, but [Java 8](http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html) **is** available for Mac.
type: Comment
comment on: http://stackoverflow.com/q/25518331

http://stackoverflow.com/comment/39759649
comment on: http://stackoverflow.com/a/25476587
has text: +1. Not only they haven't been rendered yet, but they probably haven't even been added to their container. So getting their bounds doesn't make sense at this point.
score: 3
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25504810
score: 4
answers question: http://stackoverflow.com/q/25502454
has body: I'd say that you should avoid having table names that are reserved words, with hibernate. Sure you can escape it, but it may cause problems in the future (in a query for example). So the safest way is to name the table another way - say users @Entity @Table(name="users") public class Signup { }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39838046
has comment: http://stackoverflow.com/comment/39837001
accepted answer of: http://stackoverflow.com/q/25502454
upvote count: 4
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39741128
has text: Well the sieve makes use of the integer factorization property: any integer can be seen as the multiplication of prime numbers (for a prime, exactly one). Thus there is no use in checking for `%6`, since the `%2` and `%3` will have failed first. The sieve test thus filters all integers that fail the already found prime numbers away.
comment on: http://stackoverflow.com/q/25466455
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39660226
type: AnswerComment
score: 0
has text: It's not a type error; but it is a violation of the LSP.
type: Comment
comment on: http://stackoverflow.com/a/25423318

http://stackoverflow.com/comment/39821245
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25509581
has text: try-catch blocks for critical sections
score: 3

http://stackoverflow.com/comment/39739232
type: Comment
type: AnswerComment
has text: Then you've picked a poor example that makes it Unclear What You're Asking, because Gmail is quite complex. Maybe you want to read [Sending HTTP POST Request In Java](http://stackoverflow.com/q/3324717/1157100).
comment on: http://stackoverflow.com/a/25465538
score: 1

http://stackoverflow.com/q/25422235
score: 5
tagged with: wicket
tagged with: checkbox
accepted answer: http://stackoverflow.com/a/25422582
has title: WICKET: Control visibility of components on change CheckBox
has answer: http://stackoverflow.com/a/25422582
tagged with: components
tagged with: form-submit
has comment: http://stackoverflow.com/comment/39668909
type: AnsweredQuestion
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39667567
has body: I'm using wicket framework. Does anybody know how to control visibility of components in the form by clicking on checkBox component, and how to get boolean value of checkbox state when submit the form(true or false, depending on checked or not). I wanna do something like this: TextField nameField = new TextField("name"); public StateDB() { final AjaxCheckBox searchByFio = new AjaxCheckBox("searchByFio", new PropertyModel(this, "checkBoxValue")) { @Override protected void onUpdate(AjaxRequestTarget target) { nameField.setVisible(checkBoxValue); target.add(nameField); } }; Form form = new Form("form"); nameField.setOutputMarkupPlaceholderTag ( true ); form.add(nameField); add(form); } But result is not what I've expected. It just changes the html element like this From: &lt;input type="text" wicket:id="lastName" id="lastName" required="" value="" name="lastName"&gt; To: &lt;input id="lastName" style="display:none"&gt; and vice versa
answer count: 1
has comment: http://stackoverflow.com/comment/39666591
favorite count: 0
type: Question
upvote count: 5

http://stackoverflow.com/a/25491782
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39788191
accepted answer of: http://stackoverflow.com/q/25491724
answers question: http://stackoverflow.com/q/25491724
type: Answer
has comment: http://stackoverflow.com/comment/39788540
score: 2
has body: My question is which one is better approach to initialize static field? Neither. Get rid of the static field. Your application needs to handle the case where the user changes their language while your process is still running. You need to retrieve this string resource at more appropriate points, so that when you undergo the configuration change, you start using the right string. As it stands, with your implementation (no matter how you populate the static field), you will never change the language of this string, and therefore the string will be wrong in some cases. And if the answer is "this string is never being translated", get rid of the string resource and put the string in the Java code as a final static field.

http://stackoverflow.com/q/25397763
tagged with: java
downvote count: 0
possible better answer: http://stackoverflow.com/a/25398085
has comment: http://stackoverflow.com/comment/39613368
favorite count: 0
has comment: http://stackoverflow.com/comment/39615259
type: Question
accepted answer: http://stackoverflow.com/a/25398165
linked to: http://stackoverflow.com/q/1621435
linked to: http://stackoverflow.com/q/25359084
has answer: http://stackoverflow.com/a/25398165
has title: What does it mean for an object to be transitively reachable from a final field?
has body: This post talks about immutable objects being transitively reachable from a final field: Immutability doesn't mean "does not change" in Java. It means "is transitively reachable from a final field, has not changed since the final field was set, and a reference to the object containing the final field did not escape the constructor". For the the following code, public class A() { private String myString; public A(String myString){ this.myString = myString; } public String getMyStringAndYours(){ return myString.concat("yours"); } } are A instances transitively reachable from a final field? I think so because: 1. myString.value is final 2. myString is reachable from myString.value 3. An instance of A, a, is reachable from a.myString Side question: Is a immutable?
has answer: http://stackoverflow.com/a/25398149
score: 4
has answer: http://stackoverflow.com/a/25398085
upvote count: 4
tagged with: immutability
type: AnsweredQuestion
answer count: 3

http://stackoverflow.com/a/25500550
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25499026
has body: You can use Recursion. To print a line, you need the following The character to draw the hourglass (char character) The odd number you read from the user ( int oddNumber) The index of the current line being drawn (int currentLine) For any odd number, say n, hourglass has n lines. Code: import java.util.Arrays; public static void main(String[] args) throws java.lang.Exception { int oddNumber = 5; char character = '#'; hourglass(oddNumber, character, 0); } public static void hourglass(int oddNumber, char character, int currentLine) { if (currentLine == oddNumber) { return; } int patternLength = 0; int mid = (oddNumber + 1) / 2; if (currentLine &lt; mid) { patternLength = oddNumber - (currentLine * 2); } else { patternLength = 2 * (currentLine - mid + 1) + 1; } char[] whitespace = new char[(oddNumber - patternLength)/2]; Arrays.fill(whitespace, ' '); char[] pattern = new char[patternLength]; Arrays.fill(pattern, character); System.out.println(new String(whitespace) + new String(pattern)); hourglass(oddNumber, character, currentLine + 1); }
upvote count: 1
answers question: http://stackoverflow.com/q/25499026
has comment: http://stackoverflow.com/comment/39822038
has comment: http://stackoverflow.com/comment/39822658
score: 1
has comment: http://stackoverflow.com/comment/39825358
type: Answer
has comment: http://stackoverflow.com/comment/39825456

http://stackoverflow.com/comment/39674873
type: Comment
type: QuestionComment
has text: You can pass null for the `convertView`, and the ListView itself for the `parent` ViewGroup.
score: 0
comment on: http://stackoverflow.com/q/25430242

http://stackoverflow.com/q/25414636
has title: Behaviour of AjaxEditableLabel and Validator confuses me
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25421028
favorite count: 0
type: Question
tagged with: wicket
has body: i searched a lot for this problem but no explanation explains what i am searching for i have a class like i posted at the end. In very short: The behaviour of PatternValidation is different to manual validation. For example: The AjaxEditableLabel has a Label and an Editor, which switches for editing (focussing) and for Cancel or Submit If i do an input which is unvalid for the Patternvalidator, the input is marked an you can correct it. If you then press Esc the editor is set invisible and the label is again empty. But if i edit the label again, the value is still in the editor, this is wrong. If i do an input which passes the Patternvalidator, but is unvalid inside of the onSubmit method, the input is marked also an you can correct it also. But if you than press Esc the typed value is written in the label and this should not be. And i really need the further validation inside the onSubmit. It seems like something between the Validation part an the onSubmit() Method pulls the value from the Editor to the Label. Do i have something completely wrong in my mind? Some example code: public class MyEditableLabel extends AjaxEditableLabel&lt;String&gt;{ public MyEditableLabel(String id, IModel&lt;String&gt; model) { super(id, model); PatternValidator patternValidator = new PatternValidator(Pattern.compile( "(^([0-9]|[0-1][0-9]|2[0-3]):([0-5][0-9])$)|((\\d{1,2})(,|\\.)(\\d\\d))")); this.add(patternValidator); } @Override protected void onSubmit(AjaxRequestTarget target) { // further validation if( editorValue.equals("00:00") ) { //just for example onError(target); } else { super.onSubmit(target); } } }
has answer: http://stackoverflow.com/a/25421028

http://stackoverflow.com/a/25457576
has body: You can't change primitives in Java like that because everything in Jave is passed by value - but you can store the value in an array and pass it: public void influence(float[] arr){ for (int i=0; i&lt;arr.length; i++){ arr[i] += 5; } }
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25457460
score: 1
type: Answer

http://stackoverflow.com/q/25471248
tagged with: android
has title: Deleting item from Android Database - Cursor Index Out Of Bounds Exception
has comment: http://stackoverflow.com/comment/39749997
accepted answer: http://stackoverflow.com/a/25484064
has comment: http://stackoverflow.com/comment/39749869
type: AnsweredQuestion
has body: In my android application I am attempting to delete an item from a database, having selected the corresponding item in a listview and selecting an item from the context menu created on long press. The listview is being populated from an arraylist, which is being created from the items in the database. However I am getting an error when attempting to delete anything but the first item in the listview (this is actually the most recently added item and last in the arraylist as the listview is displaying the items in the list in reverse order). If I try to delete an item other than the latest item then I get an error, android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0. After this error I also get the same error if I attempt to open the activity containing the listview, until I delete the app's' data and open it again. I have tried checking in the databasehandler deleteGoalFromDb method if the cursor is empty and if it is moving to the next row but have had no luck so far Method called when the delete item is pressed in the context menu (it is is the only item in the menu): @Override public boolean onContextItemSelected(MenuItem item) { //what to do when menu item clicked in context menu AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); //call delete goal and make it delete goal //System.out.println(info.position+"****************"); int position_actual = goalsList.size() - info.position; //needed as list is displayed in reverse order //System.out.println(position_actual+"----------------------"); deleteGoal(position_actual); return true; } My deleteGoal() method: public void deleteGoal(int id) { db.deleteGoalFromDb(id); //deletes the goal from the database makeGoalsFromDB(); //refreshes the goalsList } deleteGoalFromDb: public void deleteGoalFromDb(int id){ SQLiteDatabase db = this.getWritableDatabase(); db.delete(TABLE_GOALS, KEY_ID + " = ?", new String[] {id+""}); db.close(); } makeGoalsFromDB: public void ma…
answer count: 3
tagged with: android-listview
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39749909
has comment: http://stackoverflow.com/comment/39750071
has comment: http://stackoverflow.com/comment/39750778
tagged with: android-cursor
has answer: http://stackoverflow.com/a/25471386
tagged with: android-sqlite
type: Question
possible better answer: http://stackoverflow.com/a/25471384
has answer: http://stackoverflow.com/a/25484064
has comment: http://stackoverflow.com/comment/39749961
has answer: http://stackoverflow.com/a/25471384

http://stackoverflow.com/q/25465253
has answer: http://stackoverflow.com/a/25465308
score: 0
tagged with: constructor
answer count: 3
has body: Given a Class with multiple constructors class Food { int fibre_count; int flavour_amount; PreservationProcess preserve; public Food( int fibre_count, int flavour_amount){ this.fibre_count = fibre_count; this.flavor_amount = flavor_amount; preserve = new PreservationProcess("Freshly Picked"); /*do some other complicated thing that you do _not_ want done in the other constructor*/ } public Food (int fibre_count, int flavour_ammount, PreservationProcess preserve){ this.fibre_count = fibre_count; this.flavor_amount = flavor_amount; this.preserve = preserve; this.flavour_amount *= preserve.getFlavourModifier(); } } and a subclass class Broccoli extends Food { int vitamin_count; SomeOtherObj = SO_Obj; int branch_count; Broccoli(int fibre_count, int flavor_amount, int vitamin_count){ super(fibre_count, flavour_amount); /*common code between the two constructors \/ \/ \/ */ this.vitamin_count = vitamin_count; SO_Obj = new SomeOtherObject(); branch_count = 4; greenness = 13; /*common code between the two constructors /\ /\ /\ */ } Broccoli(int fibre_count, int flavor_amount, PreservationProcess preserve, int vitamin_count){ super(fibre_count, flavour_amount, preserve); /*common code between the two constructors \/ \/ \/ */ this.vitamin_count = vitamin_count; SO_Obj = new SomeOtherObject(); branch_count = 4; greenness = 13; /*common code between the two constructors /\ /\ /\ */ } } What is the accepted way to include the code shared between the two broccoli constructors? It seems that my options, are either mainatain two separeate copies of the same code in the separate functions, or, create an "init()" or "construct()" function that holds the shared code once, and is called from each constructor. Are there any other options I am missing? What is generally accepted as the cleanest way to deal with this situation (I'm looking for best practices, not opinions on what people think is best.) Thanks
has answer: http://stackoverflow.com/a/25465266
type: Question
has title: Extending a class with multiple constructors having differing behavior
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25465304

http://stackoverflow.com/q/25504551
downvote count: 0
tagged with: calendar
has comment: http://stackoverflow.com/comment/39811286
has title: How to calculate day counts of previous month?
has body: I would like to retrieve day counts of previous month. I can get day counts of current month by Calendar calendar = Calendar.getInstance(); calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1); int currentMonthDaysCount = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); System.out.println(currentMonthDaysCount); So , I tried to get day counts of previous month as Calendar calendar = Calendar.getInstance(); calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH - 1), 1); int previousMonthDaysCount = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); System.out.println(previousMonthDaysCount); I got 30 at my console. What I am wrong ? This month is August and previous month July should produce 31.
possible better answer: http://stackoverflow.com/a/79334802
accepted answer: http://stackoverflow.com/a/25504571
has answer: http://stackoverflow.com/a/79334802
has answer: http://stackoverflow.com/a/25504571
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39811651
favorite count: 0
type: Question
upvote count: 2
score: 2
answer count: 2

http://stackoverflow.com/q/25527175
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25527225
has title: collection equality using hamcrest
tagged with: java
linked to: http://stackoverflow.com/q/21624592
accepted answer: http://stackoverflow.com/a/25527225
type: AnsweredQuestion
answer count: 2
has body: I want to assert equality of two collection using hamcrest. I know there is contains matcher but I want it to ignore ordering. {1,2} is equals to {2,1} for my need. What is the right syntax?
downvote count: 0
tagged with: hamcrest
duplicate of: http://stackoverflow.com/q/21624592
score: 1
upvote count: 1
tagged with: junit
has answer: http://stackoverflow.com/a/25527397
possible better answer: http://stackoverflow.com/a/25527397
tagged with: unit-testing

http://stackoverflow.com/q/25406126
type: Question
score: 3
has comment: http://stackoverflow.com/comment/39628399
tagged with: java
has answer: http://stackoverflow.com/a/25406218
has comment: http://stackoverflow.com/comment/39628440
has body: I want to run a java j2me application in google chrome as an applet. I tried using microemulator, but failed. Please could you tell me how to do that ? My setup is the following : windows7, 32 bit, java jre version 8, java plugin 11.something, Google chrome version-36. Actually i want to run java .jar j2me application( opera-mod-4.2) in google chrome. i run java .jar application in my pc using microemulator. It run ok. It has a option make for web., When i clicked it an appled html file and two jar file is created in a folder, when i tri to run this html file in google chrome. It becomes a white blank screen. but not run the application.
has comment: http://stackoverflow.com/comment/39631801
has comment: http://stackoverflow.com/comment/39630841
upvote count: 3
type: UnansweredQuestion
downvote count: 0
answer count: 1
tagged with: applet
has title: how to run java jar applet in google chrome?
linked to: http://stackoverflow.com/q/2982935
favorite count: 0

http://stackoverflow.com/a/25493910
has body: Your problem is that your custom class loader is being used to load Main, but its loadClass simply delegates to the parent class loader to load Main. Therefore. within Main, if you called Main.class.getClassLoader(), it would return the sun.misc.Launcher$AppClassLoader, not MyLoader. To see what class loader will be used for Class.forName(String) calls and symbolic references from your own class, you should print getClass().getClassLoader() (or MyClass.class.getClassLoader() from a static method). The class loader that is used is the one that defined the class whose code is currently being executed. This is the rule everywhere except when using reflection (Class.forName(String, boolean, ClassLoader)). Once a class is loaded from the parent class loader, any classes that it loads will also use that primitive class loader. So once Main is loaded from the sun.misc.Launcher$AppClassLoader class loader, all the classes that it calls will come from that same class loader, not from your own MyLoader. Similarly, once the javax.crypto.Cypher class is loaded from the null (aka Bootstrap) class loader, any classes that it mentions will also come from the bootstrap class loader except the classes it loads using reflection (SPI). To stop loading classes from the sun.misc.Launcher$AppClassLoader class loader, set MyLoader's CLASSPATH to AppClassLoader's CLASSPATH and don't delegate classloading to AppClassLoader. Note that this will cause all the CLASSPATH classes to be loaded from MyLoader, but the classes from JDK will in general still be loaded from the null (Bootstrap) class loader. To stop loading JDK classes from the bootstrap class loader, you must explicitly put the JDK into the classpath and modify loadClass to not check the parent first for some classes. Loading JDK classes from your own class loader is delicate; some classes (e.g. java.lang.String) must be loaded from the boostrap class loader. This is not something I have tried myself, but I have read that OSGi loads …
upvote count: 12
answers question: http://stackoverflow.com/q/25478223
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39823812
has comment: http://stackoverflow.com/comment/39899498
has comment: http://stackoverflow.com/comment/39826945
accepted answer of: http://stackoverflow.com/q/25478223
has comment: http://stackoverflow.com/comment/39836423
has comment: http://stackoverflow.com/comment/39904156
type: Answer
has comment: http://stackoverflow.com/comment/39831753
has comment: http://stackoverflow.com/comment/39860454
has comment: http://stackoverflow.com/comment/39794413
has comment: http://stackoverflow.com/comment/39820615
score: 12

http://stackoverflow.com/comment/39632021
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25407756
type: Comment
has text: ok..thanks for first answer..i understood it.but i can't understand the second answer. setOnClickListener is the method of View class...Should it not be a method of listener interface?

http://stackoverflow.com/comment/39882791
has text: Actually, I have Cordova project exported from Eclipse & later imported in Android Studio, after that i have added two modules i.e. `Wear` & `Shared`. Now suppose i add my file to `assets` folder then how can i access the same in the `Wear` module. Solution that you mentioned is not working in this case(which i already tried). Any other idea/option to keep that single file at single place and available for both the modules?
comment on: http://stackoverflow.com/a/25539518
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25487328
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/39779330
has comment: http://stackoverflow.com/comment/39779321
has comment: http://stackoverflow.com/comment/39779946
type: Question
has comment: http://stackoverflow.com/comment/39795579
tagged with: displaylist
has comment: http://stackoverflow.com/comment/39779999
has comment: http://stackoverflow.com/comment/39780071
has body: To learn 3D Programming i'm creating a simple Minecraft Clone. I started with VBOs but cause all the data is static i w´switched to DisplayLists. I have a DisplayList for every side of a cube, only visible faces are rendered. The displayLists are created when the game is started for the whole map of 512 * 512 * 100. --> DisplayLists created: ~ 3 000 000 When i start the Program my Computer gets slower and then stops updating the screen. I can do nothing except for moving the mouse. I had another Program running with a countdown and even the countdown stopped. Most times i have to turn the power off. One time my Virus Scanner also reported me that javaw.exe took 4 GB of RAM (out of 8 GB). I make a display List for every side of a block so that i can stop rendering side and blocks that aren't seen. How can i fix that problem? Should i make my DisplayLists bigger so one for every chunk or one for every block?
type: UnansweredQuestion
has title: Compiling DisplayLists takes very much RAM and freezes Windows
score: 0
has comment: http://stackoverflow.com/comment/39780395
has comment: http://stackoverflow.com/comment/39779299
has comment: http://stackoverflow.com/comment/39779919
answer count: 0
tagged with: opengl

http://stackoverflow.com/comment/78137295
has text: This does work but the problem with this in a Gradle project is that any changes made to the module's setup will be lost the next time a Gradle sync happens (and thus the modules in the project are all refreshed). If there was a way to make this change by means of the module's `build.gradle` file that would be great!
type: AnswerComment
score: 2
type: Comment
comment on: http://stackoverflow.com/a/39289902

http://stackoverflow.com/comment/39829826
type: QuestionComment
has text: Resource patterns in the compiler dialog may be?
score: 3
comment on: http://stackoverflow.com/q/25513788
type: Comment

http://stackoverflow.com/q/25483534
has comment: http://stackoverflow.com/comment/39772084
answer count: 0
has comment: http://stackoverflow.com/comment/39772240
type: UnansweredQuestion
has title: JAX-WS Web Service is not updating when source code is modified and Web Service is regenerated
has body: I created two services public String add(int x, int y) and public String sub(int x, int y). Now, the definition of these services are as follows: package com.webservice.calc; import javax.jws.WebService;; @WebService public class Calculator { String s; public String add(int x, int y) { s = "Sum of "+x+" and "+y+" is : "+(x+y); return s; } public String sub(int x, int y) { s = "Sum of "+x+" and "+y+" is : "+(x-y); return s; } } Instead of writing Difference, I wrote Sum in the sub service as well. Then I used, wsgen tool to generate the wsdl file and using Endpoint publisher, I published it. Then, I created another project (Web Service Consumer) and using wsimport, imported the web service. The code went fine. But, now I wanted to change the Sum to Difference. I changed the code in the original code, then used wsgen, then republished (here there was an error: Exception in thread "main" Server Runtime Error: Server Runtime Error: java.net.BindException: Address already in use: bind at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(Unknown Source) at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(Unknown Source) at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(Unknown Source) at javax.xml.ws.Endpoint.publish(Unknown Source) at com.webservice.calc.endpoint.CalcEndpointPublisher.main(CalcEndpointPublisher.java:12) Caused by: Server Runtime Error: java.net.BindException: Address already in use: bind at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(Unknown Source) ... 5 more Caused by: java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind(Native Method) at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) at sun.net.httpserver.ServerImpl.&lt;init&gt;(Unknown Source) at sun.net.httpserver.HttpServerImpl.&lt;init&gt;(Unknown Source) at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(Unknown Source…
has comment: http://stackoverflow.com/comment/39772150
tagged with: web-services
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39772113
type: Question

http://stackoverflow.com/comment/39854893
has text: yes, I'm trying to work with this API in Android app
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25528007

http://stackoverflow.com/comment/39816759
score: 0
has text: I had forgotten to write the method openTDB, sorry
comment on: http://stackoverflow.com/q/25504028
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39803448
has text: Yes, I mean default visibility with "package private". A module is usually a library, so it's more like a JAR. You make everything that is accessible to the library's consumer `public`.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25495596

http://stackoverflow.com/comment/39884711
type: AnswerComment
has text: If you don’t like `CallerRunsPolicy` you may look at `WaitingRejectionHandler` [from this answer](http://stackoverflow.com/a/20398130/2711488). What both have in common is that all runnables *will* run, it’s only slowing the submitting thread down in creating new runnables. Which is *exactly* what you want.
comment on: http://stackoverflow.com/a/25524645
score: 0
type: Comment

http://stackoverflow.com/comment/39665875
score: 0
type: QuestionComment
type: Comment
has text: you want your main thread to wait for another thread to finish?
comment on: http://stackoverflow.com/q/25426441

http://stackoverflow.com/comment/39761914
has text: @PeerNet You will get that time back if you design it effectively now, rather than dealing with problems in the future.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25477794

http://stackoverflow.com/comment/39720846
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25440453
has text: Can you add an example of the usage you're thinking of? With what would you call Functor.map, what would you expect returned?
type: Comment

jtextarea
tags question: http://stackoverflow.com/q/25440427
type: Tag
tags question: http://stackoverflow.com/q/25477999
tag name: jtextarea
tags question: http://stackoverflow.com/q/25458911
tags question: http://stackoverflow.com/q/25482245
tags question: http://stackoverflow.com/q/25535277
tags question: http://stackoverflow.com/q/25416045
tags question: http://stackoverflow.com/q/25391798

http://stackoverflow.com/a/25522781
has comment: http://stackoverflow.com/comment/39846060
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25522520
has body: A Map is a key-value pair, i.e., a value is associated to a key. Your code can be refactored as follows: Map&lt;String, Object&gt; details = taskManager.getFormDetails(appSessionURI, accessToken); //System.out.println("Details :" + details); String fileName = (String)details.get("fileName"); String refGene = (String)details.get("refgene");
answers question: http://stackoverflow.com/q/25522520
type: AcceptedAnswer
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39845944

http://stackoverflow.com/comment/39693873
type: AnswerComment
comment on: http://stackoverflow.com/a/25434440
has text: @IvySaju I've edited it as you suggested. Sorry for the mixing the key-value part. As for else i thought that in the if statement the values of the map are updated, but they are clearly not. That's why the else is neaded to substitute the old values with new ones. Else could stay if in the if there was something like this: `uniqueUriMap.get(uri_path).put("count", String.valueOf(count + countFromMap);`
score: 0
type: Comment

http://stackoverflow.com/comment/39888657
type: AnswerComment
has text: The Jtree is still working fine thanks I've just checked it - Just trying to get what you /Yale said now :) Everytime I use : properties.getProperty("Your Key"); my app throws a hissy fit and I always get a null pointer exception,any idea why?
type: Comment
comment on: http://stackoverflow.com/a/25545144
score: 0

http://stackoverflow.com/comment/39793840
type: Comment
has text: You can hand the `Validate` in to your `Gui` constructor, but `super()` is the constructor for `JFrame`, so it won't know or care about `Validate`.
type: QuestionComment
comment on: http://stackoverflow.com/q/25494732
score: 1

http://stackoverflow.com/comment/39680551
has text: Are you sure that you have added all the dependent JARs in a space separated way? Did you check the manifest file inside the JAR file after building it? If you have the correct manifest file in the JAR and all the dependent JARs are copied into the same directory where your JAR is placed, things should work as expected.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25433251
type: AnswerComment

http://stackoverflow.com/a/25410943
upvote count: 2
answers question: http://stackoverflow.com/q/25410758
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39639856
has comment: http://stackoverflow.com/comment/39638441
score: 2
has body: PreferenceActivity will help you to implement all these very easily. Go through this and this tutorials. PreferenceFragment should be used post Honeycomb.
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25410758

http://stackoverflow.com/comment/39709938
has text: This is a method. But I don't know whether configuring the condition breakpoint is as convenient as abort() function in C++. I have edited my question. Thanks for your answer!
score: 0
comment on: http://stackoverflow.com/a/25423306
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39823488
comment on: http://stackoverflow.com/q/25487146
score: 0
has text: You should accept an answer. People want their points
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39622488
type: Comment
comment on: http://stackoverflow.com/a/25400931
type: AnswerComment
score: 0
has text: You can also use `$^` in make rules to mean "all the prerequisites". And if you only need that `CLASSPATH` for this makefile then you can set (and export) it in the makefile and not in your general shell.

http://stackoverflow.com/comment/39793804
type: QuestionComment
comment on: http://stackoverflow.com/q/25494624
has text: @CarCzar I now how to find a class by annotation. But the problem is if I have somewhere in heap (thnx to Boris) an object of class than I need to get somehow the access to it.
score: 0
type: Comment

http://stackoverflow.com/comment/39850359
comment on: http://stackoverflow.com/q/25525072
score: 0
has text: Related: http://stackoverflow.com/questions/20856/how-do-you-recommend-implementing-tags-or-tagging/20871
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25546426
downvote count: 0
answers question: http://stackoverflow.com/q/25546306
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39887970
has comment: http://stackoverflow.com/comment/39887988
upvote count: 1
has body: Check the relevant javadoc. First parameter of the Color.web() method is the RGB (Red, Green, Blue) value of the color. "0x0001FF" This has 0x00 red component, 0x01 green component (almost zero) and full 0xff blue component. The second parameter of the Color.web() is the opacity in the range from 0.0 (transparent) to 1.0 (opaque, this is your case). Therefore your result color is blue.

http://stackoverflow.com/comment/39670926
type: AnswerComment
comment on: http://stackoverflow.com/a/25402498
has text: If you say i can explain with more. Good Luck.
score: 0
type: Comment

http://stackoverflow.com/comment/39899598
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25458695
score: 0
has text: ow :)) Now the only error is this part public void windowClosing(WindowEvent e){ ** this.m.enableMyButton(); ** and this part. PersonalInfo objPI = new PersonalInfo(this);

http://stackoverflow.com/comment/39721433
type: QuestionComment
comment on: http://stackoverflow.com/q/25455837
score: 0
type: Comment
has text: I don't understand where these are coming from? Explanation?

join
type: Tag
tag name: join
tags question: http://stackoverflow.com/q/25417588
tags question: http://stackoverflow.com/q/25476503
tags question: http://stackoverflow.com/q/25408206
tags question: http://stackoverflow.com/q/25399345

http://stackoverflow.com/comment/40030567
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25442323
has text: Possible duplicate of http://stackoverflow.com/questions/12825847/why-are-local-variables-thread-safe-in-java

http://stackoverflow.com/comment/39793237
type: QuestionComment
comment on: http://stackoverflow.com/q/25493948
score: 0
has text: Shouldn't the `add(entries[j])` calls in your `for (int j = 0; j <...` loop have String constants added with the components? This add method is not appropriate for a CardLayout.
type: Comment

http://stackoverflow.com/q/25503018
has comment: http://stackoverflow.com/comment/39809842
has comment: http://stackoverflow.com/comment/39808967
upvote count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/25503729
has title: How to Show time difference or reverse time in android
has answer: http://stackoverflow.com/a/25503729
has comment: http://stackoverflow.com/comment/39809046
type: AnsweredQuestion
has body: class revrsetime { public static void main(String[] args) { System.out.println(setLastSeenTime("26/08/2014 14:29:00")); } public static String setLastSeenTime(String time) { long milliseconds = Math.abs(System.currentTimeMillis() - converTimeStringINToMillis(time)); String lastSeen = ""; long seconds = (long) milliseconds / 1000; if (seconds &lt; 60) lastSeen = String.valueOf(seconds) + "sec ago"; else if (seconds &gt; 60 &amp;&amp; seconds &lt; 3600) lastSeen = String.valueOf((int) seconds / 60) + " min ago"; else if (seconds &gt; 3600 &amp;&amp; seconds &lt; 86400) lastSeen = String.valueOf((int) seconds / 3600) + " hours ago"; else if (seconds &gt; 86400 &amp;&amp; seconds &lt; 172800) lastSeen = " Yesterday"; else if (seconds &gt; 172800 &amp;&amp; seconds &lt; 2592000) lastSeen = String.valueOf((int) (seconds / (24 * 3600))) + " days ago"; else if (seconds &gt; 2592000) lastSeen = String.valueOf((int) (seconds / (30 * 24 * 3600))) + " months ago"; return lastSeen; } private static long converTimeStringINToMillis(String time) { long milliseconds = 0; try { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); // 25/06/2014 8:41:26 Date date; date = sdf.parse(time); milliseconds = date.getTime(); } catch (ParseException e) { // TODO Auto-generated catch block milliseconds = 0; e.printStackTrace(); } return milliseconds; } } This my code for display Lastseendate and time what I am doing this I have getting time from web service and system time make it differences. In some cases I am getting the correct Output but in others I am not. The output when I set date and time : 26/08/2014 13:29:00 then it shows 3 hours ago when it should show 2 hours ago. When I set 26/08/2014 14:29:00 then it shows 4 hours ago. I don't know where I'm making the mistake, please help.
has comment: http://stackoverflow.com/comment/39809475
has comment: http://stackoverflow.com/comment/39808914
score: 1
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39809211
has comment: http://stackoverflow.com/comment/39809041
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/76403045
comment on: http://stackoverflow.com/a/25397240
has text: @Qoros C would require OS specific APIs to deal with memory mapped files, such as mmap or VirtualAlloc. Otherwise the code would look fairly similar. Open the file, map it into the process, then read and write to the returned pointer.
type: AnswerComment
score: 1
type: Comment

wiki
tags question: http://stackoverflow.com/q/25521877
tag name: wiki
type: Tag

http://stackoverflow.com/comment/39852571
type: AnswerComment
has text: Because my company has many different kind of versions for each jar. Each jar also has many connections to many other jars. For logging reasons, my company wants to know which exact classes are loaded from where for overview.
comment on: http://stackoverflow.com/a/25524097
type: Comment
score: 0

http://stackoverflow.com/a/25414297
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39656050
type: Answer
has comment: http://stackoverflow.com/comment/39645098
has comment: http://stackoverflow.com/comment/39644544
accepted answer of: http://stackoverflow.com/q/25401185
has comment: http://stackoverflow.com/comment/39661467
has body: Use the JavaFX Image constructor to create and resize your images, rather than using BufferedImage and ImageIO. Memory consumption should improve as: There are less format conversions happening, so intermediate formats don't need to be stored. When the JavaFX Image constructor is utilized, the JavaFX javadoc specifies: Images can be resized as they are loaded (for example to reduce the amount of memory consumed by the image) Answers to additional questions how I can save it on disk? Saving images to disk using JavaFX is currently (as of the initial Java 8 release), an open, unresolved feature request: RT-18886 Implement Image writers for JavaFX. Until RT-18886 is implemented, you will need to convert the image to a BufferedImage before you save it, in order to use ImageIO for saving images to formats like jpg. You can use SwingFXUtils to do this. It is still efficient to resize the image up front when you first load it into memory, which is how the JavaFX Image constructor works. I must also create a new Buffered Image and then draw it inside with Graphics2D. You can load your image as a JavaFX image then paint it on a JavaFX Canvas, using JavaFX GraphicsContext, then snapshot the canvas to get a new Image that you can convert to an BufferedImage and save using ImageIO. OK, so perhaps not the most efficient process, but it does allow you to stick with (mainly) a single framework and API and avoid some potential threading issues. I using SwingFXUtils.fromFXImage(im, null) but I have a strange filter on the pictures then I don't know exactly what "strange filter" means, but perhaps you are seeing RT-14647 Incorrect display of JPEG images, which was fixed in a past JavaFX update. Try running against the latest Java 8 development release and see if you still get the same issue. If not, you can create a new question with an mcve. Alternatives There is almost certainly an equivalent way of saving resized images efficiently using only BufferedImage, ImageIO and the awt/swi…
answers question: http://stackoverflow.com/q/25401185
score: 0

http://stackoverflow.com/comment/39726445
comment on: http://stackoverflow.com/a/25458370
type: AnswerComment
score: 0
has text: Thanks but not what I asked in the comment. The answer should be yes or no.
type: Comment

http://stackoverflow.com/q/25454734
linked to: http://stackoverflow.com/q/21298457
answer count: 2
downvote count: 0
tagged with: bigdecimal
accepted answer: http://stackoverflow.com/a/25455000
possible better answer: http://stackoverflow.com/a/25455080
upvote count: 23
favorite count: 0
has answer: http://stackoverflow.com/a/25455000
has answer: http://stackoverflow.com/a/25455080
type: AnsweredQuestion
has body: With the following code: BigDecimal x = new BigDecimal("34.5678"); BigDecimal a = x.movePointRight(3); BigDecimal b = x.scaleByPowerOfTen(3); BigDecimal c = x.movePointRight(-3); BigDecimal d = x.scaleByPowerOfTen(-3); a and b are both 34567.8 and c and d are both 0.0345678. a.scale() and b.scale are both 1 and c.scale() and d.scale() are both 7. In what circumstances do these two methods produce different results?
tagged with: math
tagged with: java
score: 23
has title: What is the difference between BigDecimal movePointRight and scaleByPowerOfTen?
type: Question

http://stackoverflow.com/comment/39744704
score: 0
type: Comment
type: AnswerComment
has text: Allow remote hosts to connect to your database. On your mysql server type these commands GRANT ALL PRIVILEGES ON recursos_humanos.* to ‘root’@'%' IDENTIFIED BY '1234'; Then flush privileged FLUSH PRIVILEGES;
comment on: http://stackoverflow.com/a/25462503

http://stackoverflow.com/comment/39748200
type: Comment
type: QuestionComment
score: 2
has text: You have an empty try block and asking yourself why this error appears?
comment on: http://stackoverflow.com/q/25470280

http://stackoverflow.com/a/25543078
score: 0
has body: Make a look at java.nio.channels.FileChannel
type: Answer
answers question: http://stackoverflow.com/q/25542698

http://stackoverflow.com/comment/39743376
score: 0
comment on: http://stackoverflow.com/q/25467498
has text: @EdenMyagi If you're still online later today I might be able to chat with you.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39623028
comment on: http://stackoverflow.com/q/25402594
score: 0
type: Comment
has text: I don't see how Jackson can deseiralize the data array into an object. Where the @type property comes from?
type: QuestionComment

http://stackoverflow.com/comment/43054716
type: Comment
type: QuestionComment
score: 0
has text: I don´t want to serialize an EJB. I want to be sure that session clusters work. In order to get that I need everything in session to be serializable. For some reason Glassfish puts this injected EJBs in session, so I becomes non serializable. The point is that with many developers, if I don´t make something automatic, some one will break session serialization capability
comment on: http://stackoverflow.com/q/25401435

http://stackoverflow.com/comment/39839516
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25517935
has text: Thanks a lot! Will try this as soon as I have the chance!
type: AnswerComment

http://stackoverflow.com/a/25508954
has body: I have an issue with this line: &lt;input name=${i}Last_Name value="&lt;%=Last_Name%&gt; type="text" /&gt; Shouldn't you quote your attribute values, like so? &lt;input name="${i}Last_Name" value="&lt;%=Last_Name%&gt;" type="text" /&gt; Also, where is Last_Name declared and in which scope is it retrieved from?
score: 0
answers question: http://stackoverflow.com/q/25508660
has comment: http://stackoverflow.com/comment/39821285
type: Answer

http://stackoverflow.com/q/25525140
linked to: http://stackoverflow.com/q/15518731
score: 2
has answer: http://stackoverflow.com/a/25525377
tagged with: java
tagged with: uppercase
duplicate of: http://stackoverflow.com/q/15518731
has comment: http://stackoverflow.com/comment/39850235
has body: I was looking into de-compiled sources of Java SE7 String class, in particular at the equalsIgnoreCase method, and what struck me as odd was the following line (performed in a while loop, local vars omitted): if (((c1 = this.value[(o1++)]) != (c2 = target[(o2++)])) &amp;&amp; (toUpperCase(c1) != toUpperCase(c2)) &amp;&amp; (toLowerCase(c1) != toLowerCase(c2))) { return false; } And I wondered why the c1 and c2 are checked for non-equality in both, upper- and lower-case forms. Surely if the uppercase comparison was equal, the lowercase would never even be reached... from this, however, i am led to believe that there are cases when uppercase(c1)!=uppercase(c2) AND the characters are still equal when compared in lower-case. Suggestions anyone?
tagged with: string
has title: Why does String.equalsIgnoreCase compare both upper-, AND lower-case versions of individual characters?
favorite count: 0
has comment: http://stackoverflow.com/comment/39849404
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25525352
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39850151
downvote count: 0
tagged with: lowercase
tagged with: comparison

http://stackoverflow.com/q/25447483
tagged with: java
has title: How to avoid ajc changing anonymous class static modifier on weaving?
answer count: 1
has body: I'm trying to integrate AspectJ to existing project. After weaving anonymous static classes becomes non-static. For example this code: public class StaticCheck { public static void main(String[] args) { new Runnable() { @Override public void run() { System.out.println(Modifier.isStatic(getClass().getModifiers())); } }.run(); } } outputs "true" without weaving and "false" with it. The problem is that object created this way is passed to 3rd party code and this check is performed there. Moving anonymous class to static inner class solves the problem but it's not desirable because such construction is heavily used in a project. I'm using aspectj version 1.8.2 via aspectj-maven plugin with java 1.7. 3rd party framework is typesafe akka, and this is Props.create(Creator) actor creating construction. So is there any way to avoid such aspectj behavior?
type: Question
accepted answer: http://stackoverflow.com/a/25457491
type: AnsweredQuestion
score: 0
tagged with: aspectj
has answer: http://stackoverflow.com/a/25457491
tagged with: akka

http://stackoverflow.com/a/25495964
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/25495622
downvote count: 0
has body: Maybe I am underestimating/simplyfing the question but a possible solution: List&lt;Domain&gt; dmn = new ArrayList&lt;Domain&gt;(); Iterator&lt;Domain&gt; it = dmn.iterator(); while(it.hasNext()){ Domain dom = it.next(); if(dom.getName().equalsIgnoreCase("Hilton") &amp;&amp; it.hasNext()) { // prevents problems if "Hilton" is the last element { Domain domAfter = it.next(); System.out.println(domAfter); //do something with the next after Hilton first System.out.println(dom); //do something with Hilton then } else System.out.println(dom); //else do something with the current element } What I am missing from the question is what do you have to do with the elements of the ArrayList. This is a not much elegant way you where you don't need to use another list.
has comment: http://stackoverflow.com/comment/39801881
type: Answer
has comment: http://stackoverflow.com/comment/39797161
has comment: http://stackoverflow.com/comment/39796548

http://stackoverflow.com/comment/39908659
has text: I tried to give idaff a value and then print it using out.print(idaff) in the second servlet but couldn't .. Anyway i think i'll just Select max(id) since it's AutoIncrement and then insert it as FKey in the COTISATION table. Thank you.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25532723

http://stackoverflow.com/comment/39611071
has text: Events on the creation of ServletConfig object,its destruction. @SotiriosDelimanolis
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25396657
type: QuestionComment

http://stackoverflow.com/comment/39809200
has text: So, with the Offset it will return again 1000 starting at Offset, but not more than 1000, right? Can you copy Items from one ItemView to another? - I don't know EWS, sorry.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25502705
type: Comment

http://stackoverflow.com/comment/39809830
type: QuestionComment
has text: I fixed it for you. You should be consistent with the way you use your curly braces. And that "write a line, indent the open curly brace, indent the body, unindent the curly brace, unindent the next line" looks really strange.
comment on: http://stackoverflow.com/q/25503547
score: 1
type: Comment

http://stackoverflow.com/comment/39829020
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25513603
has text: @Sree I didn't quite get that. Gimme a specific scenario. What type of images are you planning to show if the user is offline?

http://stackoverflow.com/a/25509264
has comment: http://stackoverflow.com/comment/39820739
score: 2
has comment: http://stackoverflow.com/comment/39820987
accepted answer of: http://stackoverflow.com/q/25508878
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25508878
has comment: http://stackoverflow.com/comment/39821167
has body: Try this: if (sCurrentLine.matches("(?=.{20})[^$]*[^\\d$]\\d.*\\d{2}/\\d{2}/\\d{4} \\d{2}:\\d{2}")) The length is checked using a look ahead that asserts there are 20 chars (which of course means there are at least 20 chars). Your required-digit logic may be expressed as "starts with any number of non-dollar chars, a non-dollar/digit char then a digit", which is the first part of the regex. The last part is the date format. Note that this checks only that there are digits in the right place, not that it's a legitimate date.
type: Answer
has comment: http://stackoverflow.com/comment/39820849

http://stackoverflow.com/a/25536452
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has body: I would expose a collection of OrderItems. There is a good SO question "What is the best practice for read-only lists in NHibernate" where you can find a lot of information of How to expose collections right. I do not see any concerns to hide collection of OrderItems as an internal state. If you expose updateQuantity method then there should be a possibility to check if quantity is updated on the specific item or not. 1) Add a method that returns the copied collection. I don't like it, because we need to make copies of each item as well (since it is Entity and can be changed) which is another challenge on its own. Actually, entities can be changed and they are not immutable. Value objects should be immutable. In your example Order looks like root entity or Aggregate Root and OrderItem looks like Entity. It has an identity within an Order at least so it is definitely not a Value Object. 3) Use the Hibernate way: get the items through java's reflection in the repository. That's "cheating". Also I am thinking about the way of creating DTO's as well, so I need a legit way to read the values. Some people use two models: "clean" Domain Model and "dirty database depended" Persistence Model. Well, I am not a big fan of this approach. Usually I try to make my ORM to generate decent database structure based on the Domain Model. 2) Add getters for every property of items: It is better since no one from outside cannot change the root's nested entities. But it can blow the root's class with tons of dummy getters. In order to prevent them from the outside changes there is a good practice not to expose public setters and to keep them private or protected at least.
answers question: http://stackoverflow.com/q/25534389
has comment: http://stackoverflow.com/comment/39879335
accepted answer of: http://stackoverflow.com/q/25534389
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39881285

http://stackoverflow.com/a/25405343
accepted answer of: http://stackoverflow.com/q/25402726
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
has body: Finally I've solved the problem by adding apache http client library instead of HttpUrlConnection. /* * ==================================================================== * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * &lt;http://www.apache.org/&gt;. * */ import java.io.BufferedReader; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; /** * Example how to use multipart/form encoded POST request. */ public class ClientMultipartFormPost { public static void main(St…
answers question: http://stackoverflow.com/q/25402726
type: Answer

http://stackoverflow.com/comment/39732190
score: 0
comment on: http://stackoverflow.com/a/25461555
type: Comment
type: AnswerComment
has text: Also, in this [answer](http://stackoverflow.com/a/3295540) describing what a bean does, it clearly states that a bean's fields must be primitive types or serializable, which is certainly not the case with `myObject` class in general. So I would end up making beans for all subclasses which are not primitive types, correct? That would be a very time-consuming approach, even if I managed to do it.

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/25392752
type: Tag
tags question: http://stackoverflow.com/q/25522797
tags question: http://stackoverflow.com/q/25536354
tags question: http://stackoverflow.com/q/25547163
tags question: http://stackoverflow.com/q/25439022
tags question: http://stackoverflow.com/q/25431721
tags question: http://stackoverflow.com/q/25489639
tags question: http://stackoverflow.com/q/25394365
tags question: http://stackoverflow.com/q/25478780
tags question: http://stackoverflow.com/q/25509588

http://stackoverflow.com/q/25529990
type: Question
has answer: http://stackoverflow.com/a/25530269
type: UnansweredQuestion
has body: I have this code from the book Thinking in Java,where Bruce indicates the warning on calling the method set(). The code is as follows: package testPackage; class GenericBase&lt;T&gt; { private T element; public void set(T arg) { arg = element; } public T get() { return element; } } class Derived1&lt;T&gt; extends GenericBase&lt;T&gt; {} class Derived2 extends GenericBase {} // No warning // class Derived3 extends GenericBase&lt;?&gt; {} // Strange error: // unexpected type found : ? // required: class or interface without bounds public class ErasureAndInheritance { @SuppressWarnings("unchecked") public static void main(String[] args) { Derived2 d2 = new Derived2(); Object obj = d2.get(); d2.set(obj); // Warning here! } } If I remove the annotation, I get the following warning: Type safety: The method set(Object) belongs to the raw type GenericBase. References to generic type GenericBase should be parameterized My question is, Why is the warning displayed on the set() method? And can somebody please explain what this warning means? Btw, I am completely new to Java Generics and although I read other questions on Generics, I am still somewhat confused on Erasure.
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39858665
favorite count: 0
score: 3
has comment: http://stackoverflow.com/comment/39858538
upvote count: 3
tagged with: java
tagged with: generics
has title: Generic Type Erasure Warning

http://stackoverflow.com/q/25510157
tagged with: abstract-class
has comment: http://stackoverflow.com/comment/39822596
tagged with: java
tagged with: generics
type: Question
score: 0
has body: I have public abstract class A { public abstract A get(); } and public abstract class B { public abstract void save(A a); } And bunch of different classes that extend these two classes. And they are usually paired together. So if I have classes C, D Then C would extend A and D would extend B and D's save function would expect C in order for it to work. And I have controller E public class E { List&lt;B&gt; list; public void save(A a) { // how do I choose correct pair from list? } } In that controller I have a list of classes that extend B. There is a save function in E that receives extended class A as an argument. How do I loop through all the elements in the list and figure out which class belongs to which in the pair? Thanks to anyone for their help, I am trying to learn complex abstract classes and how to relate them. EDIT: If I use instance of then I will have a huge if statements inside 100 classes Let's say I have 100 classes that extend class A and 100 that extend class B. They are paired together as I explained above. So as a further clarification. public class D extends B { public void save(A a) { C c = (C)a.get(); // proceed saving using c } } How do I avoid doing a check for instance of inside all these classes, and know how to pair them? Is there no better way? EDIT2: Pshemo answer is great, however I have one last question to solve. In class E I have save function that receives class A How do I know which class that A is linked to? If class A is instance of C how would I know to search for instance of D in the list and call that classes' save function?
has comment: http://stackoverflow.com/comment/39822531
answer count: 1
accepted answer: http://stackoverflow.com/a/25510392
has comment: http://stackoverflow.com/comment/39822571
has comment: http://stackoverflow.com/comment/39822569
has answer: http://stackoverflow.com/a/25510392
has title: Instance of one class within another class
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39822518

http://stackoverflow.com/comment/39843420
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25520000
has text: @coffeeaddict I'll check that pattern. I agree the property thing might work, but like you said it will tightly couple everything up and that goes a little against what rx is about ;-)

http://stackoverflow.com/comment/39887926
type: QuestionComment
has text: @talex I thought that, you said me to do this by normal way.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25546155

http://stackoverflow.com/comment/39901705
has text: The result of the query has only a single column name per column (the column names of the second subquery have no effect).
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25551815

http://stackoverflow.com/a/25433633
has body: I knew that in Java class instances are passed by references Firstly, you don't pass instances, but reference to them. And the references are passed by value. In your method, you passed references to two instances, which created a copy of both of them. Then you swapped those copy of references. Since those are passed by value, it wouldn't affect the original references, and hence the behaviour. Just FYI, everything in Java is passed by value.
score: 6
upvote count: 6
type: Answer
answers question: http://stackoverflow.com/q/25433586
downvote count: 0

http://stackoverflow.com/comment/39771476
type: QuestionComment
comment on: http://stackoverflow.com/q/25476563
has text: i just made a video: http://youtu.be/HGRlQhULu2U
score: 0
type: Comment

war
tags question: http://stackoverflow.com/q/25460204
type: Tag
tags question: http://stackoverflow.com/q/25500982
tags question: http://stackoverflow.com/q/25499766
tags question: http://stackoverflow.com/q/25482562
tag name: war
tags question: http://stackoverflow.com/q/25454041
tags question: http://stackoverflow.com/q/25505070
tags question: http://stackoverflow.com/q/25525362
tags question: http://stackoverflow.com/q/25528603
tags question: http://stackoverflow.com/q/25484261

http://stackoverflow.com/comment/39628049
score: 0
comment on: http://stackoverflow.com/q/25405780
type: Comment
type: QuestionComment
has text: I don't think so because the JFrame appears during a certain time (until I call the method setVisible(false) after in my program...). But empty

http://stackoverflow.com/comment/39690477
type: Comment
score: 0
type: AnswerComment
has text: if you enter in a number the first time and then enter Y and then the second time enter in a character 'h' for example it will not let you enter in Y or N if you want to continue
comment on: http://stackoverflow.com/a/25438809

http://stackoverflow.com/comment/39844537
has text: @matthelliwell previously I didn't use Maven... Does the project structure of the Eclipse projects remain the same? what is necessary for working the way you do?
comment on: http://stackoverflow.com/q/25511552
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25540288
type: Question
upvote count: 4
score: 4
answer count: 2
has body: Given a java.util.Date(), how do you create a Calendar object using the Spring Expression Language? This one works: &lt;property name="calendarObject" value="#{new java.util.GregorianCalendar()}"/&gt; but I need to feed the day, month, and year to its constructor from the java.util.Date() date that I have. I would like to use the java.util.Date().getDay() method but apparently it's already deprecated. I tried using the Calendar.setTime() method but it doesn't work since its return type is void.
downvote count: 0
tagged with: calendar
has title: Create Calendar object using SpEL
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25549006
tagged with: spring-el
possible better answer: http://stackoverflow.com/a/26483830
has answer: http://stackoverflow.com/a/25549006
tagged with: java
has answer: http://stackoverflow.com/a/26483830
favorite count: 0

http://stackoverflow.com/comment/39897861
has text: Not clear exactly what your question is. The document in memory is (as you reproduce it) not well-formed (that end-tag for 'Protocols' seems not to match any start-tag).
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25549248

http://stackoverflow.com/q/25402594
has comment: http://stackoverflow.com/comment/39624839
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: In my program I'm using Netty and a Multicast socket to receive some Multicast packets. I'm wrapping and splitting the actual large data up so the process looks something like this. (Abbreviated class) class Packet { private long id; private int seq; private int max_seq; private byte[] data; } Inside data is another JSON string. So I collect the packets and then piece the full JSON back together. The problem is that I'm also serializing the Packet into JSON using Jackson and then deserializing. The problem I've been running into is that I think Jackson is trying to deserialize the data as well. The reason is because I'm taking the byte[] data right off the datagram packet and feeding it into the object mapper. The error I've been getting is: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "@type" (Class pctelelog.Packet), not marked as ignorable at [Source: [B@36254f63; line: 1, column: 43] (through reference chain: pctelelog.Packet["@type"]) The data is a serialized class with a number of types already set for correct deserialization so that's why I think Jackson is having issues. Is there a way to tell Jackson to treat data as just byte[] and not try to deserialize it with the rest of the packet?
has comment: http://stackoverflow.com/comment/39623028
score: -1
has answer: http://stackoverflow.com/a/25405418
favorite count: 0
type: Question
answer count: 2
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25402733
tagged with: jackson
downvote count: 1
has comment: http://stackoverflow.com/comment/39625171
has title: Stop Jackson from reading embedded partial JSON

http://stackoverflow.com/comment/39617055
type: Comment
score: 2
has text: Where's your code so far?
type: QuestionComment
comment on: http://stackoverflow.com/q/25400055

http://stackoverflow.com/comment/39654306
type: Comment
comment on: http://stackoverflow.com/a/25415346
score: 0
type: AnswerComment
has text: Not what the OP was asking for. Setting `htmlEscape` to false will only escape special HTML entities (like '<' for instance), so that you start seeing ` ` text on your page. See http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/util/HtmlUtils.html#htmlEscape-java.lang.String-

http://stackoverflow.com/a/25413860
accepted answer of: http://stackoverflow.com/q/25413842
answers question: http://stackoverflow.com/q/25413842
upvote count: 51
downvote count: 0
type: Answer
score: 51
has body: You need both jackson-databind and jackson-core on your classpath.
type: AcceptedAnswer

http://stackoverflow.com/a/25432539
type: Answer
answers question: http://stackoverflow.com/q/25432408
has body: you could just set a boolean variable before the loop, and return it when the check is done. boolean checkedMails(String[] mails) { boolean isGood = true; for (int i = 0; i &lt; mails.length; i++) { if (!isEmailValid(mails[i])) { wrongEmails.add(mails[i]); Log.d("WRONGEMAILS", wrongEmails.toString()); isGood = false; } } return isGood; }
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25432408

http://stackoverflow.com/a/25467794
has comment: http://stackoverflow.com/comment/39743499
type: Answer
has comment: http://stackoverflow.com/comment/39743413
has body: I suggest thinking about how you would go about doing the task mentally. When you're counting integers, you will add one each time (i++). When you're counting by, say threes, you will add three each time. You need to store your scanner's read value to a variable (don't try to read the scanner each time!) and adjust i++ in your loop to add the number you read from the scanner instead. Begin with: int step = in.nextInt(); if(step &gt;= 2 &amp;&amp; step &lt;=10){ for(int i = 0; i &lt;=100; ???){ System.out.println(+ i); } } else { System.out.println("The step value was not between 2 and 10."); } I will leave you at this point as learning it for yourself is far more valuable than any Stack Overflow answer could ever be. If you are still stumped, I can guide you farther in the right direction.
score: 0
has comment: http://stackoverflow.com/comment/39744516
answers question: http://stackoverflow.com/q/25467722

http://stackoverflow.com/a/25478475
has body: How can i get the value of super.type in the descendant class ? problem: this.type = "c "; //this.type will return the super.type You already referencing the value of your super.type to "c " thus printing "c" solution: You need to create a type variable in your Cougar class to change the scope of this.type.
answers question: http://stackoverflow.com/q/25478444
type: Answer
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39810874
type: Comment
type: QuestionComment
has text: Hmm... I guess you're right
comment on: http://stackoverflow.com/q/25504139
score: 0

http://stackoverflow.com/comment/40345011
has text: What if I want to split and put this in an ArrayList <String> like: [S.,,--][R2...o,,,][D3-][N3',][N3'']. That means I want to separate based on alphabets and put into arraylist. No characters should be lost.
comment on: http://stackoverflow.com/a/25533937
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40139174
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25498529
has text: That's the problem. I dont know the keywords and i just have to look for the color, doesn't matter what keyword the use for that color..

http://stackoverflow.com/a/25479895
type: Answer
score: 4
has body: There are 2 methods. One accept int and other accept Integer type. So when you call test() method first it try to find a suitable method without doing any autoboxing. In that case it can find the parent class test() method which accept an int. Therefore java will execute that. If in case it wouldn't exist then it will try to autobox your parameter and check if there a suitable method. In that case your child class method will get execute. Edited Java will always pick the most specific method for a type. Casting/autoboxing/unboxing only when it has to. If you wanna call child class method you can try a.test(new Integer(2));
upvote count: 4
has comment: http://stackoverflow.com/comment/39766220
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25479808
answers question: http://stackoverflow.com/q/25479808
has comment: http://stackoverflow.com/comment/39766060
has comment: http://stackoverflow.com/comment/39766361
has comment: http://stackoverflow.com/comment/39766075

http://stackoverflow.com/comment/39742374
type: Comment
comment on: http://stackoverflow.com/a/25457505
type: AnswerComment
has text: That's one of the harder questions to answer. There are so many screen sizes. You can query the device to get the screen width and height and use that to seed your random number.
score: 0

http://stackoverflow.com/q/25513358
type: UnansweredQuestion
has title: Gradle multimodule project build in IntelliJ - relation between artifacts and wars
has comment: http://stackoverflow.com/comment/40122916
has comment: http://stackoverflow.com/comment/40145926
type: Question
tagged with: java
tagged with: dependencies
tagged with: gradle
has body: I'm facing some problems with my multimodule project gradle build in IntelliJ. My gradle build works correctly, but IntelliJ is not picking it up as it should causing my development cycle to slow down drastically. I have this dependency setup between my projects (5 projects, 3 wars, shared has my model etc. common-web has the common web components) TD (war) -&gt; common-web CP (war) -&gt; common-web CP (war) -&gt; Shared Web (war) -&gt; common-web Web (war) -&gt; Shared Shared common-web With the following structure: |- TD |- Web |- Shared |- common-web |- CP | settings.gradle | build.gradle I have one gradle build file and one gradle settings file. include 'TD', 'CP', 'Web', 'Shared', 'common-web' allprojects { repositories { mavenCentral() } sourceCompatibility = 8 task wrapper(type: Wrapper) { gradleVersion = '1.11' } subprojects { apply plugin: 'java' apply plugin: 'idea' dependencies { // dependencies... } } project(':CP') { apply plugin: 'war' dependencies { // dependencies... compile project(':shared') compile project(':common-web') } } project(':web') { apply plugin: 'war' dependencies { // dependencies... compile project(':common-web') compile project(':shared') } } project(':shared') { dependencies { // dependencies... } } project(':TD') { apply plugin: 'war' dependencies { // dependencies... compile project(':common-web') } } project(':common-web') { apply plugin: 'war' // needed to allow the providedComp dependencies { // dependencies... } } Is there a way I should configure the gradle idea plugin to allow this to be build correctly? have found the make button does not work like I think it should work, ignoring the compile errors in the modules etc. I see that in the root of the project, IntelliJ creates a folder classes/artifacts and does not use the (correct) build in the module/lib folder. The errors I'm seeing is the wrong include of the jars. For example the web project has a dependency to the TD project, which is defined nowhere. Is this a bug in t…
favorite count: 0
has comment: http://stackoverflow.com/comment/39885925
has comment: http://stackoverflow.com/comment/39842227
has comment: http://stackoverflow.com/comment/40021618
upvote count: 2
score: 2
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/42033191
answer count: 0
downvote count: 0

http://stackoverflow.com/a/25422114
type: Answer
score: 0
has body: How about adding a String for output. String input; String output = "Type a value for a or press q to quit: " do //loop for value a { try // try-catch to prevent program from crashing { stringy= JOptionPane.showInputDialog(output); if (stringy.equalsIgnoreCase("q")) { System.exit(0); } a= Integer.parseInt(stringy); i++; } catch (Exception e) { output= "Error. Try Again! "; }
answers question: http://stackoverflow.com/q/25421974

http://stackoverflow.com/comment/39617698
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25400382
has text: Why not use Youtube Android Player API?

http://stackoverflow.com/comment/39717764
score: 2
has text: This is indeed a problem in the code but it doesn't account for the error the OP is getting.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25453981

http://stackoverflow.com/q/25484013
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39772878
has comment: http://stackoverflow.com/comment/39773796
tagged with: java
answer count: 1
tagged with: methods
has title: Call an array from one method to another method
has comment: http://stackoverflow.com/comment/39773103
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39772965
downvote count: 12
has body: I have a method A in which I have created an array. Now I want to use the array in another method B and was wondering if there is any possibility that I can call the method A inside method B and use the array instead of creating the array in each and every method I create. public static void myArray() { String[][] resultCard = new String[][]{ { " ", "A", "B", "C"}, { "Maths", "78", "98","55"}, { "Physics", "55", "65", "88"}, { "Java", "73", "66", "69"}, }; } public static void A() { //Not sure how I can include the array (myArray) here } public static void B() { //Not sure how I can include the array (myArray) here }
has comment: http://stackoverflow.com/comment/39772938
has answer: http://stackoverflow.com/a/25484219
accepted answer: http://stackoverflow.com/a/25484219
tagged with: arrays
score: -10
has comment: http://stackoverflow.com/comment/39772879

http://stackoverflow.com/a/25629594
score: 1
type: AcceptedAnswer
has body: I’m not sure whether a reordering of reads of the same variable really may occur, but it’s guaranteed that local variables are unaffected by other thread’s activities. Even if such read reorderings do not happen, this guaranty is relevant for every variable which might be updated concurrently while you read it: if you read a value and store it into a local variable you can be sure that the value of the local variable does not suddenly change afterwards. Of course, if the value is a reference, that guaranty does not apply to the fields of the referenced object. The relevant sentence can be found in the JLS §17.4.1: Local variables (§14.4), formal method parameters (§8.4.1), and exception handler parameters (§14.20) are never shared between threads and are unaffected by the memory model. So the answer is no, a compiler is not allowed to undo your workaround of introducing a local variable.
answers question: http://stackoverflow.com/q/25443173
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25443173
upvote count: 1

http://stackoverflow.com/a/25543963
answers question: http://stackoverflow.com/q/25543891
type: Answer
has body: SortedSet&lt;String&gt; keys = new TreeSet&lt;String&gt;(HashMap.keySet()); keySet() is a non static method so you have to call keySet() on instance of HashMap. So try this : HashMap&lt;String, String&gt; test = new HashMap&lt;String,String&gt;(); String KEY_ITEM = "item"; String KEY_ID = "id"; test.put(KEY_ITEM, "value"); test.put(KEY_ID, "value"); SortedSet&lt;String&gt; keys = new TreeSet&lt;String&gt;(test.keySet());
score: 0

http://stackoverflow.com/a/25546432
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25546306
score: 1
has body: 0x0001ff is a hex-representation of a color in RGB: 1 byte per color component. So it's 0x00 (0/255) for Red 0x01 (1/255) for Green 0xff (255/255) for Blue. That's why it's blue. 1.0 stays for opacity. 0.0 is completely transparent, 1.0 is opaque. You can specify any value in between.

http://stackoverflow.com/q/25515064
tagged with: sorting
linked to: http://stackoverflow.com/q/416266
has body: I have an ArrayList and I am using the below code to sort it, the sortField here is of type string which works perfectly fine but sometimes it can also be a field of type Date and the below is throwing a class cast exception in such a case. What needs to be used such that it works in both the scenarios. Thanks a lot for the help in advance. Collections.sort(tempList, new BeanComparator(sortField, String.CASE_INSENSITIVE_ORDER)); Below is the stack trace 2014-08-26 16:58:18,573 ERROR - - - java.lang.ClassCastException: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.String 2014-08-26 16:58:18,573 INFO - - - Method execution failed: java.lang.ClassCastException: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.String at org.apache.commons.beanutils.BeanComparator.compare(BeanComparator.java:155) at java.util.TimSort.countRunAndMakeAscending(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at com.test.org.web.ajax.File.listFiles(FileUpload.java:105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.directwebremoting.impl.CreatorModule$1.doFilter(CreatorModule.java:229) at org.directwebremoting.impl.CreatorModule.executeMethod(CreatorModule.java:241) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:379) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:332) at org.directwebremoting.dwrp.BaseCallHandler.handle(BaseCallHandler.java:104) at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:120) at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:141) at javax.servlet.http.HttpServlet.service(HttpServlet.java:643) …
has comment: http://stackoverflow.com/comment/39831791
has title: How to sort ArrayList with different values
tagged with: arraylist
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39832430
tagged with: java
has comment: http://stackoverflow.com/comment/39831816
has comment: http://stackoverflow.com/comment/39832031
type: Question
has comment: http://stackoverflow.com/comment/39832101
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39832130
has comment: http://stackoverflow.com/comment/39832129

http://stackoverflow.com/a/25462589
score: 0
answers question: http://stackoverflow.com/q/25462429
has comment: http://stackoverflow.com/comment/39733982
type: Answer
has body: You can use ViewPager for this purpose, sample tutorial for ViewPager. First create a list containing you database values and then pass the list as parameter to adapter. You can also add next and previous buttons and use setCurrentItem method to navigate to next and previous accordingly. Hope it helps!!!

http://stackoverflow.com/comment/40026683
has text: So it was the third option, the src dir did not exist. I'm glad you found the problem.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25547095
type: AnswerComment

http://stackoverflow.com/a/25457869
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39734217
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25417504
has body: Thanks OhioCowboy &amp; Wundwin I really appreciate your help with this. I finally figured out what I was doing wrong. All I needed to do was change: &lt;option th:each="locale : ${locales}" to &lt;option th:each="locale : *{locales}" Which now that I'm getting to understand the markup, makes sense.
answers question: http://stackoverflow.com/q/25417504

http://stackoverflow.com/a/25459988
has comment: http://stackoverflow.com/comment/39729241
has body: Request object shouldn't be stored in the session. As JB Nizet wrote it shouldn't be used out side of current request. Container may decide for example to reuse that object later on, while handling different request, resetting all its attributes. You can get parameters and attributes from current request using methods request.getParameter() and request.getAttribute() and if you need them for later you can store them in session. You can also store your arbitrary objects in session. For example like this (fragment): String paramForLater = request.getParameter("p1"); // store parameter session.setAttribute("paramForLater", paramForLater); // store some data Person personData = new Person(); session.setAttribute("personData", personData ); // you can retrieve these object later in different jsp like this Person personData = (Person) session.getAttribute("personData"); String param = (String ) session.getAttribute("paramForLater"); Methods request.set/getAttribute() are used only, while handling current request. For example you may set some parameters in servlet(controller), then access them in the jsp (view) to which that same request was forwarded. in pattern like this: // in servlet get your data e.g. from database MyEntity entity = // code to get entity; request.setAttribute("entity", entity); request.getRequestDispatcher("view.jsp").forward(request, response); // then in jsp you can access that paramter &lt;% MyEntity e = (MyEntity) request.getAttribute("entity"); ... // do something in entity %&gt; You probably should use EL expression instead of scriplets, but this theme for another discussion :).
downvote count: 0
answers question: http://stackoverflow.com/q/25459515
upvote count: 1
score: 1
type: Answer

http://stackoverflow.com/comment/39749902
type: AnswerComment
score: 1
has text: It didn't solve the issue, I got the this error: java.sql.SQLException: Invalid operation for forward only resultset : last
comment on: http://stackoverflow.com/a/25471291
type: Comment

http://stackoverflow.com/a/25534589
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25533062
has body: I've found the answer to the problem. I expected to get an "OFF" or "false" value when the checkbox is unchecked, but instead it returns "null" when unchecked and returns the content of the value property if checked (or "on" if no value is set). Then, the code above can make it. I don't delete the question if anyone else finds the same confusion or needs to do that retrieve.
score: 10
type: Answer
answers question: http://stackoverflow.com/q/25533062
upvote count: 10

http://stackoverflow.com/q/25433081
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25434698
upvote count: 2
has answer: http://stackoverflow.com/a/25438006
downvote count: 0
possible better answer: http://stackoverflow.com/a/25433860
tagged with: xpages
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25433860
accepted answer: http://stackoverflow.com/a/25435750
tagged with: java
has answer: http://stackoverflow.com/a/25435750
tagged with: date
tagged with: comparison
has comment: http://stackoverflow.com/comment/39697281
has title: Comparing a NotesDateTime in JAVA
has body: Notes really does not like blank(null) dates and has caused me no end of grief. So in native Notes applications I have assigned all date fields a value of GMT 01/10/1970 0:0:0 AM then at time to display the date if it equals the GMT time I display "-" as a place holder in multi-value fields. I'm want to create a little JAVA method that compares a date passed to the GMT date and if the same return true else return false. I think I'm OK with the code to the point that I have below, but now I'm not sure how to compare dt (converted to GMT ) to GMT the simple = does not appear to work so I suspect I have some kind of comparison conflict. Any pointer in the right direction appreciated. I googled this but could not find a direct answer. public static Boolean isBlankDate(Date dt){ Boolean rtn = false; Session s = ExtLibUtil.getCurrentSession(); try{ Date GMT = s.createDateTime("01/01/1970 0:0:0 AM GMT").toJavaDate(); }catch(NotesException e){ System.out.println("Date Create Error " + e.toString()); if (dt = GMT){ rtn = true; }else{ rtn = false; } return false; } //compare dt to GMT and if equal return true else false return rtn; }
answer count: 4
has comment: http://stackoverflow.com/comment/39694386
score: 2

http://stackoverflow.com/comment/39876917
type: AnswerComment
score: 0
has text: I think you are right when you say in a "Hello World" program there should be no package and it should be removed. However just saying "remove first line" kind of implies this is the source of the problem, a mistake, but it is not.
comment on: http://stackoverflow.com/a/25537880
type: Comment

jsr356
tag name: jsr356
tags question: http://stackoverflow.com/q/25390100
type: Tag

http://stackoverflow.com/comment/39605780
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25393549
has text: I updated the description to print out the full query that Hibernate generates. I tried running this query in MSSQL and it did produce the results I am looking for, but the results in the application continue to differ.
score: 0

http://stackoverflow.com/q/25488219
score: 0
has comment: http://stackoverflow.com/comment/39781470
has answer: http://stackoverflow.com/a/25488757
tagged with: java
has title: In java, how does referencing a user defined class work when dealing with serialization and reference from another instantiable class?
answer count: 1
has comment: http://stackoverflow.com/comment/39781250
has comment: http://stackoverflow.com/comment/39781544
type: Question
has body: I have a class which is serializable, say class "WriteMe". This class needs another class to update one of its members. Said class is relatively large, since WriteMe is just a wrapper class mostly. We will call the large class "MegaClass". Therefore we have something like this: public class WriteMe implements Serializable { private ArrayList&lt;String&gt; list; private String name; public WriteMe(String s) { name = s; } public void update(MegaClass m) { list = m.getList(name); } } The hopeful point in doing this is that I don't want to store MegaClass as a class variable like the ArrayList and String are. I'm hoping by passing it in to a method and only using it there where it's needed, I will reduce the amount of memory used when creating a WriteMe, and also reduce the file-size of a WriteMe object, if I were to pass it to an ObjectOutputStream or similar (so that it can be written to file). Does "Megaclass m" just store a pointer to the instantiation of that object? If so, I would imagine that it doesn't matter if I make it a class variable or not, since an address is just a few bytes or so. Is there any advantage to using the object passed into the method only, as shown above? The other way is to pass it into the constructor and assign as a class variable. Is either way advantageous?
tagged with: serialization
has comment: http://stackoverflow.com/comment/39781509
has comment: http://stackoverflow.com/comment/39781886
has comment: http://stackoverflow.com/comment/39781380
has comment: http://stackoverflow.com/comment/39781813
tagged with: reference
has comment: http://stackoverflow.com/comment/39781867
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25488757
has comment: http://stackoverflow.com/comment/39781642

http://stackoverflow.com/comment/39718018
has text: If you read all comment carefully you will see below comment from original creator - then im getting Exception java.lang.classnotfoundexception : com.mysql.jdbc.Driver
type: AnswerComment
comment on: http://stackoverflow.com/a/25454093
score: 0
type: Comment

http://stackoverflow.com/comment/39768535
score: 0
has text: i refered [here](http://stackoverflow.com/questions/10442803/htmlunit-super-slow-execution) as well.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25481381

http://stackoverflow.com/a/25459497
score: 0
answers question: http://stackoverflow.com/q/25456207
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25456207
has body: Well, I suspected that Windows was the issue from the very get go since after the last reinstall i had some issues with it. I had the same Windows from my hidden partition for 4 years now,reinstalling it every 4-6 months. Last week, when I reinstalled it, i had some permission issues, out of nowhere. I couldn't delete, move, copy, access stuff,etc. Had to play with ownership and stuff. Dunno where this came from, I didn't allow any windows updates thru. Unless it updated my hidden partition setup files, which I don't know if it is possible. So last night I figured hey, lets activate the hidden Administrator account and see if the issue is still there. Well, it isn't. And now I went back to my normal account and all is fine now. Short version: Enabled the hidden Administrator account on Windows 7, the issue is now gone on both accounts. Have a good day and thanks for your help!

http://stackoverflow.com/q/25449772
upvote count: 1
favorite count: 0
has body: I have created a simple .jar file which is taking as argument a string with greek characters and prints it in a file. However, I have the following issue: When I execute the jar file from my local windows machine, the string is properly passed as argument in the jar file and the output in the file contains the greek characters I inserted. When I try to execute the same jar file in a windows VM, the greek characters are not properly encoded and the output in the file contains unreadable characters. I have even set the command prompt in the VM in chcp 1253 and set an environmental variable as JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 with no luck... Any suggestion?
type: Question
type: UnansweredQuestion
tagged with: windows
has title: java argument with greek characters in windows
tagged with: encoding
score: 1
tagged with: java
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25450890
tagged with: jar

http://stackoverflow.com/a/25472353
type: Answer
answers question: http://stackoverflow.com/q/25472219
score: 0
accepted answer of: http://stackoverflow.com/q/25472219
type: AcceptedAnswer
has body: You need to run your strum() method in a different thread to get what you want. There are a lot of ways doing this. One is the swing worker: new SwingWorker&lt;Void, Void&gt;() { @Override protected Void doInBackground() throws Exception { strum(); return null; } @Override protected void done() { //do something to clean up or so } }.execute(); An other would be to use a Thread: new Thread() { @Override public void run() { try { strum(); } catch ( InterruptedException e ) { e.printStackTrace(); } } }.start();

http://stackoverflow.com/q/25428825
type: Question
answer count: 1
tagged with: hibernate-criteria
tagged with: audit-tables
has answer: http://stackoverflow.com/a/25523152
accepted answer: http://stackoverflow.com/a/25523152
has body: I Know that when you do this code: AuditReader reader = AuditReaderFactory.get(entityManager); reader.createQuery().forRevisionsOfEntity(Person.class,false,true).getResultList(); it returns a tree element array. I want this 3 elements array to be mapped in a new class: public class PersonNew { Person person; DefaultRevisionEntity revision; RevisionType revisionType; public PersonNew (Person person, DefaultRevisionEntity revision, RevisionType revisionType) { this.person = person; this.revision = revision; this.revisionType = revisionType; } } i know that in criteria an in simple select you can do something like select new com.package.PersonNew () from Person. How does it apply to hibernate envers query?
type: AnsweredQuestion
score: 0
tagged with: hibernate-envers
tagged with: java
tagged with: hibernate
has title: Get results from AuditCriterion in new class

http://stackoverflow.com/comment/39766599
type: Comment
type: QuestionComment
has text: And see this: http://stackoverflow.com/questions/1834826/it-is-a-bad-practice-to-use-suns-proprietary-java-classes
comment on: http://stackoverflow.com/q/25469516
score: 0

http://stackoverflow.com/q/25537953
answer count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25537986
has answer: http://stackoverflow.com/a/25537986
type: Question
has answer: http://stackoverflow.com/a/25537978
has title: Own String container versus ArrayList<String>
tagged with: containers
possible better answer: http://stackoverflow.com/a/25537978
tagged with: arraylist
has body: Why adding strings to my own container is much less efficient than adding string to an ArrayList&lt;String&gt;? I don't know exactly how the ArrayList generic class is implemented, but I cannot understand why the add method of the ArrayList class is much faster than my add method. This is my simple container class: public class MyContainer { private String[] _array; private int _length = 0; public MyContainer(int length) { if(length &lt; 0) throw new NegativeArraySizeException(); else _length = length; _array = new String[length]; } //This is not an efficient add method, but I wouldn't know how to implement //it otherwise in Java public void add(String newElement) { ++_length; String[] tmp = new String[_length]; for(int i = 0; i &lt; _array.length; ++i) tmp[i] = _array[i]; tmp[_length - 1] = newElement; _array = tmp; } public String get(int position) { if(position &lt; 0 || position &gt;= _array.length) throw new ArrayIndexOutOfBoundsException(); else return _array[position]; } public int length() { return _length; } } In the Main class: public class Main { public static void main(String[] args) { int N = 20000; MyContainer cont = new MyContainer(0); ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); long contTime = 0; long listTime = 0; // Counting how much time is needed to add N elements to an MyContainer long startCont = System.nanoTime(); for(int i = 0; i &lt; N; ++i) cont.add("aroma"); contTime = System.nanoTime() - startCont; // // Counting how much time is needed to add N elements to an ArrayList // long startList = System.nanoTime(); for(int i = 0; i &lt; N; ++i) list.add("aroma"); listTime = System.nanoTime() - startList; System.out.println("MyContainer's object contains:\n"); for(int i = 0; i &lt; cont.length(); ++i) System.out.println(cont.get(i)); System.out.println("\n\nArrayList's objects are:\n"); for(int i = 0; i &lt; list.size(); ++i) System.out.println(list.get(i)); System.out.printf("\nNano seconds for 'cont': %d.\n", contTime); System…
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/39680077
type: AnswerComment
comment on: http://stackoverflow.com/a/25426934
score: 0
type: Comment
has text: There are issues with this approach if the class path contains more than one entry: see [How to get the path of a running jar file](http://stackoverflow.com/questions/15359702/java-get-location-of-jar-file) for a discussion and alternative (in the accepted answer to that question). Also consider if using alternate system properties is appropriate (e.g. `user.dir`: User working directory or `user.home`: User home directory).

http://stackoverflow.com/comment/39693825
type: QuestionComment
has text: @MadProgrammer Well, if it makes you feel better: you teached me something new, even though I'm using Netbeans since version 3.x :-)
comment on: http://stackoverflow.com/q/25441076
score: 0
type: Comment

http://stackoverflow.com/q/25462531
tagged with: java
tagged with: spring
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39737206
has comment: http://stackoverflow.com/comment/74985357
has title: username field is blank in loadUserByUsername in UserDetailsServiceImpl
downvote count: 0
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/75157842
tagged with: spring-security
favorite count: 0
has body: I am using spring security for authentication. Problem is all the time i am getting username as empty string. I even search about it all i get is i have to follow standard name for the fields like j_username and j_password which i am already doing. Here is my login page - <form id="signin" role="form" name="loginForm" method="POST" action='<c:url value="j_spring_security_check"></c:url>'> <spring:message code="login.form.head.social.msg" text="Sign in with your social account"></spring:message> <a href='<c:url value="/auth/facebook"></c:url>' class="btn social icon-facebook col-lg-5 col-md-5 col-sm-5 col-xs-5 pull-right"> <spring:message code="login.social.facebook"></spring:message> <spring:message code="login.social.googleplus"></spring:message> <spring:message code="login.form.head.register.msg" text="Login with your registered account"></spring:message> @ <input type="email" class="form-control" id="email" placeholder='<spring:message code="placeholder.email" text="Password"></spring:message>' name="j_username"> <input type="password" class="form-control" id="password" placeholder="<spring:message code="placeholder.password" text="Password"></spring:message>" name="j_password"> <spring:message code="btn.login" text="Login"></spring:message> <spring:message code="link.rememberme" text="Remember me"></spring:message> <spring:message code="link.resetpassword" text="Reset password !"></spring:message> <spring:message code="link.registerhere" text="Register here !"></spring:message> My loadUserByUsername method. I have added comment at logger.info where i am printing username and i see an empty string ie. printing "load user by username - " public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { // TODO Auto-generated method stub logger.info("load user by username - "+username); //Here username is blank User user = getUserByEmail(username); if (user == null) { throw new UsernameNotFoundException("No user found with username: " + user…
type: Question
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/26360204

http://stackoverflow.com/q/25476563
tagged with: rotation
tagged with: angle
type: UnansweredQuestion
downvote count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/2320986
type: Question
has body: I am implementing a rotating cannon on a tank. The cannon of the NPC is following the player tank (auto-rotating). I am calculating: The angle of the vector tank -> enemy (radians) The angle of the cannon (radians) The difference between both (I tried with Math.min and Math.abs after googling) Tthe problem is that the jump from 0 degrees to 360 or from 360 to 0 makes the cannon "loose" the player-tank and the cannon rotates once all around. Right now its done like this: Vector2 Tank2Enemy = tank.getPosition().sub(closestEnemyTank.getPosition()); float angleTank2Enemy = Tank2Enemy.angleRad(); // this is the angle of the vector tank -&gt; enemy in radians float angleCannon = tank.cannon.getOwnAngle(); // this is the cannon-angle in radians float diffAngle = Math.min(Math.abs(angleCannon - angleTank2Enemy), MathUtils.PI - Math.abs(angleCannon - angleTank2Enemy)); if (diffAngle &gt; 0.01f || diffAngle &lt; -0.01f) { // dead zone if (diffAngle &gt; 0.01f) { direction = -1; // this goes to cannon.getBody().setAngularVelocity(cannonAngularVelocity); } else if (diffAngle &lt; 0.01f) { direction = 1; // this goes to cannon.getBody().setAngularVelocity(cannonAngularVelocity); } } return direction;
has comment: http://stackoverflow.com/comment/39771476
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25476676
has title: How to compensate "angle-jump" from 0 to 360 and vice versa?
favorite count: 0
has answer: http://stackoverflow.com/a/25485599
answer count: 2

http://stackoverflow.com/q/25501294
has body: I have a .bin file and need to copy it into a directory with root permission on an Ubuntu machine. How to do this operation in Java?
has title: Copying file into root directory
has comment: http://stackoverflow.com/comment/39805404
has comment: http://stackoverflow.com/comment/39805514
favorite count: 0
has comment: http://stackoverflow.com/comment/39805531
accepted answer: http://stackoverflow.com/a/25501568
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25501568
has comment: http://stackoverflow.com/comment/39805594
tagged with: java
downvote count: 3
tagged with: ubuntu-12.04
has comment: http://stackoverflow.com/comment/39805571
type: Question
has comment: http://stackoverflow.com/comment/39805744
tagged with: root
has comment: http://stackoverflow.com/comment/39805745
has comment: http://stackoverflow.com/comment/39805854
has comment: http://stackoverflow.com/comment/39805451
upvote count: 0
score: -3
answer count: 1
has comment: http://stackoverflow.com/comment/39805478

http://stackoverflow.com/a/25443915
has comment: http://stackoverflow.com/comment/49083388
has comment: http://stackoverflow.com/comment/39699521
has body: Here and here is some information about converting keys from java keystore to a .pem file. Then you can use the pem to SCP. Try sshj library. Here is an example of SCP upload: import net.schmizz.sshj.SSHClient; import net.schmizz.sshj.xfer.FileSystemFile; import java.io.File; import java.io.IOException; /** This example demonstrates uploading of a file over SCP to the SSH server. */ public class SCPUpload { public static void main(String[] args) throws IOException, ClassNotFoundException { SSHClient ssh = new SSHClient(); ssh.loadKnownHosts(); ssh.connect("localhost"); try { ssh.authPublickey("/path/to/key.pem")); // Present here to demo algorithm renegotiation - could have just put this before connect() // Make sure JZlib is in classpath for this to work ssh.useCompression(); final String src = System.getProperty("user.home") + File.separator + "test_file"; ssh.newSCPFileTransfer().upload(new FileSystemFile(src), "/tmp/"); } finally { ssh.disconnect(); } } }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25443360
score: 1

http://stackoverflow.com/q/25396953
tagged with: android-intent
has title: Parse Data from One Activity to Another
has answer: http://stackoverflow.com/a/25396994
score: 0
has comment: http://stackoverflow.com/comment/39611635
tagged with: java
answer count: 1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/39611623
type: Question
type: UnansweredQuestion
tagged with: android
tagged with: hyperlink
has body: I made a couple of autocomplete, datepicker and spinners in a activity and i want to parse data on another activity onclick. <Spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/c" android:layout_alignTop="@+id/s" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:spinnerMode="dropdown" /> I want the data from the upper field save into image link like: values from field will be added into a image link which have variables like http://example.com?v=var1&v1=var2&v3=var3 These value will generate a dynamic link. And when we click on a image link it open in a browser. So, i can do it

http://stackoverflow.com/q/25427245
answer count: 2
accepted answer: http://stackoverflow.com/a/25427738
tagged with: android
possible better answer: http://stackoverflow.com/a/25427804
has answer: http://stackoverflow.com/a/25427738
has title: Passing variable from Activity to Adapter
has body: I want to pass a variable from an activity to an adapter. Don't know where I did the mistake. public class CustomListAdapter extends BaseExpandableListAdapter { private int weight; public void setWeight(int weight) { this.weight = weight; } ..... } But I can't acces this method in my Activity public class mActivity extends Activity { CustomListAdapter expandableListAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.emergency_activity); expandableListAdapter = new CustomListAdapter (this); //expandableListAdapter.setWeight(5); ... "expandableListAdapter can not resolved to a type"
has comment: http://stackoverflow.com/comment/39667752
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39667510
has answer: http://stackoverflow.com/a/25427804
downvote count: 1
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/39668809
type: Question

http://stackoverflow.com/comment/115796504
comment on: http://stackoverflow.com/a/41076686
has text: Works for NetBeans 12.2 under CentOS 8
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39891418
type: Comment
type: QuestionComment
score: 0
has text: I cannot understand your problem. Integers are numeric representated and characters(also numbers) alphanumeric.clarify it: You have an inputfield which accepts alphanumeric inputs but you only want to allow the numeric ones in it?
comment on: http://stackoverflow.com/q/25548162

http://stackoverflow.com/comment/39688825
has text: I agree that is also a good point. Definitely not elegant, I just want people to know it does work, but I agree, NOT the desired choice.
type: Comment
comment on: http://stackoverflow.com/a/25438307
score: 0
type: AnswerComment

http://stackoverflow.com/q/25506505
favorite count: 0
type: Question
upvote count: 2
has title: Hibernate/JPA persisting relationship changes despite cascade = REFRESH
answer count: 0
has body: I'm running into a weird problem where an entity is being updated through a relationship that isn't set to cascade, and was hoping someone has an explanation. The basic object structure is an Article with a related Statistics object. The database table for Statistics is updated by a completely different process (outside of Hibernate, completely different JVM on a different server), but we are seeing those changes reverted to the state they were when the Article was read when we finally do a save. It would definitely make sense if it wasn't set to REFRESH, but because it is, I'm perplexed. @Entity public class Article { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @OneToOne(cascade = {CascadeType.REFRESH}) private Statistics statistics; } @Entity public class Statistics { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private Long views; } The weirdest thing is that it seems to be doing this regardless of the cascade type. If I put only PERSIST, or even no cascading, it still seems to be reverting the statistics numbers. I do see it doing a SELECT on the Statistics object when the Article is saved, and only performing the UPDATE statement to revert it back if it sees it has changed. This also doesn't seem to be a problem anywhere else, we have REFRESH all over the place and it seems to behave just fine in not cascading save changes to those objects. Here is an example of what I'm seeing... Article article = articleRepository.get(1l); // article.getStatistics().getViews() = 4 // article is detached and some amount of time goes // underlying database table is updated and views are incremented // article reattached with changes articleRepository.save(article); At the end of that snippet, the database shows 4 views on the statistics object, but I don't expect the save to be cascaded to the Statistics object and overwrite existing data in the database.
type: UnansweredQuestion
tagged with: jpa
has comment: http://stackoverflow.com/comment/39843843
score: 2
has comment: http://stackoverflow.com/comment/39820508
has comment: http://stackoverflow.com/comment/39818137
downvote count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/39889249
has comment: http://stackoverflow.com/comment/39816154

http://stackoverflow.com/comment/39761422
type: QuestionComment
type: Comment
score: 0
has text: I yet to see a single programming book without any typos / errors in the published code.
comment on: http://stackoverflow.com/q/25477428

http://stackoverflow.com/a/25435975
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25435849
has comment: http://stackoverflow.com/comment/39687205
score: 1
type: Answer
has body: It depends on the specific error (including an ORA-xxxxx error number is always greatly appreciated). If the problem is that the Java application is trying to insert a value that cannot be converted to the table's data type, that error would be expected to be thrown before the trigger could run. Data type validations have to happen before the trigger can execute. Imagine what would happen if data type validations happened after the trigger ran. If the Java app passed an invalid value for, say, col1, then inside the trigger, :new.col1 would have a data type of whatever col1 has in the underlying table but would have an invalid value. Any reference to that field, therefore, would need to result in an error being raised-- you couldn't plausibly log an invalid value to your table. Are you sure that you can't intercept the queries somehow? For example, if you renamed victim_table to victim_table_base, created a view named victim_table with larger data types, and then defined an instead of trigger on the view that validated the data and inserted it into the table, you could identify which values were invalid. Alternately, since your Java application is using JDBC (presumably) to interact with the database, you should be able to enable logging at the JDBC layer to see the parameter values that are being passed.
has comment: http://stackoverflow.com/comment/39687708
answers question: http://stackoverflow.com/q/25435849
type: AcceptedAnswer

http://stackoverflow.com/q/25427949
downvote count: 0
tagged with: java-home
has body: I was following this video for installation of grails on a virtual machine (Centos-OS, Linux) : Video It was done once successfully, but while doing this process in another VM, I got stuck in the process after jdk installation. I installed GVM successfully, after restarting the terminal, I get an error : GVM: JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME. I googled the error and changed the environment variable many times, but nothing has removed the error as the variables get changed only for that instance, and it does not stay after that instance I also got inside bash_profile, but I am not able to edit the file and save it. Also, I am not able to find the exact location as I do not have access to the VM window where I can actually navigate and check directories. I only have access to the main terminal of the VM wherein I have to resolve this error to go ahead and install grails using GVM How do I resolve this issue? What am I doing wrong here? All suggestions/approaches are most welcome.
upvote count: 1
linked to: http://stackoverflow.com/q/10117943
favorite count: 0
type: Question
tagged with: linux
has answer: http://stackoverflow.com/a/29738880
type: UnansweredQuestion
tagged with: grails
answer count: 3
has title: Issues in installation of grails in Linux
score: 1
tagged with: environment-variables
has answer: http://stackoverflow.com/a/25436928
tagged with: java
has answer: http://stackoverflow.com/a/29229742

http://stackoverflow.com/comment/39653538
type: QuestionComment
has text: envers is too "heavy duty" for my purpose
score: 0
comment on: http://stackoverflow.com/q/25408818
type: Comment

http://stackoverflow.com/q/25451641
tagged with: bash
downvote count: 0
tagged with: java
has title: Excluding jars from dynamically generated classpaths?
has answer: http://stackoverflow.com/a/25455113
accepted answer: http://stackoverflow.com/a/25455113
type: Question
answer count: 1
has body: I'm launching my java server from a bash script. The server has "provided" dependencies on 3rd party jars. However, some of those jars conflict with jars in my app, and need to be excluded from the classpath... At the moment, I only need to exclude one jar, so this idiom gets me by EXTERNAL_JARS=$(find "${EXTERNAL_LIB}" -name 'slf4j-log4j12-1.4.3.jar' -prune -o -type f -name '*.jar' -printf ':%p' ) CLASSPATH=${CLASSPATH}${EXTERNAL_JARS} Is there a better approach to use when the number of external jars is 20-30 and the number of excluded jars is ~ 5 ?
favorite count: 0
type: AnsweredQuestion
score: 3
upvote count: 3

http://stackoverflow.com/comment/39884979
comment on: http://stackoverflow.com/q/25529056
score: 0
type: Comment
has text: If that project is include as a library, you can also attach the source code to that jar?
type: QuestionComment

http://stackoverflow.com/q/25512333
tagged with: java
has comment: http://stackoverflow.com/comment/39826645
tagged with: file
has body: I'm using a directoryChooser to choose the path for saving files. If I run the code, the directoryChooser opens and I go to the path "D:/Projects/TestFiles/Income". I use the method directoryChooser.getCurrentDirectory() and set a label with setText() (displayed in the JFrame) to this path. The label is not displaying the complete Path, just "D:/Projects/TestFiles" is showing. The last folder (step of the path) is missing... DirectoryChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); is used for filtering. How can I get the complete path?
has answer: http://stackoverflow.com/a/25512873
has title: Java: How to get the complete path with a directoryChooser?
tagged with: jfilechooser
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25512534
has answer: http://stackoverflow.com/a/25512563
tagged with: swing
score: 0
answer count: 3

http://stackoverflow.com/q/25525847
has body: There's some similar questions, but I couldn't find a concrete answer whether what I wanna do is possible or not. I'm using App Engine, JDO. I'm trying to retrieve the object "User" by doing the following query (also using cursors so that the same user is never "seen" again): . . *EDIT - added cursor-code* extensionMap.put(JDOCursorHelper.CURSOR_EXTENSION, Cursor.fromWebSafeString(cursorAsString)); //cursorAsString is retrieved from user Query query = pm.newQuery(User.class); query.setExtensions(extensionMap); //Contains the cursor object query.setRange(0, amount); query.setOrdering("bornYear asc, toc asc"); query.setFilter("locationFid == :p1 &amp;&amp; gender == :p2 &amp;&amp; bornYear &gt;= :p3 &amp;&amp; bornYear &lt;= :p4"); List&lt;Object&gt; params = new ArrayList&lt;Object&gt;(); params.add(locationFid); params.add(lookingForGender); params.add(yearSpanStart); params.add(yearSpanEnd); results = (List&lt;User&gt;) query.executeWithArray(params.toArray()) cursor = JDOCursorHelper.getCursor(results); //give this to user for use next request In the documentation I can't seem to find anything saying it won't work using cursors and inequality filters only that it can behave strange (uhh?). But it seems it doesn't work in my case and I'm not sure if I'm doing something wrong. The above code is "faulty" because it won't return "new" users added after the first request was made. However if I change the filtering and ordering to: query.setOrdering("toc asc"); query.setFilter("locationFid == :p1 &amp;&amp; gender == :p2"); The above will work, but then I won't be getting the age-span that I wanted. Is there some way to make the first version work? Or do I have to first retrieve the users without inequality, and then "manually" filter then server-side and then retrieve another "batch" if I didn't get enough results? This seem very bad, mostly because then the cursor will have moved passed these users and if I ever change the age-span, I won't be able to retrieve (/see) …
tagged with: jdo
type: Question
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/39855978
has title: GAE - Inequality filters and cursors, they don't work together?
has comment: http://stackoverflow.com/comment/39870453
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39893080
tagged with: java

http://stackoverflow.com/q/25526562
tagged with: session
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25527857
downvote count: 0
has comment: http://stackoverflow.com/comment/39927461
score: 1
upvote count: 1
tagged with: java
has body: I am maintaining a legacy GUI application running on Tomcat6 and in some cases, when an user logs in, the application loads a massive java object into session and it takes a lot of memory (up to 200MB). I installed psi-probe to monitor the memory and it shows this: Current memory usage is 99.3% Free: 3.41 MB Total: 487.25 MB Max: 487.25 MB I would like to avoid touching the structure of the object itself because it is also a monster of complexity and I would probably break something. I don't really know what options I have. I was thinking of trying to serialize it and write it as a file on the drive and access it there on demand. Any ideas? Cheers.
answer count: 1
has comment: http://stackoverflow.com/comment/39854254
tagged with: memory
tagged with: tomcat
tagged with: tomcat6
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39991683
accepted answer: http://stackoverflow.com/a/25527857
has comment: http://stackoverflow.com/comment/39851965
has title: Java object taking too much space in Tomcat session (Legacy code)

http://stackoverflow.com/a/25545608
answers question: http://stackoverflow.com/q/25545434
has body: You do not have the appropriate permissions to make changes to the file. Editing id3 tags involves reading, modifying and then writing the file to it's original location. If you're running KitKat or greater, and the audio file is stored in the SD Card, Google have revoked developer's permission to modify the files. Otherwise, it may just be that you haven't requested the write access permission in your manifest: &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
accepted answer of: http://stackoverflow.com/q/25545434
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/q/25546099
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39887833
has comment: http://stackoverflow.com/comment/39887679
has comment: http://stackoverflow.com/comment/39888858
has body: I have a requirement where I need to create a JAVA application which will read data from 52 database tables, copy all data which is more than 3 years old to flat files (either csv, txt files), delete these data from tables and store these files on a SFTP server. The database in this case is Sybase ASE 15 version. Also I need to restore this data in temporary tables when certain reports are to be prepared involving the above archived data. If I make this application a single threaded application, it will take many hours to complete the task. So I need to make it multi-threaded. Please suggest should I use only core java or any framework like spring batch. And how to achieve multi-threading in both the cases.
has title: Multithreading for JDBC operations
has comment: http://stackoverflow.com/comment/39889244
type: Question
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/39906168
has comment: http://stackoverflow.com/comment/39888882
tagged with: java
has comment: http://stackoverflow.com/comment/39887816
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39888384
has comment: http://stackoverflow.com/comment/39887565
has comment: http://stackoverflow.com/comment/39887864
score: 0

http://stackoverflow.com/q/25403932
favorite count: 0
type: Question
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25403987
has answer: http://stackoverflow.com/a/25404040
answer count: 5
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/25403977
accepted answer: http://stackoverflow.com/a/25403977
has body: I found one interesting thing in java while making some programs. Here is one simple code. When I made this code, class Son occured an error. It means 2nd constructor needs a nonparametric constructor like this one.. public classname(){} . But, all classes have their own default constructor so I don't think there's no need to make nonparametric constructor. Is there a difference between them? class Papa { private int papa_var; public Papa(String name, int age) { } } class Son extends Papa { private int son_var; public Son(String name, int age) { super(name,age); } public Son(int car, int robot) { } }
tagged with: constructor
upvote count: 1
has title: the difference of a default constructor & nonparametric constructor in java?
has answer: http://stackoverflow.com/a/25404027
has answer: http://stackoverflow.com/a/37346182
possible better answer: http://stackoverflow.com/a/37346182
tagged with: inheritance
has comment: http://stackoverflow.com/comment/39624030

binary-search
tags question: http://stackoverflow.com/q/25459133
tag name: binary-search
type: Tag

http://stackoverflow.com/q/25414994
has comment: http://stackoverflow.com/comment/39648396
score: 0
answer count: 0
tagged with: swing
has title: Driver not found exception. I have added the derby.jar file into the libraraies but still it shows an error
tagged with: driver
has body: private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { String textFieldValue = jTextField1.getText(); String textFieldValue1 = jTextField2.getText(); String textFieldValue2 = jTextField3.getText(); String textFieldValue3 = jTextField4.getText(); String textFieldValue5 = jTextArea1.getText(); String textFieldValue4 = jTextField5.getText(); Connection con=null; Statement stmt=null; try{ /* amrita is user and amritha ipassword*/con=DriverManager.getConnection("jdbc:derby://localhost:1527//contact;create=true","amrita,"amritha"); stmt=con.createStatement(); } catch (SQLException ex) { Logger.getLogger(newcontact.class.getName()).log(Level.SEVERE, null, ex); } String name = textFieldValue; String lname = textFieldValue1; /* fields used in jframe form*/ String phone = textFieldValue2; String home = textFieldValue3; String email = textFieldValue4; String addr = textFieldValue5; String insert = "INSERT INTO AMRITA.ADRESSBOOKTABLE VALUES ('" + name + ","+lname+","+phone+","+home+","+addr+","+email+"')"; try { stmt.executeUpdate(name); stmt.executeUpdate(lname); stmt.executeUpdate(phone); stmt.executeUpdate(home); stmt.executeUpdate(addr); stmt.executeUpdate(email);// TODO add your handling code here: } catch(SQLException e) { } }
type: Question
has comment: http://stackoverflow.com/comment/39645932
has comment: http://stackoverflow.com/comment/39648414
tagged with: java
tagged with: database
type: UnansweredQuestion

interactive
tags question: http://stackoverflow.com/q/25533244
type: Tag
tag name: interactive

http://stackoverflow.com/comment/39636762
comment on: http://stackoverflow.com/q/25410201
score: 0
type: Comment
type: QuestionComment
has text: Why don't you use java.util.Scanner? This will do all the white space skipping for you.

http://stackoverflow.com/q/25418946
downvote count: 0
linked to: http://stackoverflow.com/q/1264709
upvote count: 1
type: AnsweredQuestion
has body: Hello I was curious on how data can be downloaded in java, so I looked through few methods and decided to use BufferedInputStream. Now when I download, I download the file by 1024 bytes burst, and everytime it downloads 1kb I concat the temp array to the main data array.tH I use this concat method: public static byte[] concat(byte[] data, byte[] bytes) { byte[] result = Arrays.copyOf(data, data.length + bytes.length); System.arraycopy(bytes, 0, result, data.length, bytes.length); return result; } This is my download process: URL target = new URL ("http://freshhdwall.com/wp-content/uploads/2014/08/Image-Art-Gallery.jpg"); URLConnection t = target.openConnection(); t.setRequestProperty("User-Agent", "NING/1.0"); t.connect(); BufferedInputStream stream = new BufferedInputStream(t.getInputStream()); final byte[] bytes = new byte[1024]; int count; byte[] data = new byte[0]; while ( (count = stream.read(bytes, 0, bytes.length)) != -1) { System.out.println(count); data = concat(data, bytes); } Now after downloading, I convert the bytes array to BufferedImage using ByteArrayInputStream: InputStream s = new ByteArrayInputStream(data); BufferedImage m = ImageIO.read(s); And then I display the result: JFrame j = new JFrame(); j.add(new JLabel(new ImageIcon(m))); j.pack(); j.setVisible(true); Now the result image looks like this: (source: gyazo.com) As you see, the image looks broken, missing bytes when downloading. This is the real image: img http://freshhdwall.com/wp-content/uploads/2014/08/Image-Art-Gallery.jpg What did I do wrong that it displays the image like that?
has title: Java - downloading image by bytes downloads a broken image
tagged with: network-programming
has answer: http://stackoverflow.com/a/25418996
score: 1
has comment: http://stackoverflow.com/comment/39652585
tagged with: java
tagged with: image
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25418996
answer count: 1

http://stackoverflow.com/comment/39700242
type: Comment
type: QuestionComment
has text: If possible hex dump `got_aid` and post. It could be a UTF-16 issue, internally NSString used UTF-16.
comment on: http://stackoverflow.com/q/25445048
score: 0

http://stackoverflow.com/a/25413825
accepted answer of: http://stackoverflow.com/q/25413758
has body: If its MySQL you need to check if database exists to take decision weather the database was really created SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'LIBRARY3'
has comment: http://stackoverflow.com/comment/39644532
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39644672
has comment: http://stackoverflow.com/comment/39646022
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25413758
has comment: http://stackoverflow.com/comment/39644594
has comment: http://stackoverflow.com/comment/39643592

http://stackoverflow.com/q/25439660
answer count: 1
has body: So this is my scenario. I have this xml example. Person1 Person1LastName Foo Bar Person2 Person1LastName My question is how can I separate person with address and contact? I want to return it as string. Is there a way to know if element is exist using select nodes? //query elements with address and contact document.getRootElement().selectNodes(//person/[contains address and contact]);
has title: Separate string of xml using dom4j
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25440722
tagged with: dom4j
type: Question
tagged with: xml-parsing
type: UnansweredQuestion

http://stackoverflow.com/q/25448145
tagged with: string
has comment: http://stackoverflow.com/comment/39705899
has answer: http://stackoverflow.com/a/25449373
has comment: http://stackoverflow.com/comment/39706144
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25448376
has comment: http://stackoverflow.com/comment/39705954
tagged with: list
answer count: 3
has comment: http://stackoverflow.com/comment/39706610
tagged with: java
has title: Frequency of words in List of Strings of Strings
has answer: http://stackoverflow.com/a/25449565
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25448376
has body: I have a list of Strings: List&lt;String&gt; terms = ["Coding is great", "Search Engines are great", "Google is a nice search engine"] How do I get the frequency of each word in the list: E.g.{Coding:1, Search:2, Engines:1, engine:1, ....} Here is my Code: Map&lt;String, Integer&gt; wordFreqMap = new HashMap&lt;&gt;(); for (String contextTerm : term.getContexTerms() ) { String[] wordsArr = contextTerm.split(" "); for (String word : wordsArr) { Integer freq = wordFreqMap.get(word); //this line is getting reset every time I goto a new COntexTerm freq = (freq == null) ? 1: ++freq; wordFreqMap.put(word, freq); } }
has comment: http://stackoverflow.com/comment/39705979
downvote count: 0
upvote count: 6
possible better answer: http://stackoverflow.com/a/25449565
score: 6

http://stackoverflow.com/comment/39861073
type: QuestionComment
comment on: http://stackoverflow.com/q/25530463
has text: I have not yet decided to use anything, I am waiting for a treetable with above structure (shown in the image) in JAVA. Once I got a Structure like that in JAVA, then I will start implementation.
score: 1
type: Comment

http://stackoverflow.com/comment/39742843
score: 0
comment on: http://stackoverflow.com/q/25466923
has text: Applyforce basically adds the parameter vector to the objects velocity. It's not reset every time it is called.
type: Comment
type: QuestionComment

glassfish
tags question: http://stackoverflow.com/q/25417809
tags question: http://stackoverflow.com/q/25401435
tags question: http://stackoverflow.com/q/25447418
tag name: glassfish
tags question: http://stackoverflow.com/q/25391409
tags question: http://stackoverflow.com/q/25430395
tags question: http://stackoverflow.com/q/25505028
tags question: http://stackoverflow.com/q/25509825
tags question: http://stackoverflow.com/q/25532155
tags question: http://stackoverflow.com/q/25513665
tags question: http://stackoverflow.com/q/25543619
tags question: http://stackoverflow.com/q/25471945
tags question: http://stackoverflow.com/q/25545239
tags question: http://stackoverflow.com/q/25422214
tags question: http://stackoverflow.com/q/25419891
type: Tag

http://stackoverflow.com/comment/39638875
comment on: http://stackoverflow.com/q/25411319
score: 1
type: Comment
type: QuestionComment
has text: Check for each character if it is a white space and every time that it is, update a variable holding the index of the white space. Once you get to the last iteration, if the next character is not a white space you know you are in the middle of a word. In that case, you can use the last white space index to know where you needed to stop.

http://stackoverflow.com/q/25438624
has comment: http://stackoverflow.com/comment/95825329
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/63326621
has comment: http://stackoverflow.com/comment/63571966
has body: So basically I'm trying to display a .obj 3D Model with an OrthographicCamera in 2D rather than in 3D with a PerspectiveCamera. Everything works fine when I render with the PerspectiveCamera, however if I switch it to Orthographic, nothing displays, just the blank background. Below is the code I'm using with the PerspectiveCamera stuff commented out. I'm not sure if there is a different way that I need to setup the OrthographicCamera, or if I need to use a PerspectiveCamera with some modified to views to achieve this. At this point it really doesn't matter which axis I "eliminate". Essentially what I want to achieve is being able to use Blender for my 2D animation. I've figured this out on the Blender side and it works very well, however they must be imported as .obj(or .fbx) into LibGDX, these are loaded into LibGDX as Models, and as such must be rendered with a ModelBatch using a ModelInstance and an Environment. I need a way to view this object using a 2D Orthographic projection rather than a 3D Perspective projection. Anyone got any suggestions for this? public class Test extends ApplicationAdapter { //public PerspectiveCamera cam; public OrthographicCamera cam; public CameraInputController camController; public ModelBatch modelBatch; public ModelInstance ship; public Environment environment; @Override public void create() { modelBatch = new ModelBatch(); environment = new Environment(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f)); environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); /* cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(10f, 10f, 10f); cam.lookAt(0, 0, 0); cam.near = 1f; cam.far = 10f; cam.update(); */ cam = new OrthographicCamera(); cam.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.update(); camController = new CameraInputController(cam); Gdx.input.setInputProcessor(camController); ObjLoader loader…
tagged with: libgdx
type: UnansweredQuestion
downvote count: 0
has title: Displaying 3D models with an OrthographicCamera in LibGDX
has comment: http://stackoverflow.com/comment/66207163
score: 3
answer count: 0
tagged with: camera
upvote count: 3
has comment: http://stackoverflow.com/comment/39691635
tagged with: java

http://stackoverflow.com/comment/97043357
score: 1
type: Comment
type: AnswerComment
has text: `-Dlog4j.configurationFile` is what I needed, since the project I am working on is not Maven based. Awesome
comment on: http://stackoverflow.com/a/32549274

http://stackoverflow.com/comment/39850279
score: 0
has text: Not sure an application-specific error code (in the -20000 range) is much of a vulnerability. Maybe you could show the code that's executing the `save_customer` call and generating the HTML; it's that which needs to replace the error with something even more generic, perhaps.
comment on: http://stackoverflow.com/q/25524628
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25549935
answer count: 1
has body: java.lang.ClassCastException: weblogic.xml.jaxp.RegistryXMLReader cannot be cast to org.xml.sax.XMLReaderWarning: Caught exception attempting to use SAX to load a SAX XMLReader Warning: Exception was: java.lang.ClassCastException: weblogic.xml.jaxp.RegistryXMLReader cannot be cast to org.xml.sax.XMLReader Warning: I will print the stack trace then carry on using the default SAX parser at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source) at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source) at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:83) at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:894) at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:715) at org.dom4j.io.SAXReader.setFeature(SAXReader.java:218) at org.hibernate.ejb.Ejb3Configuration.addXMLEntities(Ejb3Configuration.java:438) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:360) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126) at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:393) at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:386) at weblogic.deployment.BasePersistenceUnitInfoImpl.&lt;init&gt;(BasePersistenceUnitInfoImpl.java:158) at weblogic.deployment.PersistenceUnitInfoImpl.&lt;init&gt;(PersistenceUnitInfoImpl.java:39) at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:349) at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptors(AbstractPersistenceUnitRegistry.java:124) at weblogic.deployment.ModulePersistenceUnitRegistry.&lt;init&gt;(ModulePersistenceUnitRegistry.java:58) at weblogic.servlet.internal.WebAppModule.setupPersistenceUnitRegistry(WebAppModule.java:1827) at weblogic.servlet.internal.WebAppServletContext.initClassLoader(WebAppServletContext.java:30…
type: Question
type: UnansweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/25577053
downvote count: 0
score: 1
upvote count: 1
has title: I am getting following Error on startup of weblogic 10.3.6
tagged with: java

http://stackoverflow.com/a/25401341
has comment: http://stackoverflow.com/comment/39619697
has comment: http://stackoverflow.com/comment/39620735
answers question: http://stackoverflow.com/q/25400677
type: Answer
has body: I was just reading through the WebRequest.cpp file and it looks like the error message your getting is being created in setAuth on line 463 because your WebRequest isnt getting to call the start method on line 231. Try adding a conditional statement before you call proceed to check that username and password arnt null first? Also take a look at these examples of similar snippets of code and you may find a solution.
score: 0

http://stackoverflow.com/comment/39791059
score: 1
type: QuestionComment
type: Comment
has text: @Supuhstar: People with gold badges in a tag can close questions with 1 vote.
comment on: http://stackoverflow.com/q/25409103

http://stackoverflow.com/comment/39768410
type: Comment
has text: Which hibernate version do you use?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25481330

http://stackoverflow.com/q/25528965
score: 0
has comment: http://stackoverflow.com/comment/39856537
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39856484
tagged with: javassist
has comment: http://stackoverflow.com/comment/39856359
tagged with: proxy
linked to: http://stackoverflow.com/q/10533687
type: Question
has title: Make an object read only in Java
tagged with: java
has body: I have a cache with objects which were read from the database (regular beans). When I return them I want to make them read only so users of the cache can't damage the cache objects. I'm looking for an efficient way since objects can be requested thousands of times per second. One solution is to wrap each object with a proxy object which disables all the set accessors (can be done with Java Assist) but I'm looking for a more lightweight solution. Another solution is to clone the object before returning it but it is even wrost than the proxy solution performance wise.
tagged with: caching
duplicate of: http://stackoverflow.com/q/10533687

http://stackoverflow.com/comment/48510115
type: Comment
score: 0
has text: Did you attempt to create your own feature to solve this?
comment on: http://stackoverflow.com/q/25507761
type: QuestionComment

http://stackoverflow.com/comment/39845759
has text: Obviously I'm doing something wrong. If I want to access the variables like you mentioned it, I always get null as value for the variable.
type: Comment
comment on: http://stackoverflow.com/a/25506711
type: AnswerComment
score: 0

memory-management
tags question: http://stackoverflow.com/q/25401185
tags question: http://stackoverflow.com/q/25402947
tags question: http://stackoverflow.com/q/25465750
type: Tag
tags question: http://stackoverflow.com/q/25508769
tags question: http://stackoverflow.com/q/25550036
tags question: http://stackoverflow.com/q/25396664
tags question: http://stackoverflow.com/q/25509588
tag name: memory-management

http://stackoverflow.com/comment/39845462
comment on: http://stackoverflow.com/q/25503486
has text: Can you show code for `params`? If that is `MATCH_PARENT` in width, change it to `WRAP_CONTENT`. **OR** if you need the textview in different lines, change linear layout orientation to `VERTICAL`.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25440896
has comment: http://stackoverflow.com/comment/39695186
has title: Cannot find symbol symbol : variable PROXIMITY_ON_WAKE?
has comment: http://stackoverflow.com/comment/39695594
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39692977
has comment: http://stackoverflow.com/comment/39693149
has comment: http://stackoverflow.com/comment/39693034
type: Question
has comment: http://stackoverflow.com/comment/39693073
score: 0
has comment: http://stackoverflow.com/comment/39692915
answer count: 0
has body: I'm trying to build a ROM for Android and everything is going smooth, but then i added Proximity Wake feature from CM and got this error: packages/apps/Settings/src/com/android/settings/DisplaySettings.java:148: cannot find symbol symbol : variable advancedPrefs location: class com.android.settings.DisplaySettings advancedPrefs.removePreference(findPreference(KEY_PROXIMITY_WAKE)); ^ packages/apps/Settings/src/com/android/settings/DisplaySettings.java:149: cannot find symbol symbol : variable PROXIMITY_ON_WAKE location: class android.provider.Settings.System Settings.System.putInt(getContentResolver(), Settings.System.PROXIMITY_ON_WAKE, 1); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors when i open up the file i find this lines: advancedPrefs.removePreference(findPreference(KEY_PROXIMITY_WAKE)); Settings.System.putInt(getContentResolver(), Settings.System.PROXIMITY_ON_WAKE, 1); The error states that it cannot find a symbol, what is wrong?
type: UnansweredQuestion

http://stackoverflow.com/comment/39750590
score: 0
type: AnswerComment
has text: Where should I return the goal object? As it is created in an if statement I get error "goal cannot be resolved to a variable",
type: Comment
comment on: http://stackoverflow.com/a/25471386

http://stackoverflow.com/a/25417542
upvote count: 4
answers question: http://stackoverflow.com/q/25417438
downvote count: 0
type: Answer
has body: Well, Integer.valueOf(String) returns an Integer and -1 is a primitive int. The first example is forced to unbox because one term is a primitive. You could also have used Integer boxedRsrq = boxedPci != null ? rsrqs.get(boxedPci.toString()) : (Integer) -1; which would have boxed the -1.
score: 4

http://stackoverflow.com/comment/39851511
has text: `isCellEditable()` can be reduced to `return col != 0`.
comment on: http://stackoverflow.com/q/25523036
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25464103
has comment: http://stackoverflow.com/comment/39736803
score: 5
has body: It may depend what component you are using (AMQP or RabbitMQ) for the communication. The single most important resource for sample code in Camel is the junit test cases in the source. Two files that does similar things to what you need are these two, but you may want to look around in the test cases in general to get inspiration: AMQPRouteTest.java RabbitMQConsumerIntTest.java A more "basic" way to make routes testable is to make the "from" uri a parameter. Let's say you make your RouteBuilder something like this: private String fromURI = "amqp:/.."; public void setFromURI(String fromURI){ this.fromURI = fromURI; } public void configure(){ from(fromURI).whatever(); } Then you can inject a "seda:foobar" endpoint in the fromURI before your start the unit test. The seda endpoint is trivial to test. This assumes you don't need to test AMQP/RabbitMQ specific constructs, but simply receive the payload.
has comment: http://stackoverflow.com/comment/39736664
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/39749094
has comment: http://stackoverflow.com/comment/39748834
has comment: http://stackoverflow.com/comment/39752926
answers question: http://stackoverflow.com/q/25463356
downvote count: 0
has comment: http://stackoverflow.com/comment/39742398
has comment: http://stackoverflow.com/comment/39737824
has comment: http://stackoverflow.com/comment/40009438

http://stackoverflow.com/comment/39850063
type: AnswerComment
score: 1
type: Comment
has text: Please see the second sentence.
comment on: http://stackoverflow.com/a/25524082

http://stackoverflow.com/comment/39749841
has text: does this help? http://stackoverflow.com/questions/7886462/get-row-count-of-a-resultset-in-java
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25471265

http://stackoverflow.com/q/25425681
has comment: http://stackoverflow.com/comment/39764281
has title: Record audio from two different microphones at the same time using threads in java
tagged with: audio
upvote count: 1
score: 1
has body: I would like to build an application that records sound from two USB microphones at the same time and store each of the recordings in a different file. So far I have managed to build the application to suit only one microphone and it works fine. Its structure is the following: read a configuration file find all mixers that support recording select the desired mixer according to the configuration file record the audio from the desired mixer to a byte array write the byte array to a file The first 3 steps appear in the application whether I want one or two microphones but I would like to start the recording for both microphones at the same time and also start writing each byte array on a separate thread as it is a bit time consuming and interfeering with the audio recording process, which is inside of a loop. This is what I have tried so far: recorder.readConfig(configFile); recorder.showAvailableMixers(); recorder.selectMixer(); while (true) { final byte[] audioBytes = recorder.recordAudio(recorder.firstMixer); new Thread() { @Override public void run() { try { Thread.sleep(1000); final byte[] audioBytes2 = recorder.recordAudio(recorder.secondMixer); recorder.writeToDisk(audioBytes2); } catch (InterruptedException | LineUnavailableException | IOException ex) { Logger.getLogger(ContinuousAudioRecording.class.getName()).log(Level.SEVERE, null, ex); } } }.start(); recorder.writeToDisk(audioBytes); } This is a somewhat simplified version as it does not use another thread for writing to disk. I introduced the 1s sleep because the files to which I write have their names strictly dependent on the current time so I wanted to avoid an overwrite. The program that I have written here introduces a major delay between the 2 recordings and I was expecting them to record almost the same sound(with a 1s difference). Can you please tell me what I am doing wrong or how should I approach this problem? I am new to using threads and I have spent all day long searching for tutorials and e…
tagged with: java
has comment: http://stackoverflow.com/comment/39740367
favorite count: 0
type: Question
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/a/25505196
has comment: http://stackoverflow.com/comment/39816768
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39815985
has comment: http://stackoverflow.com/comment/39813322
has comment: http://stackoverflow.com/comment/39817684
type: Answer
has comment: http://stackoverflow.com/comment/39813387
has comment: http://stackoverflow.com/comment/39815107
answers question: http://stackoverflow.com/q/25503619
score: 0
has comment: http://stackoverflow.com/comment/39815923
accepted answer of: http://stackoverflow.com/q/25503619
has comment: http://stackoverflow.com/comment/39816977
has body: You could use java StringTokenizer. Since your arraylist is already sorted, you only have to check consecutive positions. Use | as a delimiter, get the first token for each entry that contains a number and compare it to the first token of the following entry. If they are equal, get the index of the space in the last token and print what is after it. Be carefull to consider the case when more that 2 entries contain the same phone number, don't print them twice. But you might rethink your approach, the way you store the Strings in the ArrayList looks pretty messy. List&lt;String&gt; myList = new ArrayList(); myList.add("923119511824|DST:9900|CNT:1|OPR:zong|ADD RIDAsMs"); myList.add("923119511824|DST:9900|CNT:1|OPR:zong|ADD sMs"); myList.add("923125473547|DST:9900|CNT:1|OPR:zong|ADD SahafatMedia"); Collections.sort(myList); System.out.println(myList.toString()); for (int i = 0; i &lt; myList.size() - 1; i++) { String currentEntry = myList.get(i); String nextEntry = myList.get(i + 1); StringTokenizer tokenizer = new StringTokenizer(currentEntry, "|"); String currentNumber = tokenizer.nextToken(); tokenizer = new StringTokenizer(nextEntry, "|"); String nextNumber = tokenizer.nextToken(); String lastToken = ""; if (currentNumber.equals(nextNumber)) { System.out.println(currentNumber + " duplicate"); while (tokenizer.hasMoreTokens()) { lastToken = tokenizer.nextToken(); } System.out.println("last token: " + lastToken); int index = lastToken.indexOf(" "); System.out.println("What you probably want: " + lastToken.substring(index + 1)); } } And the output for this would be: [923119511824|DST:9900|CNT:1|OPR:zong|ADD RIDAsMs, 923119511824|DST:9900|CNT:1|OPR:zong|ADD sMs, 923125473547|DST:9900|CNT:1|OPR:zong|ADD SahafatMedia] 923119511824 duplicate last token: ADD sMs What you probably want: sMs

http://stackoverflow.com/comment/39608423
type: QuestionComment
comment on: http://stackoverflow.com/q/25395095
has text: @TheQuickBrownFox Could you rephrase? It's late and those words just aren't meaning anything to me.
score: 0
type: Comment

http://stackoverflow.com/q/25543040
has answer: http://stackoverflow.com/a/25543220
has comment: http://stackoverflow.com/comment/39882537
upvote count: 0
tagged with: layout
type: UnansweredQuestion
downvote count: 2
answer count: 1
tagged with: button
favorite count: 0
has title: how to implement a simple logo game like keyboard
has body: I am making a quiz game where the user has to enter the correct word via buttons which all have a letter on them. I want the buttons to display random letters although all of the letters required for the answer are there. Much like the text inputs for the logo quiz and 4 pics 1 word games. I have made an xml file which contains everything i need, i just need help to work out the java coding. To get the buttons with the correct answer letters mixed among other random letters is where i am having trouble. Would i somehow input the answer, then break it into indivudal letters, then asign each one to a button, then fill the remaining buttons with a random letter, and then randomise the layout? I am fairly new to programing, although have not come arcoss anything that has stopped me like this. Thanks in advance for your resopnse :D
score: -2
tagged with: android
tagged with: java
type: Question
tagged with: random

http://stackoverflow.com/a/25397291
has body: In this loop, there is a if-else statement and for the else part I don't understand why is it necessary. fileInput.hasNexInt() method returns true if int value found and than it performs adding operation. if next value is not int type than else part will perform where fileInput.next() will return next value(pointer will points after that value), performs nothing means escaping next value(which can be any type except int-type). Again if condition will check for int.
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25396662
has comment: http://stackoverflow.com/comment/39612827
downvote count: 0
has comment: http://stackoverflow.com/comment/39612573

http://stackoverflow.com/comment/39653038
score: 0
type: AnswerComment
has text: One issue i've just run into.. I need to use different JAR libraries (specifically LWUIT) for different platforms. AFAIK in Netbeans its not possible to use preprocessing to designate which JARs to use. Any thoughts?
type: Comment
comment on: http://stackoverflow.com/a/25419027

http://stackoverflow.com/comment/39681361
score: 0
type: Comment
type: AnswerComment
has text: Not to mention primitives `float` and `double` which are initialized to `0.0`
comment on: http://stackoverflow.com/a/25434449

http://stackoverflow.com/q/25472966
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25473007
answer count: 1
accepted answer: http://stackoverflow.com/a/25473007
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/9610921
duplicate of: http://stackoverflow.com/q/9610921
has body: I am writing a JavaScript Client Application that needs to communicate with Server. I tried to implement the API, but i stuck on one method and I need help. Infect i don't know how to translate this from Java to JavaScript (I don't know where to find analog libraries written in javascript that are used in this method): import java.security.SignatureException; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; /** * This class defines common routines for generating * authentication signatures for AWS requests. */ public class Signature { private static final String HMAC_SHA1_ALGORITHM = "HmacSHA1"; /** * Computes RFC 2104-compliant HMAC signature. * * @param data * The data to be signed. * @param key * The signing key. * @return * The Base64-encoded RFC 2104-compliant HMAC signature. * @throws * java.security.SignatureException when signature generation fails */ public static String calculateRFC2104HMAC(String data, String key) throws java.security.SignatureException { String result; try { // get an hmac_sha1 key from the raw key bytes SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), HMAC_SHA1_ALGORITHM); // get an hmac_sha1 Mac instance and initialize with the signing key Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM); mac.init(signingKey); // compute the hmac on input data bytes byte[] rawHmac = mac.doFinal(data.getBytes()); // base64-encode the hmac result = Encoding.EncodeBase64(rawHmac); } catch (Exception e) { throw new SignatureException("Failed to generate HMAC : " + e.getMessage()); } return result; } } This method is from AWS Documentations: Java Sample Code for Calculating HMAC-SHA1 Signatures I am asking if someone can give me some references (websites) where I can find solution or analog libraries, written in javascript. I searched AWS Documentation and SDK for JavaScript and I couldn't find translation in JS. Thanks very much in advance.
tagged with: javascript
has title: Calculate HMAC-SHA1 Signature using JavaScript
tagged with: amazon-web-services
upvote count: 4
score: 4
tagged with: hmacsha1
type: AnsweredQuestion

http://stackoverflow.com/q/25438681
tagged with: thread-safety
tagged with: concurrency
has comment: http://stackoverflow.com/comment/39689253
has title: Giving recovery time for an unsafely published java.lang.String
possible better answer: http://stackoverflow.com/a/25439180
has answer: http://stackoverflow.com/a/25439236
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25439180
answer count: 2
has comment: http://stackoverflow.com/comment/39689273
upvote count: 2
has comment: http://stackoverflow.com/comment/39689662
has comment: http://stackoverflow.com/comment/39689185
tagged with: java
has comment: http://stackoverflow.com/comment/39689068
tagged with: multithreading
downvote count: 0
accepted answer: http://stackoverflow.com/a/25439236
has body: java.lang.String is only effectively immutable. Brian Goetz of "Java Concurrency in Practice" said something like effectively immutable objects will only be thread safe if safely published. Now, say I unsafely publish String like this: public class MultiThreadingClass { private String myPath ="c:\\somepath"; //beginmt runs simultaneously on a single instance of MultiThreading class public void beginmt(){ Holder h = new Holder(); h.setPath(new File(myPath)); //line 6 h.begin(); } } public class Holder { private File path; public void setPath(File path){ this.path = path; } public void begin(){ System.out.println(path.getCanonicalPath()+"some string"); } } At the moment that the MultiThreadingClass is initializing with its constructor, it could happen that the File constructor on line 6 may not see the value of myPath. Then, about three seconds after the construction of the unsafely published String object, threads on MultiThreadingClass are still running. Could there still be a chance that the File constructor may not see the value of myPath?
tagged with: safe-publication
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39689608
has comment: http://stackoverflow.com/comment/39690115
has comment: http://stackoverflow.com/comment/39689239

http://stackoverflow.com/a/25454206
answers question: http://stackoverflow.com/q/25453916
score: 2
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25453916
downvote count: 0
type: Answer
has body: You can safely use classes like BufferedImage, Raster, DataBuffer and ImageIO in a headless environment. Classes and methods that can't be used in headless mode, are typically marked with: @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true. This typically includes Swing and AWT components, like windows, buttons, etc. See for example usages of HeadlessException for a list of methods and classes that has this limitation. Now that you know this, all you have to do, is get the "raw" RGB bytes into a BufferedImage using the setRGB(...) method, or accessing the DataBuffer's backing array directly. Multiple Q&amp;As about this are available on SO already (google for "creating a BufferedImage from bytes"). @rayryeng is of course correct in that you need to know the pixel layout and width/height of the image, to be able to reconstruct it. It would probably be easier for you, if the other developer could just send you the image in a known format, like PNG or similar. When you have a BufferedImage ready, write the image to the servlet output stream, using ImageIO like this: OutputStream out = ...; // the servlet or socket output stream BufferedImage image = ...; // the image you just created if (!ImageIO.write(image, "PNG", out)) { log.warn("Could not write image..."); }

http://stackoverflow.com/q/25423855
has answer: http://stackoverflow.com/a/25445201
has title: insert single data in data base but in data base duplicate row also added at time of insertion
answer count: 2
has comment: http://stackoverflow.com/comment/39701697
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25445246
downvote count: 1
favorite count: 0
type: Question
has body: I would like to insert single data in data base at a time but in data base duplicate row generate at a time. ----------------------------- Output(in mysql table=privilege) ----------------------------- id privilege 1 abc 2 abc Here's how I insert the data: public int addPrivilege(String privilege) { PreparedStatement preparedStatement = null; String sqlprivilege; Connection dbConnection = null; int pinsert = 0; try { sqlprivilege = "insert into privilege(privilege) values(?)"; dbConnection = ConnectionDao.getDBConnection(); preparedStatement = dbConnection.prepareStatement(sqlprivilege); preparedStatement.setString(1, privilege); pinsert = preparedStatement.executeUpdate(); if(preparedStatement.executeUpdate()==1) pinsert=1; else pinsert=0; System.out.println("privilege is add and name is:- " +privilege); } catch (SQLException e) { System.out.println(e.getMessage()); } finally { if (preparedStatement != null) { try { preparedStatement.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (dbConnection != null) { try { dbConnection.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return pinsert; }
tagged with: java
tagged with: jdbc
score: -1

http://stackoverflow.com/q/25415370
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/39646634
tagged with: string
has comment: http://stackoverflow.com/comment/39646720
has comment: http://stackoverflow.com/comment/39646660
accepted answer: http://stackoverflow.com/a/25434035
type: AnsweredQuestion
score: 0
has body: I am creating a Google App Engine server for a project where I receive a large quantity of data via an HTTP POST request. The data is separated into lines, with 200 characters per line. The number of lines can go into the hundreds, so 10's of thousands of characters total. What I want to do is concatenate all of those lines into a single Text object, since Strings have a maximum length of 500 characters but the Text object can be as large as 1MB. Here is what I thought of so far: public void doPost(HttpServletRequest req, HttpServletResponse resp) { ... String[] audioSampleData = new String[numberOfLines]; for (int i = 0; i &lt; numberOfLines; i++) { audioSampleData[i] = req.getReader().readLine(); } com.google.appengine.api.datastore.Text textAudioSampleData = new Text(audioSampleData[0] + audioSampleData[1] + ...); ... } But as you can see, I don't know how to do this without knowing the number of lines before-hand. Is there a way for me to iterate through the String indexes within the Text constructor? I can't seem to find anything on that. Of note is that the Text object can't be modified after being created, and it must have a String as parameter for the constructor. (Documentation here) Is there any way to this? I need all of the data in the String array in one Text object. Many Thanks!
has answer: http://stackoverflow.com/a/25434035
tagged with: java
has comment: http://stackoverflow.com/comment/39646609
possible better answer: http://stackoverflow.com/a/25415593
has comment: http://stackoverflow.com/comment/39646522
has answer: http://stackoverflow.com/a/25415593
type: Question
has title: How to create a datastore.Text object out of an array of dynamically created Strings?
has comment: http://stackoverflow.com/comment/39646578
answer count: 2
has comment: http://stackoverflow.com/comment/39646493
has comment: http://stackoverflow.com/comment/39646847

http://stackoverflow.com/comment/39806912
score: 0
has text: @Pphoenix Isn't it much easier to just declare a `serialVersionUID`? See [my answer](http://stackoverflow.com/questions/25501941/loading-serialized-class-from-file-when-class-has-changed-java-android/25502046#25502046)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25501941

http://stackoverflow.com/q/25537533
type: Question
linked to: http://stackoverflow.com/q/25535991
has comment: http://stackoverflow.com/comment/39877457
tagged with: jpa
has title: Hibernate - how to test sequence mapping and strategy in jUnit
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/39872892
has answer: http://stackoverflow.com/a/25548634
has comment: http://stackoverflow.com/comment/39872688
has body: What's the methodology of testing @SequenceGenerator from Hibernate? I want to be sure that every sequence is perfectly mapped, no mistake in spelling, and incrementing is done by 1. Is there any way to do this dynamically for all sequences? Here's the sample of my sequence mapping: @Column(name = "ADDRESS_ID", nullable = false, precision = 20) @Id @SequenceGenerator(name = "AddressSeq", sequenceName = "ADDRESS_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AddressSeq") private Long addressId;
score: 1
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/39905348
upvote count: 1
has comment: http://stackoverflow.com/comment/39891877
linked to: http://stackoverflow.com/q/520328
has comment: http://stackoverflow.com/comment/39872798
favorite count: 0

http://stackoverflow.com/comment/39767042
has text: Oh, by the way, when I stripped down you example, it works fine ;)
comment on: http://stackoverflow.com/q/25480357
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/34217660
score: 0
answers question: http://stackoverflow.com/q/25406915
type: Answer
has body: Try a clean build, Project -&gt; Clean It removes whatever already-compiled files are in your project so that you can do a complete fresh rebuild. Thus getting rid of the error in the config file.

http://stackoverflow.com/comment/39602121
score: 0
type: Comment
has text: google is your friend: "java keylogger" returned plenty of results.
type: QuestionComment
comment on: http://stackoverflow.com/q/25391863

http://stackoverflow.com/q/25414352
has comment: http://stackoverflow.com/comment/39646996
tagged with: android-4.4-kitkat
has answer: http://stackoverflow.com/a/29588566
possible better answer: http://stackoverflow.com/a/30789408
tagged with: android
tagged with: java
tagged with: sqlite
has answer: http://stackoverflow.com/a/30789408
score: 17
upvote count: 18
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39663018
answer count: 2
has body: In my application I store the path of image in my SQlite db for further use. The path that I get is content://com.android.providers.media.documents/document/image%3A71964 When I retrieve this path from the database and try to retrieve the image from that path android throws java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{42c84ec8 23911:com.gots.gb/u0a248} (pid=23911, uid=10248) requires android.permission.MANAGE_DOCUMENTS or android.permission.MANAGE_DOCUMENTS According https://developer.android.com/guide/topics/providers/document-provider.html#permissions I need to persist permission by adding the following code final int takeFlags = intent.getFlags() &amp; (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // Check for the freshest data. getContentResolver().takePersistableUriPermission(uri, takeFlags); When I added this code to my ImageAdapter class which extends BaseAdapter android throws 08-21 02:14:38.530: W/System.err(24452): java.lang.SecurityException: No permission grant found for UID 10248 and Uri content://com.android.providers.media.documents/document/image:71964 This is the relevant part of my ImageAdapter code public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView ; if (convertView == null){ imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(185, 185)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); } else{ imageView = (ImageView)convertView ; } InputStream is = null; Bitmap bitmap = null ; try { Log.d(TAG,String.valueOf(list.get(position))); Intent intent = new Intent(Intent.ACTION_GET_CONTENT); final int takeFlags = intent.getFlags() &amp; (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // Check for the freshest data. if (Build.VERSION.SDK_INT &gt;= 19){ mContext.getContentResolver()…
has comment: http://stackoverflow.com/comment/120429463
tagged with: storage-access-framework
downvote count: 1
has title: How to persist permission in android API 19 (KitKat)?
has comment: http://stackoverflow.com/comment/39653367
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/29588566

http://stackoverflow.com/q/25473710
has body: I have written a short Java code for solving a simple maze problem to go from S to G. I do not understand where the problem is going wrong. import java.util.Scanner; public class tester { static char [][] grid={ {'.','.'}, {'.','.'}, {'S','G'}, }; static int a=2; static int b=2; static boolean findpath(int x, int y) { if((x &gt; grid.length-1) || (y &gt; grid[0].length-1) || (x &lt; 0 || y &lt; 0)) { return false; } else if(x==a &amp;&amp; y==b){ return true; } else if (findpath(x,y-1) == true){ return true; } else if (findpath(x+1,y) == true){ return true; } else if (findpath(x,y+1) == true) { return true; } else if (findpath(x-1,y) == true){ return true; } return false; } public static void main(String[] args){ boolean result=findpath(2,0); System.out.print(result); } } I am giving the starting position directly and goal is defined in a &amp; b. Do help.
tagged with: recursion
score: 0
has answer: http://stackoverflow.com/a/25473933
has title: Recursive Maze in Java
tagged with: java
has comment: http://stackoverflow.com/comment/39754318
type: Question
tagged with: maze
answer count: 2
has answer: http://stackoverflow.com/a/25473898
type: UnansweredQuestion
tagged with: dictionary

http://stackoverflow.com/comment/39782351
comment on: http://stackoverflow.com/q/25488311
score: 0
type: Comment
type: QuestionComment
has text: Could you post your Spring configuration as well?

http://stackoverflow.com/comment/39789825
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25492648
has text: http://en.wikipedia.org/wiki/Timsort
type: Comment

http://stackoverflow.com/comment/39792239
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25493837
type: QuestionComment
has text: Which line of code is the exception occurring on? Are you sure it's one that you've shown here?

http://stackoverflow.com/q/25526134
type: AnsweredQuestion
has title: How to install android studio on usb drive without administrator
tagged with: batch-file
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39852552
accepted answer: http://stackoverflow.com/a/28396272
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39851216
possible better answer: http://stackoverflow.com/a/34892338
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/34892338
has answer: http://stackoverflow.com/a/28396272
has body: I have installed both a jdk and android studio on a usb drive, however android studio doesn't seem to want to launch from that jdk (it instead says none are installed), I have looked online and these solutions have been suggested: - Adding the JDK to my system path file, as I want to run this on a school computer that wont be possible, as you need admin - Changing the settings inside of android studio, given that i cant even get it to launch this is not an option - I have tried to add something to the studio.bat, but I probably got it wrong, and it didn't work. I think the most promising option is to add it to studio.bat, would any of you know how to do this (the jdk is located in the same drive but in/jdk no/AndroidStudio)? I would be open to other options that don't require admin permission. I have poked around and I think this would be a solution but i can't work out how: I need to add E:\JDK7 as my JAVA_HOME to this file (studio.bat): IF EXIST "%ANDROID_STUDIO_JDK%" SET JDK=%ANDROID_STUDIO_JDK% IF NOT "%JDK%" == "" GOTO jdk IF EXIST "%~dp0\..\jre" SET JDK=%~dp0\..\jre IF NOT "%JDK%" == "" GOTO jdk IF EXIST "%JDK_HOME%" SET JDK=%JDK_HOME% IF NOT "%JDK%" == "" GOTO jdk IF EXIST "%JAVA_HOME%" SET JDK=%JAVA_HOME% IF "%JDK%" == "" GOTO error :jdk SET JAVA_EXE=%JDK%\bin\java.exe IF NOT EXIST "%JAVA_EXE%" SET JAVA_EXE=%JDK%\jre\bin\java.exe IF NOT EXIST "%JAVA_EXE%" GOTO error SET JRE=%JDK% IF EXIST "%JRE%\jre" SET JRE=%JDK%\jre SET BITS= IF EXIST "%JRE%\lib\amd64" SET BITS=64 I have tried adding this to the file (below IF EXIST "%JAVA_HOME): IF NOT "%JDK%" == "" GOTO jdk IF EXIST "E:\JDK7" SET JDK=E:\JDK7
tagged with: android
tagged with: path
tagged with: android-studio

http://stackoverflow.com/comment/39797700
score: 0
comment on: http://stackoverflow.com/q/25496859
type: Comment
type: QuestionComment
has text: Check [How to sort a Map<Key, Value> on the values in Java?](http://stackoverflow.com/questions/109383/how-to-sort-a-mapkey-value-on-the-values-in-java).

http://stackoverflow.com/a/25505782
score: 0
answers question: http://stackoverflow.com/q/25505028
has body: Do I need to create a JNDI DataSource now? This is not mandatory but also favored. You can access your db like an object. (jndi/YourDatasource) If this is the correct steps thus far; What steps are performed next? My assumption is that the web.xml needs to be configured so that it links to the JNDI DataSource? Is this correct? App server can be different in this situation. web.xml is a choice or sun-resources.xml
type: Answer

http://stackoverflow.com/q/25444478
has answer: http://stackoverflow.com/a/25444701
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: html5-audio
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
has body: In my web-application, I have various audio clips uploaded by the users in the database stored in the BLOB column. The audio files are low bit rate WAV files. The clips are secured, one can see only those clips he has uploaded. Instead of user downloading the clip and playing it in his player, I need it be steamed online in the web page itself. In the jsp I use the &lt;audio&gt; tag with the source mapping to the controller mappping url. &lt;td&gt; &lt;audio controls&gt;&lt;source src="recfile/${au.id}" type="audio/mpeg" /&gt;&lt;/audio&gt; &lt;/td&gt; Where, the recfile is the request mapping and the au.id is the audio id. In the controller I process the request like below @RequestMapping(value = "/recfile/{id}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_OCTET_STREAM_VALUE }) public HttpEntity&lt;byte[]&gt; downloadRecipientFile(@PathVariable("id") int id, ModelMap model, HttpServletResponse response) throws IOException, ServletException { LOGGER.debug("[GroupListController downloadRecipientFile]"); VoiceAudioLibrary dGroup = audioClipService.findAudioClip(id); if (dGroup == null || dGroup.getAudioData() == null || dGroup.getAudioData().length &lt;= 0) { throw new ServletException("No clip found/clip has not data, id=" + id); } HttpHeaders header = new HttpHeaders(); I tried this too //header.setContentType(new MediaType("audio", "mp3")); header.setContentType(new MediaType("audio", "vnd.wave"); header.setContentLength(dGroup.getAudioData().length); return new HttpEntity&lt;byte[]&gt;(dGroup.getAudioData(), header); } When the jsp loads, the controller get the request, it serves back the audio data fetched from the database, the jsp too shows the player with the controls. But when I play it nothing happens. Why is it? Am I missing anything in the configuration? Am I doing it right?
has title: Play audio file data - Spring MVC
accepted answer: http://stackoverflow.com/a/25444701
has comment: http://stackoverflow.com/comment/39699548
tagged with: spring

http://stackoverflow.com/comment/39762625
type: Comment
score: 0
type: QuestionComment
has text: Thanks for the explanation. What would I need to change so that it does not fail?
comment on: http://stackoverflow.com/q/25478129

http://stackoverflow.com/comment/39764260
type: AnswerComment
score: 0
has text: @Quzziy you can't convert `null` to `int`. you should use validation. check my updated answer.
type: Comment
comment on: http://stackoverflow.com/a/25478911

http://stackoverflow.com/q/25465322
has answer: http://stackoverflow.com/a/25465378
has answer: http://stackoverflow.com/a/25465351
score: -7
type: AnsweredQuestion
has title: The syntax of the method
tagged with: java
tagged with: loops
tagged with: methods
downvote count: 7
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39738687
upvote count: 0
possible better answer: http://stackoverflow.com/a/25465378
accepted answer: http://stackoverflow.com/a/25465351
has body: Want to find out the point of describing method in parentheses that way, unknown "v" variable and interesting form of loop. public static double findMax(double...values) { double largest = Double.MIN_VALUE; for(double v : values) if(v &gt; largest) largest = v; return largest; }

http://stackoverflow.com/comment/39673647
comment on: http://stackoverflow.com/a/25416067
score: 0
type: Comment
has text: How difficult do you think it'd be to override `draw()`? Do you know of any examples that do so?
type: AnswerComment

http://stackoverflow.com/a/25397335
has body: Neither. An interface does not provide an implementation. The method called will be that declared and implemented in C.
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25397317

http://stackoverflow.com/q/25541152
answer count: 2
accepted answer: http://stackoverflow.com/a/25541267
tagged with: reflection
has answer: http://stackoverflow.com/a/25541267
has body: Method method; try { method = m.getClass().getMethod(h); } catch (SecurityException e) { } catch (NoSuchMethodException e) { } try { //line below wants me to initialize it method.invoke(m); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } This code is in a while loop. When I sett Method method to null i get a null point exception. How can I make my code run in my while loop.
has title: How to do a reflection in a while loop without initializing it
possible better answer: http://stackoverflow.com/a/25541184
tagged with: methods
type: Question
score: 0
tagged with: invoke
tagged with: java
tagged with: initialization
has answer: http://stackoverflow.com/a/25541184
type: AnsweredQuestion

http://stackoverflow.com/comment/39891600
type: Comment
type: QuestionComment
has text: @Fildor Correct, using a db is currently no option
comment on: http://stackoverflow.com/q/25548192
score: 0

http://stackoverflow.com/tag/jpeg
tags question: http://stackoverflow.com/q/25453916
type: Tag
tag name: jpeg

http://stackoverflow.com/comment/79986314
type: AnswerComment
comment on: http://stackoverflow.com/a/25456834
score: 2
type: Comment
has text: Is there like an api for handling dll in java - for instance where you can loop through all the possible command (methods) to see what the dll contains?

http://stackoverflow.com/comment/39732255
type: QuestionComment
has text: @ErstwhileIII If you are referring to my comment then consider adding `@Pshemo` before it to be explicit (for now it looks like your comment is for OP, which kind of doesn't make sense because there is no code in the question). If that is the case then you may or may not be right because as currently written this question is unclear and we can't know what OP wants: IMHO "synchronized class" is little different than "synchronization ON class".
comment on: http://stackoverflow.com/q/25461751
score: 0
type: Comment

http://stackoverflow.com/q/25540803
upvote count: 0
has comment: http://stackoverflow.com/comment/39878749
score: -1
tagged with: collections
downvote count: 1
has comment: http://stackoverflow.com/comment/39878515
accepted answer: http://stackoverflow.com/a/25541064
has title: LinkedList within a for doesn't work
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25541064
tagged with: java
possible better answer: http://stackoverflow.com/a/25540935
has body: If I run the lines all be good. but if I run it there is a problem: java.lang.ArrayIndexOutOfBoundsException: 2 I don't understand how can there be a error if the code is doing what I wrote. i=0 | y=0 i=0 | y=1 i=0 | y=2 Error EN HILO: java.lang.ArrayIndexOutOfBoundsException: 2 Before these lines, I work with matrix in those lines, but I don't think that this affect the program.
tagged with: string
has answer: http://stackoverflow.com/a/25540935
favorite count: 0
type: Question
answer count: 2
tagged with: vector

http://stackoverflow.com/comment/39660669
has text: @DiegoFernandoMurilloValenci Are you still weaving with aspectj plugin?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25414725
type: AnswerComment

http://stackoverflow.com/a/36943851
downvote count: 1
has body: Regarding the ThreadLocal solution I would like to add that there is probably a thread pool in your web server (for ex: Tomcat) and your thread local variable won't actually be cleared upon completion of each request as processing threads don't die with a thread pool enabled. You need to clear the thread-local variable (threadLocal.remove()) manually upon complection of each request. For that you can use, for example, some kind of afterCompletion() of some of those Spring request/response interceptors.
answers question: http://stackoverflow.com/q/25406157
has comment: http://stackoverflow.com/comment/88638208
type: Answer
has comment: http://stackoverflow.com/comment/73456344
has comment: http://stackoverflow.com/comment/107450390
has comment: http://stackoverflow.com/comment/95910316
score: 20
has comment: http://stackoverflow.com/comment/113417456
upvote count: 21

http://stackoverflow.com/a/25568498
has body: I had same problem after switch from Windows to Linux. I found simulair bug https://liquibase.jira.com/browse/CORE-1943 I configured nss-myhostname and this error was gone.
score: 0
has comment: http://stackoverflow.com/comment/39964672
answers question: http://stackoverflow.com/q/25544993
type: Answer
has comment: http://stackoverflow.com/comment/40015433
has comment: http://stackoverflow.com/comment/39988171

http://stackoverflow.com/comment/39693432
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25440431
type: QuestionComment
has text: Please remve the if(!value.equals(fullpath)) ,i have kept that for Testing purpose.

http://stackoverflow.com/comment/39752751
type: QuestionComment
has text: Order is doGet > paymentStart.jsp > doConfirm > paymentConfirm.jsp > doPost
score: 0
comment on: http://stackoverflow.com/q/25466946
type: Comment

http://stackoverflow.com/comment/39725773
has text: Add @Override in doInBackground() method and type "System.out.println("I am running says onPostExecute");" after adapter.notifyDataSetChanged()
type: QuestionComment
comment on: http://stackoverflow.com/q/25457973
type: Comment
score: 0

http://stackoverflow.com/a/25475423
score: 0
has body: Add a check for null intent: if (getIntent() != null) { line = (String) getIntent().getSerializableExtra(TAG); } else { Log.e("TAG","Intent was null"); }
type: Answer
answers question: http://stackoverflow.com/q/25475344

http://stackoverflow.com/q/25465912
favorite count: 0
type: Question
duplicate of: http://stackoverflow.com/q/13363952
has answer: http://stackoverflow.com/a/25465919
has title: In the below code, Even "synchronized" keyword is used , the threads are not synchronizing, Why?
tagged with: java
tagged with: runnable
score: -1
has body: class A implements Runnable //Thread class { public void run() { read(); } public synchronized void read() { for(int i= 0 ; i&lt; 7 ;i++) System.out.println(Thread.currentThread().getName() + " " + i); } } public class Main { public static void main(String[] args) { Thread t = new Thread(new A()); t.setName("t1"); Thread c = new Thread(new A()); c.setName("t2"); t.start(); c.start(); } output:
has comment: http://stackoverflow.com/comment/39739911
answer count: 2
type: UnansweredQuestion
downvote count: 2
tagged with: multithreading
linked to: http://stackoverflow.com/q/13363952
upvote count: 1
has answer: http://stackoverflow.com/a/25465924
tagged with: synchronized

http://stackoverflow.com/q/25505725
has body: I have a client program in java that sends a message "Hello" to python server. Java code import java.io.*; import java.net.*; public class MyClient { public static void main(String[] args) { try{ Socket soc=new Socket("localhost",2004); DataOutputStream dout=new DataOutputStream(soc.getOutputStream()); dout.writeUTF("Hello"); dout.flush(); dout.close(); soc.close(); }catch(Exception e){ e.printStackTrace();} } Python server code import socket # Import socket module soc = socket.socket() # Create a socket object host = "localhost" # Get local machine name port = 2004 # Reserve a port for your service. soc.bind((host, port)) # Bind to the port soc.listen(5) # Now wait for client connection. while True: conn, addr = soc.accept() # Establish connection with client. print ("Got connection from",addr) msg = conn.recv(1024) print (msg) if ( msg == "Hello Server" ): print("Hii everyone") else: print("Go away") the problem is that java client is able to send a Hello message to the python server but in python side else statement always executes with output " Go away".python version 2.7 Output: ('Got connection from', ('127.0.0.1', 25214)) Hello Go away
has comment: http://stackoverflow.com/comment/96675305
has answer: http://stackoverflow.com/a/78758132
favorite count: 0
has answer: http://stackoverflow.com/a/54955227
type: Question
has answer: http://stackoverflow.com/a/25505765
tagged with: if-statement
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/53997201
tagged with: python
answer count: 6
has answer: http://stackoverflow.com/a/40843617
tagged with: python-2.7
has title: Java client python server socket programming
has answer: http://stackoverflow.com/a/38355897
downvote count: 0
score: 1
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/133608608
type: AnswerComment
has text: And again an other solution that [does not work](https://www.ideone.com/3Xv5Jo).
type: Comment
comment on: http://stackoverflow.com/a/75738217
score: 0

http://stackoverflow.com/q/25496349
has title: JAVA: Trying to change an object without making a new object
has comment: http://stackoverflow.com/comment/39796756
favorite count: 0
type: Question
tagged with: object
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25496367
answer count: 2
has answer: http://stackoverflow.com/a/25496374
tagged with: point
score: 1
tagged with: java
downvote count: 0
has body: I am working with a Point object that has an x and y component, Point(double x, double y). I want to write a function that changes the values of the x and y component without having a new Point p = ... For Example, this is my current version: public class Point{ private double x, y; public Point(double x, double y) { this.x = x; this.y = y; } public Point movePoint(double dx, double dy) { return new Point(this.x + dx, this.y + dy); } } Is it possible to do something like movePoint() without making a new Point? Thanks in advance.
upvote count: 1

http://stackoverflow.com/comment/39812230
has text: yes bro, do u know about that
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25504999

http://stackoverflow.com/comment/39815430
type: Comment
has text: Or a `SwingWorker`, see [Worker Threads and SwingWorker](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html) for more details
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/25506234

http://stackoverflow.com/comment/39650517
has text: Same, A page value is not replaced, hmm ... i remove form action and onSubmit, added this function `onclick="visitPage();` in B page button and javascript function `function visitPage() { var A = document.mainform.NAME_1.value; var B = "<%=ETYPE%>"; window.parent.location.href = "A.jsp?NAME_1="+A+"&ETYPE="+B; window.close(); }`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25417583
score: 0

http://stackoverflow.com/comment/39817613
type: QuestionComment
comment on: http://stackoverflow.com/q/25507584
type: Comment
score: 0
has text: Looks like a classpath issue?

http://stackoverflow.com/q/25475004
has answer: http://stackoverflow.com/a/25480344
has answer: http://stackoverflow.com/a/25475319
answer count: 2
tagged with: java
upvote count: 1
score: 1
favorite count: 0
type: Question
tagged with: reverse-proxy
tagged with: nginx
type: UnansweredQuestion
has title: Can a Tomcat web application tell a load balancer its Tomcat is down?
tagged with: load-balancing
downvote count: 0
tagged with: tomcat
has body: I have two Tomcat servers deployed behind an Nginx load balancer that's using proxy_pass to route the requests. This works well, but there is now an use case in my application for which I need to pull one of the servers out of the cluster (but keep it running), have the web application on it do something and when that's done place the Tomcat back. Right now I'm reloading the Nginx configuration manually and mark the server down to give time to the application to do its thing, but what I would like is have the web application "trick" Nginx that its Tomcat server is down, do it's stuff, then rejoin the cluster. I'm thinking that I need to have some custom Tomcat Connector that's controlled by the web application but everything online is about proxying with Apache or using AJP and that's not what I need, I need this to be a HTTP proxy with Nginx. Anyone has some pointers on how I might go about doing this?

http://stackoverflow.com/a/25414382
downvote count: 0
answers question: http://stackoverflow.com/q/25414324
has body: Store the HttpRequest object in a variable HttpRequest request = HttpRequest.get("http://google.com"); Invoke what you need request.body(); request.code(); (It's weird to get the response body on a request object...I don't like this library.)
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/25414324
has comment: http://stackoverflow.com/comment/39644718
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/a/25420791
answers question: http://stackoverflow.com/q/25420660
type: Answer
has body: You can use an HTML parser, e.g. jsoup.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25420660

http://stackoverflow.com/comment/39831861
type: Comment
comment on: http://stackoverflow.com/a/25514818
score: 0
type: AnswerComment
has text: If I add `@Enumerated(EnumType.ORDINAL)`, then `setParameter` is working fine but the `setString` is throwing error as `ERROR: ORA-01722: invalid number`

http://stackoverflow.com/q/25391409
possible better answer: http://stackoverflow.com/a/25391503
tagged with: java
has answer: http://stackoverflow.com/a/25391483
has title: mysql preparedStatement : sql query
tagged with: mysql
answer count: 2
tagged with: sql
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25391503
tagged with: glassfish
has body: I have a preparedStatement for select query in mySQL. this is what I wrote: String sQuery = "SELECT Password FROM test WHERE Email = ?"; st = DB.prepareStatement(sQuery); st.setString(1, email); ResultSet rs = st.executeQuery(sQuery); but i'm getting an exception from the glassfish server that says: Severe: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1 I don't understand what is the problem.. all the samples i saw, use that syntax..
tagged with: prepared-statement
favorite count: 0
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25391483
score: 1

http://stackoverflow.com/a/25409438
score: 2
downvote count: 0
type: AcceptedAnswer
has body: you can use String.valeuOf(Tburn)
accepted answer of: http://stackoverflow.com/q/25409410
answers question: http://stackoverflow.com/q/25409410
type: Answer
upvote count: 2

http://stackoverflow.com/q/25454494
accepted answer: http://stackoverflow.com/a/25469632
score: 1
upvote count: 1
tagged with: java
tagged with: guice
answer count: 1
tagged with: junit
tagged with: httpclient
has body: I am new to guice and injections. Need a help in writing the unit test. I have a method that fetches a session token by making a GET request String strTemp = ""; String sessionToken = "" ; HttpResponse response; try { String url = String.format(URL_SESSION, email); HttpGet request = new HttpGet(url); response = client.execute(request); } catch (Throwable e) { LOG.error("Could not reach to the Server"); throw new ExecutionException(e, "Could not reach to the Server") .withReason(Throwables.getRootCause(e).getMessage()) .withResolution("Check if the outbound Port is open and you can reach the Rapportive service"); } In my unit test I wanna Inject the HttpClient to get a mock response. I have written a Mock Class public abstract class MockHttpRequestBadQuery implements HttpClient { protected HttpResponse execute(HttpGet httpUriRequest) throws IOException { HttpResponse httpResponse = new BasicHttpResponse(new StatusLine() { @Override public ProtocolVersion getProtocolVersion() { return new ProtocolVersion("HTTP/1.1", 0, 0); } @Override public int getStatusCode() { return 400; } @Override public String getReasonPhrase() { return "Bad Request"; } }); HttpEntity entity = new StringEntity("{\"message\":\"\\n" + "SELECT badFieldName FROM Account\\n" + " ^\\n" + "ERROR at Row:1:Column:8\\n" + "No such column \'badFieldName\' on entity \'Account\'. If you are attempting to use" + " a custom field, be sure to append the \'__c\' after the custom field name. Please" + " reference your WSDL or the describe call for the appropriate names.\"," + " \"errorCode\":\"INVALID_FIELD\"}"); httpResponse.setEntity(entity); httpResponse.setHeader("Content-Type", "application/json;charset=UTF-8"); httpResponse.setHeader("Date", "Tue, 28 May 2013 16:06:21 GMT"); httpResponse.setHeader("Transfer-Encoding", "chunked"); return httpResponse; } } I need help in how to inject so that whenever client.execute() is called, a mock response is generated.
favorite count: 0
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/25469632
has title: Inject HttpClient to get mock response in Java using GUICE
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/39784992
score: 0
type: Comment
type: AnswerComment
has text: i'm blocked and cannot ask more question :(
comment on: http://stackoverflow.com/a/25482827

http://stackoverflow.com/comment/39859868
type: Comment
has text: C11 (n1570) 6.5.7 p.5 "The result of `E1 << E2` is `E1` left-shifted `E2` bit positions; vacated bits are filled with zeros. [...] If E1 has a signed type and nonnegative value, and E1 × 2**E2 is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined."
comment on: http://stackoverflow.com/a/25530399
type: AnswerComment
score: 0

http://stackoverflow.com/q/25492216
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25502968
type: Question
has answer: http://stackoverflow.com/a/25492310
tagged with: ant
tagged with: java
tagged with: jboss
tagged with: eclipse
has title: Create WAR using ANT compatible with JBOSS
has body: i want to know if its possible to generate a war using Ant. Nowadays we are using Eclipse to create the War( File -> Export -> War),but I did an Ant script that create a War but it's not compatible with Jboss. &lt;zip destfile="${docflow4-web-home}/deploy/${nome}.war"&gt; &lt;zipfileset dir="${docflow4-web-home}/web" /&gt; &lt;/zip&gt;
answer count: 2
possible better answer: http://stackoverflow.com/a/25492310
has answer: http://stackoverflow.com/a/25502968

http://stackoverflow.com/a/25440622
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25440562
score: 5
accepted answer of: http://stackoverflow.com/q/25440562
type: AcceptedAnswer
downvote count: 0
has body: (int)Math.random()*100; means: cast the value of 'Math.random()' to int and then multiple by 100. Since Math.random returns a number between 0 and 1 casting to int will always chop off the decimal path and give you 0. The correct way to do it is (int)(Math.random()*100);

http://stackoverflow.com/comment/39616789
comment on: http://stackoverflow.com/q/25396488
has text: How do you manage to minimize the application at all? Do you do that from code?
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/25486379
has comment: http://stackoverflow.com/comment/39801967
has body: The problem with your code is this check: if (ch == 'O') { if (!((inp.charAt(i + 1)) == 'X' || (inp.charAt(i - 1)) == 'X')) { count++ } } Here you check for only a case where there is O not surrounded by X. But this check doesn't work for cases like *OOXOO*. You'll get 2 but the result is 0. So the solution is to do it in loop or using regexp. Examples are shown below. Also you did that: inp = "." + inp + "."; which I think is not needed. I'm guessing you did that because you were getting ArrayIndexOutOfBoundsException while looping for i = 0. The solution you proposed works, but you could also add check in the loop for (i&gt;0) or start from 1 and check behind + front (see examples below). If you don't require a loop with array then you can use a simple regex: testString = testString.replaceAll("[O]+X","X").replaceAll("X[O]+", "X"); The whole test-program: public class Main { public static void main(final String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter Test String: "); String testString = br.readLine(); testString = "." + testString + "."; testString = testString.replaceAll("[O]+X","X").replaceAll("X[O]+", "X"); int count = testString.length() - testString.replace("O", "").length(); System.out.println("Result string: " + testString); System.out.println("Total 'O' left: " + count); } } Test1: Enter Test String: *OOX*XOX*OO*XO*O*X*OX*XO*O* Result string: .*X*XX*OO*X*O*X*X*X*O*. Total 'O' left: 4 Test2: Enter Test String: *OOXOO*OO Result string: .*X*OO. Total 'O' left: 2 Test3: Enter Test String: *O*OXOO*OO Result string: .*O*X*OO. Total 'O' left: 3 EDIT Below there are 3 types of solutions to your problem: public class Main { private BufferedReader userInput; private String testString; public static void main(final String args[]) { BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in)); //get the reader. Main test = new Main(userInput); //create an object o…
answers question: http://stackoverflow.com/q/25474272
has comment: http://stackoverflow.com/comment/39787559
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39801678
score: 0
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25474272

http://stackoverflow.com/q/25515641
has title: Two buttons and webView between them
tagged with: webview
type: Question
has comment: http://stackoverflow.com/comment/39833066
has body: How is the best way to add in layout two buttons (on top and on bottom) and webView between them? I try: <WebView android:id="@+id/webView" android:layout_width="match_parent" android:layout_height="350dp" android:layout_below="@+id/first" android:layout_centerHorizontal="true" /> But this show me only first button and WebView. Maybe for height is better way than 350dp? How can I make it?
accepted answer: http://stackoverflow.com/a/25515752
has comment: http://stackoverflow.com/comment/39833116
tagged with: android
has answer: http://stackoverflow.com/a/25515752
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/25486381
accepted answer: http://stackoverflow.com/a/25486465
has title: Selenium web driver fill fields save output
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25486465
score: 1
tagged with: java
has body: I am absolutly new in selenium so sorry for the noob question. But i couldnt find it in google. So, I have a simple javacode : public static void main(String[] args) throws Exception { // The Firefox driver supports javascript WebDriver driver = new FirefoxDriver(); // Go to the Google Suggest home page driver.get("http://tudakozo.telekom.hu/main?xml=main&amp;xsl=main"); // Enter the query string "Cheese" WebElement query = driver.findElement(By.xpath("id('searchByName')/x:input[2]")); the webpage btw : [link][1] I want to fill the left boxes. To do so I want some selenium commands : s.fill(and here xpath, "fill with text") For xpath i use firefox plugin and find xpath: i cant post image so heres a link : http://tinypic.com/view.php?pic=5poglt&amp;s=8#.U_sw-vl_tVY Then I will get somecapthca breaker Its in the local future but if oyu have suggestion i take it :) Anyway than i need to download the pics and manually fill it. Than click the "keresés" button xpoath: id('searchByName')/x:input[2] but in the first step i fail, and i cant check that is the seleinum (JAVA) filled the field? ** So the main question how can i fill the fields, download a pics through xpath in selenium (JAVA), than save the output** example : *név*(name) :first field : **Szabó István** and *Település*(city)/the field where there is a little pink text/ : **Gyula**
type: Question
tagged with: xpath
downvote count: 0
answer count: 1
tagged with: selenium
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39754761
comment on: http://stackoverflow.com/a/25473636
score: 0
type: AnswerComment
has text: ok, I understand, but... I still need the constructor?, there is something that I need to correct in my code?
type: Comment

http://stackoverflow.com/comment/39825529
type: QuestionComment
comment on: http://stackoverflow.com/q/25511795
type: Comment
score: 0
has text: @NiekHaarman I think that's only half the problem, since 20/25 is already 0.

http://stackoverflow.com/a/25425946
type: Answer
has body: A bit more involved, but here's one approach: in your main() method define another application context along the one you are already creating. The idea is that you are defining a List where the command line arguments will be stored and define this list as a bean (with the id args) in this application context: public static void main(String[] args) { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); BeanDefinition beanDefinition = BeanDefinitionBuilder .rootBeanDefinition(Arrays.class, "asList") .addConstructorArgValue(args) .getBeanDefinition(); beanFactory.registerBeanDefinition("args", beanDefinition); GenericApplicationContext parentContext= new GenericApplicationContext(beanFactory); parentContext.refresh(); ... } Use the previously defined application context as a parent for the application context you already have in your main() method. Assuming you are creating a ClassPathXmlApplicationContext this would be the code: ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( new String[] { "app-context.xml" }, parentContext); where parentContext is the context created previously to hold the List of arguments. then, in your xml, you'd use SPeL to easily access the list of arguments: &lt;bean id="a" class="com.foo.bar.ClassA"&gt; &lt;property name="prop1" value="#{args[0]}" /&gt; &lt;/bean&gt; &lt;bean id="b" class="com.foo.bar.ClassB"&gt; &lt;property name="prop2" ref="a" /&gt; &lt;/bean&gt; notice in xml the name of the argument used in the SPeL expression is args which is the exact name used to define the List in the parentContext.
accepted answer of: http://stackoverflow.com/q/25423148
upvote count: 4
answers question: http://stackoverflow.com/q/25423148
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/q/25419941
tagged with: sockets
has title: JFrame blocked after creating socket connection
has answer: http://stackoverflow.com/a/25420058
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/39654095
has comment: http://stackoverflow.com/comment/39654101
has answer: http://stackoverflow.com/a/25420043
score: 0
tagged with: java
answer count: 3
has body: so i've been trying to learn about sockets, and was trying to create a simple chat app where i have 2 JFrames and each connects to socket, the problem is that every time i run the JFrames the frames start correctly, but when i click on the connect_button the socket starts connection but doesn't let me continue with the operations, everything is blocked from this point forward, i've been realy trying to understand but im stuck here, any thoughts ? i think my problem is that the sockets should go in their own Threads, but i've seen other solutions and seen that they don't implement Threads, or at least in the code that they show. maybe my socket connection is implemented incorrectly. ¿Is it wrong to use PrintStream if so, is it still posible to use this class to proceed with this excercise and which Stream class should i use ? Taking into count that i understand that bufferedStreams are the way to go if you want efficiency
upvote count: 1
has answer: http://stackoverflow.com/a/25420052
downvote count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/39762762
has text: However, on accepting the input with the scanner class it gives the Time Limit Exceeded error.
type: AnswerComment
comment on: http://stackoverflow.com/a/25472726
score: 0
type: Comment

http://stackoverflow.com/q/25525581
has answer: http://stackoverflow.com/a/25525700
accepted answer: http://stackoverflow.com/a/25525700
answer count: 1
tagged with: maven
tagged with: suppress-warnings
tagged with: findbugs
type: AnsweredQuestion
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39875956
tagged with: java
has body: I want to suppress a single Findbug warning ("passes a nonconstant String to an execute method on an SQL statement") by entering this line before the beginning of the method: @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = {"SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE", "SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING" }, justification = "just a test") But Eclipse keeps saying that edu cannot be resolved to a type and The attribute justification is undefined for the annotation type SuppressWarnings. In the findbugs documentation i read that I have to add the annotations.jar and jsr305.jar in Java Build Path (in Project Propertes). But in the findbugs folder I cant find any .jar file. Only findbugs.xml, findbugs-excludes.xml and so on. What can I do to get this running? I Use Findbugs maven plugin 2.5.2. Thank you very much!
has title: Suppressing findbugs warning Step by Step
tagged with: maven-2
favorite count: 0
type: Question
downvote count: 0

http://stackoverflow.com/q/25488896
score: 0
answer count: 1
has body: i want to get each instance for each object, i must check if one item is instance of the object, and then get the value, i have: @Override public void onSelection(SelectionEvent&lt;TreeItem&gt; event) { TreeItem item=event.getSelectedItem(); if(firstGroup instanceOf TreeItem ) { Sun first=(Sun) item.getUserObject(); ....; } else if(secondGroup instanceOf TreeItem) { Wall second=(Wall) item.getUserObject(); ...; } else if(thirdGroup instanceOf TreeItem) { Sky third=(Sky) item.getUserObject(); ...; } but here work only the first if, and others don't. I need to get all values, can you please suggest me what i'm doing wrong?
type: Question
accepted answer: http://stackoverflow.com/a/25488921
type: AnsweredQuestion
has title: Check and get the values of the objects
has answer: http://stackoverflow.com/a/25488921
tagged with: java

http://stackoverflow.com/q/25528710
has title: What's wrong with my split() and its regex?
tagged with: double
tagged with: regex
score: 4
has answer: http://stackoverflow.com/a/25528812
has answer: http://stackoverflow.com/a/25528814
accepted answer: http://stackoverflow.com/a/25528755
has comment: http://stackoverflow.com/comment/39855871
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25528755
answer count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/25528812
downvote count: 0
tagged with: string
has body: Part of my application I encountered this problem. The String line variable contains 12.2 Andrew and I'm trying to split them separately but it doesn't work and comes with a NumberFormatException error. Could you guys help me on that please? String line = "12.2 Andrew"; String[] data = line.split("(?&lt;=\\d)(?=[a-zA-Z])"); System.out.println(Double.valueOf.(data[0]));
linked to: http://stackoverflow.com/q/25485260
favorite count: 0
type: Question
upvote count: 4
tagged with: split

http://stackoverflow.com/comment/39996142
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25548148
score: 0
has text: @SteveWaldman So what do you suggest as you can see the threads are not getting killed.Why?

http://stackoverflow.com/comment/39826319
has text: Oh i see what you are saying. Thanks :)
comment on: http://stackoverflow.com/a/25510495
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39869285
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25535289
has text: The [Oracle documentation](http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/java.html) mentions `SIGINT` and `abrupt termination` in the same breath. You're also aware that shutdown hooks may never be called right ?

http://stackoverflow.com/q/25468270
answer count: 6
has answer: http://stackoverflow.com/a/25471310
has answer: http://stackoverflow.com/a/25469792
has comment: http://stackoverflow.com/comment/39744330
score: 1
has comment: http://stackoverflow.com/comment/39749836
has answer: http://stackoverflow.com/a/68053007
tagged with: java
has comment: http://stackoverflow.com/comment/39744547
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/68869520
has body: I've just started learning LibGDX and I'm taking it very slowly. I've looked at numerous tutorials for how to add a background images to a game but most of them are outdated or too difficult for a beginner like me. Below is what I have tried to get the image to display. texture = new Texture(Gdx.files.internal("background.jpg")); backgroundTexture = new TextureRegion(texture, 0, 0, 2048, 563) Unfortunately, It didn't work. I ran the application and the screen was still black and plain. Like I said, I'm new at this so please make you explanation as simple as possible.
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/66739876
has answer: http://stackoverflow.com/a/27744525
type: UnansweredQuestion
tagged with: libgdx
tagged with: android
has title: LibGDX - How do I add a background Image

http://stackoverflow.com/q/25535430
score: 0
tagged with: android
tagged with: java
tagged with: arguments
has body: I'm relatively new to both Java and the android platform and I have come across a problem in my code that is just completely beyond me. I am trying to lock onto a users location and move the camera to that location using the google maps api v2 however this is without success even with constant reading of resources and attempts. The method requestLocationUpdates(String, long, float, LocationListener) in the type >LocationManager is not applicable for the arguments (String, int, int, LocationListener) >MainActivity.java /Loca/src/com/afrostudio/loca line 91 Java Problem Also a very recent error has randomly occured: R cannot be resolved to a variable Any help would be fantastic please :) package com.afrostudio.loca; import android.app.ActionBar; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.support.v4.widget.DrawerLayout; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.google.android.gms.location.LocationListener; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.MapFragment; public class MainActivity extends Activity implements NavigationDrawerFragment.NavigationDrawerCallbacks { private GoogleMap map; /** * Fragment managing the behaviors, interactions and presentation of the navigation drawer. */ private NavigationDrawerFragment mNavigationDrawerFragment; /** * Used to store the last screen title. For use in {@link #restoreActionBar()}. */ private CharSequence mTit…
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/25536848
tagged with: google-maps
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39868998
has title: Applicable for the Arguments location Manager Error

http://stackoverflow.com/q/25391207
has comment: http://stackoverflow.com/comment/39601559
has comment: http://stackoverflow.com/comment/39601403
has answer: http://stackoverflow.com/a/25399008
possible better answer: http://stackoverflow.com/a/35204314
answer count: 3
has answer: http://stackoverflow.com/a/31351672
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39601203
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39627477
score: 12
has comment: http://stackoverflow.com/comment/39723319
upvote count: 12
has body: I have jre8 installed and set as the default for the jre but under compiler compliance I can't find 1.8 and under execution environment I can't find javaSE 1.8. I'm using the latest build of Eclipse EE. I took a look at this manual http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-add_new_jre.htm But I couldn't find any .ee files in my jre8 or JDK1.8 installation directories.
has answer: http://stackoverflow.com/a/35204314
downvote count: 0
has comment: http://stackoverflow.com/comment/39601021
tagged with: ide
has title: How do I add execution environment 1.8 to Eclipse Luna?
has comment: http://stackoverflow.com/comment/39601369
has comment: http://stackoverflow.com/comment/39601298
accepted answer: http://stackoverflow.com/a/25399008
has comment: http://stackoverflow.com/comment/47995007
type: AnsweredQuestion

http://stackoverflow.com/comment/39725336
type: QuestionComment
has text: Yes it is returning a list. But its empty, not null. But i would still like to render it in a specific form in listView. I need A list, if you see what I mean.
type: Comment
comment on: http://stackoverflow.com/q/25457973
score: 0

http://stackoverflow.com/q/25467705
accepted answer: http://stackoverflow.com/a/25467718
tagged with: copy
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25467718
has answer: http://stackoverflow.com/a/25467739
answer count: 2
score: 1
tagged with: java
downvote count: 0
upvote count: 1
favorite count: 0
has body: As the title says, I'd like to know whether the add method makes a copy of the element and adds the copy to the ArrayList or copies the reference to the object for obvious performance reasons. Thanks!
type: Question
tagged with: performance
tagged with: addition
has title: (Java) Internal work of add(obj o) method in ArrayList<obj>
possible better answer: http://stackoverflow.com/a/25467739

http://stackoverflow.com/a/43613118
answers question: http://stackoverflow.com/q/25442115
has body: The solution that fixed this issue in a legacy Struts 2 application running Apache Tomcat/8.0.43 was to add the CORS Filter before the Struts 2 filter in the web.xml config file.
score: 1
type: Answer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39602116
comment on: http://stackoverflow.com/a/25391909
type: AnswerComment
has text: I got JNA, is there any example or tutorial I could use to listen to the keyboard?
type: Comment
score: 0

http://stackoverflow.com/q/25455283
upvote count: 1
tagged with: box2d
linked to: http://stackoverflow.com/q/36825979
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39727508
has comment: http://stackoverflow.com/comment/39723397
has comment: http://stackoverflow.com/comment/39727133
tagged with: libgdx
has answer: http://stackoverflow.com/a/41626796
has body: I'm working at a tower block game using box2d and libgdx. When i'm adding boxes on on top of each other, after 10 or 15 there is some kind of unstability, and the stack will fall. What is the best way to make the stack a little more stable? I've tried using a big angular damping, or giving the boxes a bigger density, but no succes. Every block has the same physical properties. Any suggestions?
has title: box2d - more stable stack
type: UnansweredQuestion
score: 1
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39720257

http://stackoverflow.com/comment/39759216
comment on: http://stackoverflow.com/q/25475731
has text: it needs to return that number for instance 1 for add so i can call another method to add
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41742348
score: 0
type: Comment
has text: You can find additional examples here: http://geoserver.geo-solutions.it/edu/en/rest/rest.html
type: AnswerComment
comment on: http://stackoverflow.com/a/25407019

http://stackoverflow.com/a/25484653
downvote count: 0
type: Answer
score: 2
has body: If your key is of type HashMap&lt;Integer, String&gt; you can't query the map with a key of type String which unique_schemas.containsKey(mapkey.get(0)) would do, since mapKey.get(0) would return the string value for key 0, if it exists. So try unique_schemas.containsKey(mapkey) instead, to use the entire map as a key, as you specified it. Btw, I'd most probably refactor that whole construct, since using a map as a key seems quite odd to me. Can the key really contain multiple combinations of id and text? Would it be a problem to have a Map&lt;KeyClass, List&lt;String&gt;&gt; instead, where KeyClass would look like this: class KeyClass { Integer id; String text; public int hashCode() { ... } public boolean equals(Object o) { ... } } Note that this is just a stub and you'd need to expand that, especially the implementation of hashCode() and equals().
upvote count: 2
answers question: http://stackoverflow.com/q/25484547

nio
tags question: http://stackoverflow.com/q/25399310
type: Tag
tags question: http://stackoverflow.com/q/25469483
tags question: http://stackoverflow.com/q/25522774
tags question: http://stackoverflow.com/q/25435838
tags question: http://stackoverflow.com/q/25430238
tags question: http://stackoverflow.com/q/25537675
tag name: nio
tags question: http://stackoverflow.com/q/25490451

http://stackoverflow.com/comment/39866970
type: Comment
score: 0
has text: It's pretty misleading, though, since it can easily be interpreted as "can be labeled with (one or more) (case or default labels). It would be clearer as "labeled with one or more case labels, and no more than one default label".
type: AnswerComment
comment on: http://stackoverflow.com/a/25534698

http://stackoverflow.com/comment/39782307
has text: Just a comment, our CI environment doesnt have this problem with virtual servers on oracle virtual box over SSH. Might a an alternative if you need one.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25488498
type: Comment

http://stackoverflow.com/a/25485811
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/25483859
has comment: http://stackoverflow.com/comment/39802071
has body: Here is a complete pom that will help you: 4.0.0 com.test dummyJar jar 1.0-SNAPSHOT dummyJar junit junit 4.11 org.jacoco jacoco-maven-plugin 0.7.1.201405082137 default-prepare-agent prepare-agent default-report prepare-package report The report will be at this location: /target/site/jacoco/index.html And see this location for all goals and their config params: http://www.eclemma.org/jacoco/trunk/doc/maven.html
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/39805534

executorservice
type: Tag
tags question: http://stackoverflow.com/q/25491833
tags question: http://stackoverflow.com/q/25391798
tags question: http://stackoverflow.com/q/25505406
tags question: http://stackoverflow.com/q/25521046
tag name: executorservice
tags question: http://stackoverflow.com/q/25493150

http://stackoverflow.com/q/25458941
tagged with: concurrency
tagged with: jvm
has body: In chapter 17 of Java language specification, there is a section explaining why "happens-before consistency is not sufficient". And here is the example: At first, x = y = 0 Thread 1 | Thread 2 r1 = x; | r2 = y; if (r1 != 0) y = 1; | if (r2 != 0) x = 1; And here is a possbile execution trace: r1 = x; // sees write of x = 1 y = 1; r2 = y; // sees write of y = 1 x = 1; How could this happen ? What I am confusing is that, when the first action sees that x = 1, doesn't it mean that the condition r2 != 0 has become true and thus y has been assigned to 1 ? But in that order, y = 1 comes after r1 = x. Where did I make a mistake to understand the example ? And how should I interpret this example correctly?
score: 12
type: Question
upvote count: 12
duplicate of: http://stackoverflow.com/q/11970428
has answer: http://stackoverflow.com/a/25461606
type: UnansweredQuestion
favorite count: 0
tagged with: parallel-processing
tagged with: x86
downvote count: 0
has title: How to understand that "Happens-before consistency is not sufficient" in Java
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39728345
linked to: http://stackoverflow.com/q/11970428

http://stackoverflow.com/comment/39730823
comment on: http://stackoverflow.com/a/25460948
type: AnswerComment
score: 0
type: Comment
has text: `\n\r` on an Android device? Really? ^^

http://stackoverflow.com/comment/39718970
type: QuestionComment
has text: Your question is tagged struts2, your question is about a struts1 tag, and you don't seem to be using struts (neither 1 or 2). Start by deciding if you want to use Struts. Struts 1 is completely obsolete. So if you choose to use struts, choose the struts2 version, and look at the struts2 documentation, not the struts1 documentation. Note that jsp:useBean is completely obsolete as well. Learn the JSP EL and the JSTL.
score: 3
comment on: http://stackoverflow.com/q/25454699
type: Comment

http://stackoverflow.com/a/25530064
upvote count: 15
has comment: http://stackoverflow.com/comment/39859130
has comment: http://stackoverflow.com/comment/39858458
has comment: http://stackoverflow.com/comment/39858802
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Now that the question is re-opened, I transfer my answer here. The short answer to "Why do they not just compare only lowercase instead of both upper and lower case, if it matches more cases than uppercase?": It does not match more character pairs, it merely matches different pairs. Comparing only uppercase is not enough, e.g. the ASCII letter "I" and the capital I with dot "İ" ((char)304, used in Turkish alphabet) have different uppercase (they are already uppercase), but they have the same lowercase letter "i". (Note that the Turkish language considers i with dot and i without dot as different letters, not just an accented letter, similar to German with its Umlauts ä/ö/ü vs. a/o/u.) Comparing only lowercase is not enough, e.g. the ASCII letter "i" and the small dotless i "ı" ((char)305). They have different lowercase (they are already lowercase), but they have the same uppercase letter "I". And finally, compare capital I with dot "İ" with small dotless i "ı". Neither their uppercases ("İ" vs. "I") nor their lowercases ("i" vs. "ı") match, but the lowercase of their uppercase is the same ("I"). I found another case if this phenomenon, in the greek letters "ϴ" and "ϑ" (char 1012 and 977). So a true case insensitive comparison can not even check uppercases and lowercases of the original characters, but must check the lowercases of the uppercases.
accepted answer of: http://stackoverflow.com/q/25513019
score: 15
answers question: http://stackoverflow.com/q/25513019

http://stackoverflow.com/q/25445924
has body: Hi I'm trying to transfer one object from one combobox to another and vice versa. To accomplish this, I use actionListeners or ItemListeners, to no luck that they dont answer my problems, or maybe there's just something wrong in my implementation. Assuming we have to comboboxes, combobox1 and combobox2. Basically, 1. I first add the selected item to another combobox (combobox2) 2. I remove the selected item on the first combobox (combobox1) When trying to debug this, i found out that everytime i am on the step of removing items, the listener of the other combobox fires, which does the same steps as above. This results into a loop, that just deletes the item, and places it back to the original combobox. When using the ItemListener, with the proper if conditions of being selected or not, it throws a bigger error. Guys please help me.. *on edit mode/currently making an SSCE
has comment: http://stackoverflow.com/comment/39708680
type: Question
has comment: http://stackoverflow.com/comment/39707653
has answer: http://stackoverflow.com/a/25449791
tagged with: java
has comment: http://stackoverflow.com/comment/39701823
has answer: http://stackoverflow.com/a/41402042
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/39701985
answer count: 2
has title: Transfer Items from One JComboBox to another JComboBox
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39704503
linked to: http://stackoverflow.com/q/4620295
tagged with: swing

http://stackoverflow.com/q/25516058
has comment: http://stackoverflow.com/comment/39834228
has comment: http://stackoverflow.com/comment/39833850
has comment: http://stackoverflow.com/comment/39833862
upvote count: 0
tagged with: java
has body: I have a folder with 1000 files. Each file contains text in varied number of lines. What I want and have tried to achieve is to read 'each' file and append all the lines into 1 single line (that is, I want each file to have a single line of texts). This is what I have tried but it only prints the names of the files without effecting any changes to the files... String line = ""; try{ file = new FileReader(filename); BufferedReader reader = new BufferedReader (file); while ((line = reader.readLine()) != null){ allLine.append(line); } //System.out.println(allLine); } catch (IOException e) { throw new RuntimeException("File not found"); } return allLine.toString(); FileWriter op = null; op = new FileWriter(fileName); BufferedWriter wryt = new BufferedWriter(op); wryt.write(s); wryt.flush(); if(op != null){ op.close(); } File[] lOfiles = folder.listFiles(); for (int i = 0; i&lt; lOfiles.length; i++){ if(lOfiles[i].isFile()){ System.out.println(lOfiles[i].getName()); ReadLines rd = new ReadLines(); String rw = rd.readtxtFile(lOfiles[i].toString()); rd.writetxtFile(lOfiles[i].getName(), rw); } }
answer count: 1
linked to: http://stackoverflow.com/q/1844688
downvote count: 1
has title: Read and modify each files in a folder - Java
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25516240
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/1844688
score: -1

http://stackoverflow.com/comment/39888216
has text: I see that you override the `toString()` method of `Student`, so doing a `System.out.println(student)` should output everything you specified. No ?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25546231

http://stackoverflow.com/comment/39646673
comment on: http://stackoverflow.com/q/25414310
score: 0
type: Comment
type: QuestionComment
has text: Can you post some code to show what you've tried?

http://stackoverflow.com/comment/39747027
has text: As you say, for small file everything is right but with large file it goes up to 100% So the work it take to process that file get your cpu to go up to 100% and if you wait long enough, it should complete giving you whatever result you need
comment on: http://stackoverflow.com/q/25469703
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/31255050
has comment: http://stackoverflow.com/comment/70642932
has comment: http://stackoverflow.com/comment/50532590
answers question: http://stackoverflow.com/q/25453042
has comment: http://stackoverflow.com/comment/56564547
has comment: http://stackoverflow.com/comment/137189530
downvote count: 0
type: Answer
score: 29
upvote count: 29
has body: This is a known bug in the JRE that reports this as an warning. See bug reports here and here The issue happens only when you have xerces jar in your classpath, the xerces implementation does not recognize the property and throws an exception on org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.setProperty() which results in a warning log (to System.err) from the com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.parse() The easy (if possible) solution is remove xerces jar from your classpath. Your log filter does not work since the error is never sent to slf4j. Which kind of suggests a convoluted way of fixing the issue - redirect System.err to slf4j and then use a logging filter on it. Sample code to reproduce the issue (based on the issue report): import java.io.IOException; import java.net.URL; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; public class XercesTest { public static void main(String[] args) throws IOException, TransformerConfigurationException { TransformerFactory tf = TransformerFactory.newInstance(); URL xsl = MainClass.class.getResource("build.xsl"); StreamSource stylesheetSource = new StreamSource( xsl.openStream(), xsl.toExternalForm()); tf.newTransformer(stylesheetSource); } } build.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> </xsl:template> </xsl:stylesheet> And maven dependency: xerces xercesImpl 2.11.0

http://stackoverflow.com/q/25399070
has answer: http://stackoverflow.com/a/25399152
type: Question
tagged with: java
type: UnansweredQuestion
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
score: 0
linked to: http://stackoverflow.com/q/141993
has title: How to parse two xml file and compare the specific elements of respective xml's in java?
answer count: 1
has body: First xml file test_balance1.xml Second xml file test_balance2.xml How to parse two xml file using SAX parser and compare specific elements in java? Ex: i need to parse line 12: &lt;brm:CURRENT_BAL&gt;-30&lt;/brm:CURRENT_BAL&gt; line 24: &lt;brm:CURRENT_BAL&gt;0&lt;/brm:CURRENT_BAL&gt; of test_balance1.xml and line 12: &lt;brm:CURRENT_BAL&gt;55&lt;/brm:CURRENT_BAL&gt; line 24: &lt;brm:CURRENT_BAL&gt;20&lt;/brm:CURRENT_BAL&gt; of test_balance2.xml After parsing How to compare the specific elements, i.e. CURRENT_BAL= -30 and CURRENT_BAL=55 , also CURRENT_BAL=0 and CURRENT_BAL=20

http://stackoverflow.com/comment/39775480
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25485309
has text: @daerin question updated btw. `findAllUserName` works properly but when trying to return two column its giving error. in case of `findAllUserNameAndEmpCode`.. application gives error while starting.
type: Comment

http://stackoverflow.com/comment/39663018
score: 0
comment on: http://stackoverflow.com/q/25414352
type: Comment
type: QuestionComment
has text: I haven't played with this stuff yet (it's high on my to-do list), but my guess is that the Gallery is not offering you a persistable permission.

http://stackoverflow.com/q/25495633
score: 0
has answer: http://stackoverflow.com/a/25495796
has title: Moving Eclipse M2E Web App Dependencies Into Project File System
tagged with: java
answer count: 1
tagged with: web-applications
tagged with: m2e
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/25495796
has body: I am currently working on a web app in Eclipse that I plan to push to Heroku. I am using the maven Eclipse plugin (m2e) for downloading dependencies for my app. Maven works great except for one thing. Maven is downloading all my dependencies into ~/.m2 which is fine except for one thing. When I push my app up to Heroku those dependencies won't go up with it, so I need the dependencies within the project file system. So my problem is finding the best way (or any way in fact) to get the dependencies into my project. I'm still a noob so any help is appreciated!
tagged with: heroku
type: AnsweredQuestion

http://stackoverflow.com/comment/39730644
type: Comment
has text: @Gabor Can you please post more of your activity code so I can edit it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25460602

http://stackoverflow.com/q/25464463
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/39737161
tagged with: replace
has comment: http://stackoverflow.com/comment/39737132
linked to: http://stackoverflow.com/q/1732348
has comment: http://stackoverflow.com/comment/39737292
has answer: http://stackoverflow.com/a/25464485
upvote count: 0
tagged with: java
downvote count: 2
answer count: 1
has body: I receive from internet-service html code: String html = Service.getHtml(); In html i have for example: &lt;div style="text"&gt;&lt;/div&gt; i would like use in replace 'style="text"' to for example 'new="aaa"': String new = html.replace("style=\"test\"", "new=\"aaa\""); but this not working. It probably did not find the text with backslash.
has comment: http://stackoverflow.com/comment/39737361
favorite count: 0
type: Question
has title: Replace with quotes in Java
type: UnansweredQuestion
score: -2

http://stackoverflow.com/comment/39842791
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25520971
type: Comment
has text: Ok , But i am getting an error here `Integer::parseInt` , `Integer cannot be resolved to a variable` .

http://stackoverflow.com/q/25467490
score: 1
tagged with: java
tagged with: hibernate
has body: I have a Category domain object that is intended to replicate a taxonomy term tree. Due to some of the extra reference mappings, it was necessary for me to rewrite the object creation code. The end result now is that Hibernate causes two data records to be inserted in the database for every create() execution. One data record contains all NULL values, while the other contains the expected data. My Category object: @Entity @NamedQuery( name="findCategoryByName", query="select category FROM Category c WHERE c.category = :category" ) @Table(name = "categories") public class Category implements Serializable{ @Id @Column(name = "category_id") @GeneratedValue(strategy = GenerationType.AUTO) private int id; @Column private String category; @ManyToMany(mappedBy = "categories", cascade = CascadeType.PERSIST) private List&lt;Photo&gt; photos= new ArrayList&lt;&gt;();; @ManyToOne(cascade = CascadeType.PERSIST) private Category parent; @OneToMany(mappedBy = "parent", cascade = CascadeType.PERSIST, fetch = FetchType.EAGER) private List&lt;Category&gt; categoryList = new ArrayList&lt;&gt;(); public Category() { } public Category(String category){ this.category = category; } /* Other getters and setters */ } The URL localhost:8080/admin/category/create hits this controller method with a POST request: @RequestMapping(value = AdminRestURIConstants.CREATE_CATEGORY, method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody public Category createCategory(@RequestBody Category category){ log.info("Start creating category " + category.getCategory()); Category newCategory = categoryService.createCategory(category); return newCategory; } and this is my Repository override method for data insertions: /** * * @param category * @return * * A Category object can be created with two types of parent references. An Integer means the parent reference * exists, and the new Category will be added to the existing child set. A String means the parent reference * is non-existing, and so…
answer count: 1
tagged with: mysql
favorite count: 0
type: Question
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25468150
has title: Hibernate inserting two records for every create query for One to Many domain object

http://stackoverflow.com/q/25391136
tagged with: java
score: 1
favorite count: 0
tagged with: testng
type: Question
has title: TestNG @BeforeTest object initialization issue
tagged with: testing
answer count: 0
tagged with: automated-tests
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39617659
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39677189
has comment: http://stackoverflow.com/comment/60703461
has body: public abstract class TestBase{ protected EnvironmentDetails envdetails; @BeforeTest(alwaysRun = true) @Parameters({ "envOld", "envNew", "env", "region", "prodcount", "unixuser", "unixpasswd", "mmPortOld", "mmPortNew" }) public void initialize(@Optional("xyz4") String envOld, @Optional("xyz4") String envNew, @Optional("xyz4") String env, @Optional("All") String region, @Optional("5") String prodcount, @Optional("") String unixuser, @Optional("") String unixpasswd, @Optional("6300") String mmPortOld, @Optional("6300") String mmPortNew) throws SQLException { //Populate envdetails //LOG envdetails } } public class myTest extends TestBase{ @Test(threadPoolSize = 1, invocationCount = 1, groups = { "usersort", "regression" }, dataProvider = "sortingDataProvider") public void sortTest(final String region, String mmUrl, String servletUrl) { //LOG envdetails } @DataProvider(name = "sortingDataProvider", parallel = false) public Object[][] provider(Method method) { Object[][] data = null; //populate data return data; } In the above code I initialized the object 'envdetails' in the @BeforeTest, when I log the object I find it correctly populated. Now, when I try to access it from the sortTest method each instance variable in the object envdetails is null in one execution while shows populated in some other execution, keeping code base and execution parameter passed though maven untouched. Is this some kind of threading issue or am I doing some major mistake.

http://stackoverflow.com/comment/39869032
comment on: http://stackoverflow.com/a/25535117
has text: never show "Entre" on consola, if UsuarioController it works should be show a message in console or show some error from usuarioDAO no?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25472891
has answer: http://stackoverflow.com/a/25472902
score: 5
has title: Why can't Java ArrayList be accessed by unique key?
answer count: 5
upvote count: 5
tagged with: arrays
has answer: http://stackoverflow.com/a/25472951
has body: I was passing the Java test and came across the following question (№8): Which statement is true for the class java.util.ArrayList? A. The elements in the collection are ordered. B. The collection is guaranteed to be immutable. C. The elements in the collection are guaranteed to be unique. D. The elements in the collection are accessed using a unique key. I've answered A and it is true. But why D is not true? I open the source of ArrayList and find the following chunk of code: /** * The array buffer into which the elements of the ArrayList are stored. * The capacity of the ArrayList is the length of this array buffer. Any * empty ArrayList with elementData == EMPTY_ELEMENTDATA will be expanded to * DEFAULT_CAPACITY when the first element is added. */ private transient Object[] elementData; Since, we can access to any element of an ArrayList using a unique key (index of element). Why does such reasoning is wrong?
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25472925
tagged with: java
downvote count: 0
accepted answer: http://stackoverflow.com/a/25472967
has answer: http://stackoverflow.com/a/25472967
has answer: http://stackoverflow.com/a/25474212
possible better answer: http://stackoverflow.com/a/25472902
favorite count: 0
type: Question

http://stackoverflow.com/comment/39769805
has text: why is there buttonpanel.repaint();, really is there intensive painting based on AWTs peers (OpenGL/CL)
type: QuestionComment
comment on: http://stackoverflow.com/q/25481660
type: Comment
score: 1

http://stackoverflow.com/a/25832276
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/49887621
downvote count: 0
answers question: http://stackoverflow.com/q/25404371
has body: had a similar problem. some legacy system (open VMS) with SSH that implemented SHA-1 with 2048 bit keys. not sure yet if it's a jsch bug, or a wrong ssh implementation. i also had to work with java 8 since i use javafx 8 features. any way, in order to work around this i got the openjdk code and abused the code like so: sun.security.provider.DSA.java ... @Override protected void checkKey(DSAParams params) throws InvalidKeyException { int valueL = params.getP().bitLength(); // comment out this check since it only // enforces the protocol and doesn't break the functionality // if (valueL &gt; 1024) { // throw new InvalidKeyException("Key is too long for this algorithm"); // } } compiled it and used -Xbootclasspath/p option to activate it. i know this is bad practice, but fixing the server is not an option, and fixing jsch might be a big task. you're welcome to condemn me for this.

http://stackoverflow.com/q/25534425
tagged with: string
has comment: http://stackoverflow.com/comment/39866581
has answer: http://stackoverflow.com/a/25534938
favorite count: 0
has answer: http://stackoverflow.com/a/25534548
has comment: http://stackoverflow.com/comment/39866505
has body: I want to use StringBuffer instead of concatenating string with the result. I used this code to convert the while loop but I am having trouble with the last if statement. What can I do to convert that? Original code: result = statement.executeQuery(sql); String string = ""; while (result.next()) { string += result.getString(("Hello") + ","); } if (string!= null &amp;&amp; !string.isEmpty()) { string= string.substring(0, string.length() - 1); } My attempt: result = statement.executeQuery(sql); StringBuffer string = new StringBuffer(""); while (result.next()) { string.append(("Hello") + ",") } if { --- CODE HERE --- } Any help?
downvote count: 0
answer count: 3
has title: Converting String arguments to StringBuffer
tagged with: if-statement
score: 1
has answer: http://stackoverflow.com/a/25534616
tagged with: java
tagged with: stringbuffer
has comment: http://stackoverflow.com/comment/39866382
tagged with: append
type: Question
has comment: http://stackoverflow.com/comment/39866591
has comment: http://stackoverflow.com/comment/39866495
upvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/25448196
score: 2
has title: while loop. sum and product of user inputted numbers
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/25448345
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39706078
has answer: http://stackoverflow.com/a/25448882
tagged with: java
tagged with: loops
has body: Build a program that will generate the sum and product of 20 input numbers using the while…loop structure. Conditions: user need to input only 20 numbers and get the sum and product of all the numbers. My code right now is this import java.util.Scanner; public class Case3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int[] list = new int[20]; int sum = 0; int product = 0; int x = 0; int number; System.out.print("Add number " + (x + 1) + ": "); number = input.nextInt(); while (x &lt;= list.length) { list[x] = number; x++; System.out.print("Add number " + (x + 1) + ": "); number = input.nextInt(); } for (int i = 0; i &lt; x; i++) { sum += list[i]; product *=list[i]; } System.out.println("The sum of all values are: " + sum); System.out.println("The product of all values are: " + product); } } --------------------Configuration: -------------------- Add number 1: 1 Add number 2: 2 Add number 3: 3 Add number 4: 4 Add number 5: 5 Add number 6: 6 Add number 7: 7 Add number 8: 8 Add number 9: 9 Add number 10: 10 Add number 11: 11 Add number 12: 12 Add number 13: 13 Add number 14: 14 Add number 15: 15 Add number 16: 16 Add number 17: 17 Add number 18: 18 Add number 19: 19 Add number 20: 20 Add number 21: 21 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 20 at Case3.main(Case3.java:16) Process completed.
favorite count: 0
has answer: http://stackoverflow.com/a/25448238
has answer: http://stackoverflow.com/a/25448384
answer count: 4
type: Question
upvote count: 2

http://stackoverflow.com/comment/39733987
type: Comment
has text: Thanks for the suggestions, i am trying to explore DOM parser for parsing and replacing strings ..
type: AnswerComment
comment on: http://stackoverflow.com/a/25461222
score: 1

http://stackoverflow.com/comment/39891492
score: 0
has text: What *exactly* are you trying to synchronize here? Is it the entire procedure of read-process-write? Or is it the individual reads and writes, while the processing can intertwine (And you may write back data from an old read)?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25548192

http://stackoverflow.com/comment/39708688
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25449543
has text: What is your jdk version ?

http://stackoverflow.com/q/25441702
tagged with: java
linked to: http://stackoverflow.com/q/51518039
answer count: 1
tagged with: gradle
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25445035
has body: I have project with structure like this: ┌project │ ├── build.gradle ├── module 1 │ │ │ ├── build.gradle │ ├── module 1.1 │ └── module 1.2 │ └── module 2 │ ├── build.gradle ├── module 2.1 └── module 2.2 My problem is that I have builds created for project, module 1 and module 2. But I do not need them, I only need builds from module 1.1, 1.2, 2.1 and 2.2. In submodules build.gradle: project(":modules 1") { ext.buildables = [ project(':modules-1:modules.1.1'), project(':modules-1:modules.1.2')] } project(":modules-1:modules.1.1") { dependencies { ... } } In root build.gradle: subprojects { apply plugin: 'java' sourceCompatibility = 1.6 targetCompatibility = 1.6 } Any thoughts on this? Edit: After running gradle build, there is follwoing directory structure: ┌project │ ├── build.gradle ├── build (not wanted) ├── module 1 │ │ │ ├── build (not wanted) │ ├── build.gradle │ ├── module 1.1 | | | │ | └── build │ └── module 1.2 | | │ └── build │ └── module 2 │ ├── build (not wanted) ├── build.gradle ├── module 2.1 | | | └── build └── module 2.2 | └── build How to get rid of these not wanted folders, they all have jars with size of 1kb inside.
has comment: http://stackoverflow.com/comment/39694306
has comment: http://stackoverflow.com/comment/39695308
upvote count: 2
downvote count: 2
has title: Gradle - dont create parent build in multi module project
has answer: http://stackoverflow.com/a/25445035
tagged with: build
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39695483

jit
tags question: http://stackoverflow.com/q/25540087
tag name: jit
type: Tag
tags question: http://stackoverflow.com/q/25543301
tags question: http://stackoverflow.com/q/25497325

http://stackoverflow.com/q/25481690
tagged with: byte
has comment: http://stackoverflow.com/comment/39769385
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39769063
has answer: http://stackoverflow.com/a/25481995
tagged with: android
tagged with: arrays
has answer: http://stackoverflow.com/a/25481814
has answer: http://stackoverflow.com/a/25481860
has comment: http://stackoverflow.com/comment/39769823
has body: I'm working on a project that involves receiving a byte array over wireless, the Android app reads this as a String over a TCP connection: input = new BufferedReader(new InputStreamReader(this.clientSocket.getInputStream())); ... ... //Loop String read = input.readLine(); //Do something meaningful with String read... The String will always be of a fixed format i.e. the first 3 characters will be an ID and the next following 20 characters will be the message data. The amount of characters will not change (3+20 characters = 23, with a starting and ending character '[' and ']' so that's 25 characters in total. An example of a String received by the application would be [01A01020304050A0B0C0D] ID - 0x01A Byte0 0x01 Byte1 0x02 Byte2 0x03 Byte3 0x04 Byte4 0x05 Byte5 0x0A Byte6 0x0B Byte7 0x0C Byte 8 0x0D I would guess that I would have to use the substring operation, but I'm having trouble converting the substring to a byte value (note: the app is expecting byte[] and not Byte[]) and I feel I'm not doing it efficiently. I came across this piece of code that I've been using: public static byte[] hexStringToByteArray(String s) { int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i &lt; len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) &lt;&lt; 4) + Character.digit(s.charAt(i+1), 16)); } return data; This is returning a byte array of size 1 and will have to be run 9 times (9 bytes) per message. I'm a bit concerned that this may be a bit too strenuous on processing, especially when the application is receiving messages very frequently (roughly about 10-15 messages per second) I appreciate any thoughts and many thanks in advance!
has answer: http://stackoverflow.com/a/25481781
has comment: http://stackoverflow.com/comment/39769576
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/39769097
has comment: http://stackoverflow.com/comment/39769770
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39769654
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/39769475
type: Question
has title: Efficient way to convert a String (representing HEX) to a byte array? Android
has answer: http://stackoverflow.com/a/25481922

http://stackoverflow.com/a/25752824
type: Answer
has body: I'm going to answer my own question and mark it as solved rather than erase the question or edit it. There were a few things at play here and some things that I got wrong. Mostly because the documentation on the builders is poor or non-existent. Here's what I had to do: Set up on the Admin Console (https://admin.google.com/) Make sure the account I'm trying to use has Super Admin access for this domain (Admin Roles -> Super Admin) Enable API Access in the Security tab. (Security -> API reference -> API access -> Enable API Access Do setup on the Developer Console(below) Add accesses to my app (Security -> Advanced settings -> Authentication -> Manage OAuth Client access Grant these scopes to my client from the Developer Console (without the square brackets): [https]://www.googleapis.com/auth/admin.directory.group [https]://www.googleapis.com/auth/admin.directory.user [https]://www.googleapis.com/auth/admin.directory.user.readonly [https]://www.googleapis.com/auth/admin.directory.user.security Not all of these scopes may be necessary, but it's what I have enabled Set up on the Developer Console (https://console.developers.google.com/) Create Project Enable Admin SDK for project (APIs &amp; auth -> APIs) Create an OAuth client as a service account (APIs &amp; auth -> Credentials -> Create new Client ID) Take that Client ID back to the Admin Console (step 5 above) Download p12 key where my java app can read it. (APIs &amp; auth -> Credentials -> Generate new P12 key) Now I can finally write some java! import java.io.*; import java.net.*; import java.util.*; import java.security.GeneralSecurityException; import java.security.MessageDigest; import javax.xml.bind.DatatypeConverter; import com.google.api.services.admin.directory.*; import com.google.api.services.admin.directory.model.*; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.jackson2.JacksonFactory; …
accepted answer of: http://stackoverflow.com/q/25530184
upvote count: 6
has comment: http://stackoverflow.com/comment/41236551
has comment: http://stackoverflow.com/comment/47012432
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/131582334
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/49599725
answers question: http://stackoverflow.com/q/25530184

http://stackoverflow.com/comment/39849776
type: AnswerComment
has text: @RomanC : I got your point. I will write all this code myself.
score: 0
comment on: http://stackoverflow.com/a/25512798
type: Comment

http://stackoverflow.com/q/25511962
tagged with: function-calls
has title: How are arrays passed to a function in Java
upvote count: 2
has comment: http://stackoverflow.com/comment/39825720
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25512752
tagged with: parameter-passing
tagged with: http://stackoverflow.com/tag/c
linked to: http://stackoverflow.com/q/25109793
has answer: http://stackoverflow.com/a/25515490
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25511990
has comment: http://stackoverflow.com/comment/39825714
has answer: http://stackoverflow.com/a/25512017
has answer: http://stackoverflow.com/a/25512000
downvote count: 1
has body: In C, when we pass an array in a function call, only a pointer to the array is passed to aid memory and time efficiency, and we cannot calculate the size of the array in the called function. We have to pass the size as a parameter to the called function. However, in Java, we can calculate the size of the array in the called function too. So, doesn't it affect memory efficiency as I suppose the whole array is being passed to the called function. Could someone please elaborate on this?
favorite count: 0
type: Question

security
tags question: http://stackoverflow.com/q/25504137
tags question: http://stackoverflow.com/q/25412032
tags question: http://stackoverflow.com/q/25524628
tags question: http://stackoverflow.com/q/25467037
tags question: http://stackoverflow.com/q/25469241
tags question: http://stackoverflow.com/q/25514421
tags question: http://stackoverflow.com/q/25436658
tags question: http://stackoverflow.com/q/25527255
type: Tag
tags question: http://stackoverflow.com/q/25501557
tag name: security
tags question: http://stackoverflow.com/q/25521386

http://stackoverflow.com/comment/39801213
comment on: http://stackoverflow.com/a/25497693
has text: @Ryan Ramsden (not mentioned here) 16milis is very expensive, touched latency of Native OS (to use 25/33/50), to translate this value to Mhz and to compare with max refresh frequency in the setting for your display, forgot about that your GPU/display is able to rendering 4k video, those mediaplayers has access to GPS and processes are optimized quite good, AWT/Swing is from last century, in this case NTSC/PAL was top (24/5frames per second)
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25421622
downvote count: 0
upvote count: 1
has body: You might have forgotten to load your native library via static { System.loadLibrary("YourLibaryName"); }
answers question: http://stackoverflow.com/q/25413547
type: Answer
score: 1

http://stackoverflow.com/comment/39746970
comment on: http://stackoverflow.com/q/25469731
has text: Here, aGrade is integer. So, aGrade/100 = 0 and 0*50 =0
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39969635
comment on: http://stackoverflow.com/a/25551755
type: Comment
score: 0
type: AnswerComment
has text: thanks, the space was added by mistake in my question details but it's without space when i execute the command.

http://stackoverflow.com/comment/39633796
type: AnswerComment
comment on: http://stackoverflow.com/a/25396076
score: 2
type: Comment
has text: if the target type already is `Serializable`, how can you “wash off” the serializable marker? Every re-wrapping in another lambda will again create a `Serializable` lambda, unless I use a different target type. But if I was able to use a different target type, I hadn’t the problem in the first place. I could forcibly add a captured non-`Serializable` value, but that still must be done very carefully to prevent attacks with a carefully designed serialized form. And it doesn’t allow to get rid of the overhead of the serializable lambda.

http://stackoverflow.com/q/25440939
tagged with: linux
has title: Need a help to perform operation ipv6 ftp server
has answer: http://stackoverflow.com/a/25441138
tagged with: ftp
score: 0
type: UnansweredQuestion
tagged with: java
answer count: 1
has body: I am using linux box. I am unable do any operation using IPv6 FTP server.I am able to connect using IPV6 FTP server. But when I will do any operation(like ls,get,put ..) it's giving below exception(Highlighted with bold). [root@SKP-vlnx ~]# ftp aa01:9:1::22:56ff:231:4b Connected to aa01:9:1::22:56ff:231:4b (aa01:9:1::22:56ff:231:4b ). 220 Service ready for new user Name (aa01:9:1::22:56ff:231:4b ): xyz 331 User name okay, need password for ftp-user Password: 230 User logged in, proceed Remote system type is UNIX. ftp> ls 502 Command EPSV not implemented 502 Command LPSV not implemented Passive mode refused. Any body please help on this.
tagged with: ftp-client
type: Question

http://stackoverflow.com/comment/39701641
has text: @V31 I working in a server on Openshift. Wildfly 8.1-Final
score: 0
comment on: http://stackoverflow.com/q/25438418
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39799789
score: 0
comment on: http://stackoverflow.com/q/25498022
type: Comment
type: QuestionComment
has text: I'm trying to validate it, if the IP has invalid characters in it I want to ask the user to input a new one. I'm not familiar with regular expressions, on oracle tutorials right now reading through it.

http://stackoverflow.com/comment/39890864
type: AnswerComment
has text: Have you heard about `LinkedHashSet`? I think that's what you wanted to suggest.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25547975

http://stackoverflow.com/q/25403810
type: UnansweredQuestion
tagged with: hazelcast
tagged with: tomcat
upvote count: 2
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/64831398
downvote count: 0
has body: i've some problems with hazelcast http session replication feature. I'm trying to deploy a web application with hazelcast http session replication in a pair of tomcat 7.0.54 already in cluster (SimpleTcpCluster with a DeltaManager), running under java 1.7.0_25 with others non-hazelcast clustered applications. i've some questions: is it possible to have hazelcast clsutered and non-hazelcast clsutered application in the same tomcat cluster? the application with hazelcast should be distributable? (by adding in it's web.xml like the others) the tomcat's in which the app is deployed shouldn't be in cluster? can i have other application clusterized with standard tomcat session replication in the same tomcat? EDIT: More detailed explanation of what i'm doing: i'm trying to create a simple web app, with just one servlet that, at the first user request generate one new http session, and than, for each GET request will print the session id. this is the servlet code: @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("Get Method. Check Session..."); HttpSession session = req.getSession(false); if (session==null) { System.out.println("User with null session, generating one..."); session = req.getSession(true); if (session==null) System.out.println("Session can not be generated."); } if (session!=null) System.out.println("Received GET request from session " + session.getId()); } In order to introduce the hazelcast WM to get the session replicated among 2 tomcats, i've added to my project: hazelcast-3.2.5.jar into WEB-INF folder hazelcast-wm-3.2.5.jar into WEB-INF folder standard hazelcast.xml into WEB-INF folder (exacly the same hazelcast.xml that is packaged within the ZIP archive of the hazelcast 3.2.5, into the bin folder) added the hazelcast filter to my web.xml, exacly the same in the example in the official documentation On the official documentation i didn't find any other configuratio…
tagged with: cluster-computing
favorite count: 0
type: Question
has title: Hazelcast HTTP session replication doesn't replicate anything
answer count: 2
has answer: http://stackoverflow.com/a/25410487

http://stackoverflow.com/a/25431493
has body: Provide a mapping from the value to the enum instance. This will be a static variable that can (must) be filled by the constructor: (Code edited as per Pshemo's comment) enum Mobile { Samsung(400), Nokia(250),Motorola(325); private static final Map&lt;Integer, Mobile&gt; MOBILES = new HashMap&lt;&gt;(); static { for (Mobile m : values()) MOBILES.put(m.price, m); } int price; Mobile(int p) { price = p; } int showPrice() { return price; } public static Mobile byValue(int value) { return MOBILES.get(value); } } Note that some autoboxing and -unboxing is involved. And consider throwing an IllegalArgumentException if the value is not existent. An additional note: This requires all values to be distinct!
accepted answer of: http://stackoverflow.com/q/25431403
type: Answer
has comment: http://stackoverflow.com/comment/39692010
answers question: http://stackoverflow.com/q/25431403
has comment: http://stackoverflow.com/comment/39692455
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39676314

http://stackoverflow.com/comment/39844327
comment on: http://stackoverflow.com/a/25522035
type: AnswerComment
type: Comment
has text: But the `a != null` is the *non-negated* case because `a == null` actually means "there is no `a`".
score: 0

http://stackoverflow.com/comment/39883871
score: 0
has text: That days are counted starting from 1 but months are counted starting from 0. First day is 1, but first month (January) is 0.
type: Comment
comment on: http://stackoverflow.com/q/25544079
type: QuestionComment

http://stackoverflow.com/a/25509893
type: Answer
has comment: http://stackoverflow.com/comment/39822301
has comment: http://stackoverflow.com/comment/39824175
score: 0
answers question: http://stackoverflow.com/q/25507200
has body: I just updated previous example created by @starf and its work.I add "indexof" elemet to find my string.Thanks a lot for your help! try { String keyword = "!!!"; int numberOfLinesToDisplay = 8; ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); BufferedReader br = new BufferedReader(new FileReader("C:\\some.log")); int i = 0; // Loop over each line String line; while ((line = br.readLine()) != null) { // Add the line to the list list.add(line); // Checking for the keyword... int indexfound = line.indexOf(keyword); // If greater than -1, means we found the word if (indexfound &gt; -1) { // Reverse the for loop to print "forwards" for (int j = numberOfLinesToDisplay; j &gt;= 0; j--) { // Make sure there is something there if (i - j &gt;= 0) { // Simply print it System.out.println(list.get(i - j)); } } } i++; } }catch (IOException ie){ System.out.println("File not found"); }
has comment: http://stackoverflow.com/comment/39824731

http://stackoverflow.com/comment/39673063
score: 2
type: AnswerComment
has text: @isnot2bad that's true, `toLocalDate()` is a pure getter. Well, I guess we can't expect the Oracle folks to be perfect ;)
comment on: http://stackoverflow.com/a/25427439
type: Comment

try-catch
tags question: http://stackoverflow.com/q/25430892
tags question: http://stackoverflow.com/q/25436065
tags question: http://stackoverflow.com/q/25455565
tags question: http://stackoverflow.com/q/25454428
type: Tag
tags question: http://stackoverflow.com/q/25422011
tag name: try-catch
tags question: http://stackoverflow.com/q/25528215
tags question: http://stackoverflow.com/q/25390281
tags question: http://stackoverflow.com/q/25442850
tags question: http://stackoverflow.com/q/25550772

http://stackoverflow.com/a/25497151
score: 0
has comment: http://stackoverflow.com/comment/39798444
has comment: http://stackoverflow.com/comment/39799182
has comment: http://stackoverflow.com/comment/39799229
has comment: http://stackoverflow.com/comment/39798521
has comment: http://stackoverflow.com/comment/39798517
type: Answer
has comment: http://stackoverflow.com/comment/39798181
has body: Try moving the g2d.dipose() from the paintComponent(g) method. To go inside the try{}catch() statement right after you draw the active image.
has comment: http://stackoverflow.com/comment/39798290
has comment: http://stackoverflow.com/comment/39798583
has comment: http://stackoverflow.com/comment/39798378
has comment: http://stackoverflow.com/comment/39798607
answers question: http://stackoverflow.com/q/25496911

http://stackoverflow.com/comment/39762274
has text: Just a note for the way you run the sed: there is no good reason why you would like to iterate through the results of the find command via bash for loop. Moreover it's not a good idea to use double quotes in as a name parameter for a find command (since such string can be expanded by bash). In short, I would run it this way: `find . -type f -name '*.java' | xargs sed -i 's/\<zn/.\>//g'`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25477939
score: 0

http://stackoverflow.com/q/25509763
has body: Problem: Maven can't find some dependencies inside my tests import org.hamcrest.core.StringStartsWith; // HIGHLIGHTED AS RED IN INTELLIJ It's imported like this in my pom.xml: org.hamcrest hamcrest-core 1.3 test I already tried: mvn test-compile Invalidate Intellij caches Restart Intellij Clear .m2 and rebuild project
type: UnansweredQuestion
tagged with: intellij-idea
tagged with: maven
has answer: http://stackoverflow.com/a/75939692
has comment: http://stackoverflow.com/comment/39822291
has comment: http://stackoverflow.com/comment/39821760
has comment: http://stackoverflow.com/comment/39821839
has comment: http://stackoverflow.com/comment/39821870
answer count: 3
has comment: http://stackoverflow.com/comment/39821742
score: 1
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25509929
upvote count: 1
has answer: http://stackoverflow.com/a/25510069
has title: Maven: test dependencies
favorite count: 0
has comment: http://stackoverflow.com/comment/39822066
type: Question

http://stackoverflow.com/comment/39876293
comment on: http://stackoverflow.com/q/25539285
score: 0
has text: @JigarJoshi : Ok. what if the Package2 extends a class from a different project? In that case I should be using an internal repo to store that jar and create a dependency right?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25470126
duplicate of: http://stackoverflow.com/q/763579
has comment: http://stackoverflow.com/comment/39747875
favorite count: 0
has comment: http://stackoverflow.com/comment/39747831
has comment: http://stackoverflow.com/comment/39748454
has answer: http://stackoverflow.com/a/25470291
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25470217
has body: Error: Exception in thread "Thread-2200" java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Unknown Source) at problem1.solvinging$solver.distancecalculator(Orienteering.java:107) at problem1.solveing$solver.run(Orienteering.java:165) Class: public void distancecalculator(char [][]problem , int distancefound) { Point p = new Point(); LinkedList&lt;Point&gt; q = new LinkedList&lt;&gt;(); q.add(origin); int []x = {1,-1,0,0}; int []y = {0,0,1,-1}; dist[0][0] = distancefound; while(!q.isEmpty()) { p = q.getFirst(); for(int i = 0; i &lt; 4; i++) { int a = p.x + x[i]; int b = p.y + y[i]; if(a &gt;= 0 &amp;&amp; b &gt;= 0 &amp;&amp; a &lt; m &amp;&amp; b &lt; n &amp;&amp; dist[a][b]==2) { dist[a][b] = 1 + dist[p.x][p.y] ; if(k&gt;0) { solver s = new solver(newproblem,dist[a][b]); new Thread(s).start(); } I am getting the above error in my program while executing it But the program is still running How i correct it please help me Thanks in advance.Suggest new edits if required
tagged with: java
has comment: http://stackoverflow.com/comment/39748421
has comment: http://stackoverflow.com/comment/39747715
has comment: http://stackoverflow.com/comment/39748496
score: -2
has comment: http://stackoverflow.com/comment/39747854
has comment: http://stackoverflow.com/comment/39747733
has title: Multiple Threading in java
linked to: http://stackoverflow.com/q/763579
has comment: http://stackoverflow.com/comment/39748345
type: Question
answer count: 3
accepted answer: http://stackoverflow.com/a/25470257
has answer: http://stackoverflow.com/a/25470217
upvote count: 0
has comment: http://stackoverflow.com/comment/39748824
downvote count: 2
has comment: http://stackoverflow.com/comment/39748125
tagged with: multithreading
has answer: http://stackoverflow.com/a/25470257

http://stackoverflow.com/comment/39809746
comment on: http://stackoverflow.com/q/25503573
score: 0
has text: Some smart card vendors provide a middleware with a PKCS #11 API, and there are a few PKCS #11 libraries for Java.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39778342
score: 0
comment on: http://stackoverflow.com/a/25485756
type: Comment
has text: Maybe you 've got something more at the end of string? Try `substring(2, s.length()-12)`
type: AnswerComment

oauth-2.0
type: Tag
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/25457242
tags question: http://stackoverflow.com/q/25409069
tags question: http://stackoverflow.com/q/25429389

http://stackoverflow.com/a/25460599
type: Answer
accepted answer of: http://stackoverflow.com/q/25460469
has body: You can use the code shown below: String[] files = {"test.pdf;3","test.pdf;1","differentTest.pdf;2","test.pdf;5","test.pdf;4", "test.excel;3","test.excel;1","test.excel;6","test.excel;5","test.excel;4"}; HashMap &lt;String, Integer&gt; newestFiles = new HashMap&lt;String, Integer&gt;(); for (String currentString : files) { String currentFileName = currentString.split(";")[0]; Integer currentFileVersion = Integer.parseInt(currentString.split(";")[1]); if (newestFiles.containsKey(currentFileName)) { if (newestFiles.get(currentFileName) &lt; currentFileVersion) { newestFiles.put(currentFileName, currentFileVersion); } } else { newestFiles.put(currentFileName, currentFileVersion); } } for (Entry&lt;String, Integer&gt; maxValue : newestFiles.entrySet()) { String result = new StringBuilder("Max version of file: ").append(maxValue.getKey()).append(" is: ").append( maxValue.getValue()).toString(); System.out.println(result); } Result: Max version of file: test.excel is: 6 Max version of file: test.pdf is: 5 Max version of file: differentTest.pdf is: 2 What is done here: For every file get its name and version - using splitting. Then check if you already processed files with that name (all processed are stored in newestFiles Map). If it was not processed add it to the Map with current file version (in else statement). If it was processed check if current version is bigger. If it is, substitute the file in the map.
answers question: http://stackoverflow.com/q/25460469
type: AcceptedAnswer
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/q/25438897
favorite count: 0
type: Question
tagged with: processing
has body: So I am using processing in java mode. There is a function: ellipse(int,int,int,int) that draws an ellipse. I want this program to add a bullet object to the bulletHolder arraylist when the mouse is clicked and then display ellipses for each of these bullet objects based on their x and y property values. however an error is occurring saying that 'x cannot be resolved or is not a field' on the line: ellipse((int) bulletHolder.get(i).x, (int) bulletHolder.get(i).y, 50, 50); Here is my full code public ArrayList&lt;Bullet[]&gt; bulletHolder= new ArrayList&lt;Bullet[]&gt;(); int count = 0; void setup(){ size(500,500); } void draw(){ if(count!=0){ for(int i =0; i&lt;count; i++){ ellipse(bulletHolder.get(i).x, bulletHolder.get(i).y, 50, 50); } } } void mouseClicked(){ bulletHolder.add(new Bullet(mouseX,mouseY)); count++; } class Bullet { int x; int y; Bullet(int x,int y){ this.x = x; this.y=y; } }
has answer: http://stackoverflow.com/a/25438911
possible better answer: http://stackoverflow.com/a/25438911
has comment: http://stackoverflow.com/comment/39689423
has answer: http://stackoverflow.com/a/25438917
accepted answer: http://stackoverflow.com/a/25438917
has title: Processing error: x cannot be resolved or is not a field (java with the processing app)
type: AnsweredQuestion
answer count: 2
downvote count: 0
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/q/25409138
answer count: 0
has title: Android Studio throwing a null pointer exception when parseint from a edit text
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39636113
has comment: http://stackoverflow.com/comment/39639717
type: UnansweredQuestion
tagged with: android
has body: it seams like the part that throws the exception is the part after the onclick listerner since if i comment it out the app will run fine (although not functional) public class MyActivity extends Activity { int poundtwenty; int poundten; int poundfive; int poundtwo; int poundone; int tenpences; int twentypences; int fiftypences; int £20out; int £10out; int £5out; int £2out; int £1out; double fiftyout; double twentyout; double tenout; double Total; EditText in£20; EditText in£10; EditText in£5; EditText in£2; EditText in£1; EditText in50; EditText in20; EditText in10; Button Go; TextView outTotal; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); in£20 = (EditText) findViewById(R.id.poundtwentyin); in£10 = (EditText) findViewById(R.id.poundtenin); in£5 = (EditText) findViewById(R.id.poundfivein); in£2 = (EditText) findViewById(R.id.poundtwoin); in£1 = (EditText) findViewById(R.id.poundonein); in50 = (EditText) findViewById(R.id.fiftyin); in20 = (EditText) findViewById(R.id.twentyin); in10 = (EditText) findViewById(R.id.tenin); Go = (Button) findViewById(R.id.go); Go.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int poundtwenty = Integer.parseInt(in£20.getText().toString()); int poundten = Integer.parseInt(in£10.getText().toString()); int poundfive = Integer.parseInt(in£5.getText().toString()); int poundtwo = Integer.parseInt(in£2.getText().toString()); int poundone = Integer.parseInt(in£1.getText().toString()); int fiftypences = Integer.parseInt(in50.getText().toString()); int twentypences = Integer.parseInt(in20.getText().toString()); int tenpences = Integer.parseInt(in10.getText().toString()); double fiftyout = (double) fiftypences/2; double twentyout = (double) twentypences/5; double tenout = (double) tenpen…
has comment: http://stackoverflow.com/comment/39638602
tagged with: int
score: 0
has comment: http://stackoverflow.com/comment/39635279
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/39637851

http://stackoverflow.com/q/25458319
has body: So right now I am trying to develop an Android App for my young children. I want to set a pin or passwords on selected applications for a particular amount of time to prevent them from opening the app. For example, let's say that my daughter wants to play angry birds for some time on my phone while I am doing work. I will select my important apps like messaging, gmail, etc and put a pin or password on it for 30 minutes while she plays angry birds. After 30 minutes, I get my phone from my daughter and I can open the app without a pin because the time limit expired. I have done a ton of research and I was able to get a basic service class written. package com.spicycurryman.getdisciplined10.app; import android.app.ActivityManager; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.util.Log; import android.widget.Toast; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; /** * Created by Spicycurryman on 8/21/14. */ public class SaveMyAppsService extends Service{ public void onCreate(){ super.onCreate(); //UNABLE TO SETCONTENTVIEW HERE. METHOD DOESN'T WORK while(true) { Toast.makeText(SaveMyAppsService.this, "Your Message", Toast.LENGTH_LONG).show(); } } String CURRENT_PACKAGE_NAME = "com.spicycurryman.getdisciplined10.app.dev"; String lastAppPN = ""; boolean noDelay = false; public static SaveMyAppsService instance; @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { // TODO Auto-generated method stub scheduleMethod(); CURRENT_PACKAGE_NAME = getApplicationContext().getPackageName(); Log.e("Current PN", "" + CURRENT_PACKAGE_NAME); instance = this; return START_STICKY; } private void scheduleMethod() { // TODO Auto-generated method stub ScheduledExecutorService schedul…
tagged with: android
tagged with: java
type: Question
tagged with: android-service
has answer: http://stackoverflow.com/a/25458400
tagged with: android-view
type: UnansweredQuestion
has title: How to setContentView in a service class to password protect apps upon opening
answer count: 1
upvote count: 1
linked to: http://stackoverflow.com/q/18948251
downvote count: 1
favorite count: 0
score: 0

http://stackoverflow.com/q/25499590
tagged with: android
tagged with: maven
type: UnansweredQuestion
has title: Android studio, import maven project cause java.lang.IllegalArgumentException: No enum constant ...JDK_1_9
tagged with: android-studio
has body: The issue occurs while importing an android maven project causing the following error: Error:Internal error: (java.util.concurrent.ExecutionException) java.lang.IllegalArgumentException: No enum constant org.jetbrains.jps.model.java.LanguageLevel.JDK_1_9 java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: No enum constant org.jetbrains.jps.model.java.LanguageLevel.JDK_1_9 at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadModules(JpsProjectLoader.java:268) at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadFromDirectory(JpsProjectLoader.java:122) at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject(JpsProjectLoader.java:98) at org.jetbrains.jps.model.serialization.impl.JpsSerializationManagerImpl.loadModel(JpsSerializationManagerImpl.java:41) at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadModel(JpsModelLoaderImpl.java:45) at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:71) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:198) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:113) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:133) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 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:744) Caused by: java.lang.IllegalArgumentException: No enum constant org.jetbrains.jps.model.java.LanguageLevel.JDK_1_9 at java.lang.Enum.valueOf(Enum.java:236) at org.jetbrains.jps.model.java.LanguageLevel.valueOf(LanguageLevel.java:21) at org.jetbrains…
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/127800956
tagged with: java
answer count: 0
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/26645317
type: Question

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

http://stackoverflow.com/comment/39728415
comment on: http://stackoverflow.com/q/25459448
type: Comment
type: QuestionComment
score: 0
has text: @Evan check this map inside of fragment http://stackoverflow.com/questions/20919048/android-android-view-inflateexception-binary-xml-file-line-8-error-inflatin

http://stackoverflow.com/a/25440121
has body: when you convert an application to fragment based structure, you have to consider one thing that the context is same for all the fragments in an activity. You will get it by calling getActivity(). So save your context first and use it where ever you want the context. From your question you are developing an application with tabs. So you may have to create fragments as many as the tabs. You can put your code for each tab in the corresponding fragment. Now to communicate between the fragments the best way is to use callbacks in your parent activity. A simple tutorial for implementing fragments can be found HERE The communication between fragments is explained HERE
downvote count: 0
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25438824
has comment: http://stackoverflow.com/comment/39691908

http://stackoverflow.com/a/25468880
score: 3
has comment: http://stackoverflow.com/comment/39745338
upvote count: 3
has body: Animal a=new Dog(); // Animal is parent - class, Dog is a child means, you have an animal reference pointing to a Dog Object. So, only the methods which are declared in the parent class (Animal) can be called using a parent- class reference. In your case, m2() is not defined in Class A, it is only defined in class B so, using a reference of A, you can't call m2()
type: Answer
has comment: http://stackoverflow.com/comment/39745368
has comment: http://stackoverflow.com/comment/39745369
accepted answer of: http://stackoverflow.com/q/25468867
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25468867

integration-testing
tags question: http://stackoverflow.com/q/25412345
tags question: http://stackoverflow.com/q/25441021
tags question: http://stackoverflow.com/q/25506982
tags question: http://stackoverflow.com/q/25510863
tags question: http://stackoverflow.com/q/25436334
tag name: integration-testing
type: Tag
tags question: http://stackoverflow.com/q/25412556

http://stackoverflow.com/comment/39809061
has text: @Ash Android closely but not exactly follows Java-6-API so the new JSR-310-API is simply not available on Android platforms. Please have a look on this [issue](http://code.google.com/p/android/issues/detail?id=62192), too (which was declined by Google). As workaround - you might experiment with [Threeten-BP](https://github.com/ThreeTen/threetenbp) however. But I think Time4J is already now better on many areas and has definitely more innovation power. The code example above will even be further simplified in next version 1.2 (without if-clause).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25484123
type: Comment

http://stackoverflow.com/a/25511833
answers question: http://stackoverflow.com/q/25511795
has comment: http://stackoverflow.com/comment/39825569
has body: You are saving them in int. Save values in float or double. Also, when division occurs, the intermediate result is saved in one of the variable that is used in division. If that is an int, it will be truncated before being saved in double. So do something like double divide = (double)score * totalQuestions
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39796227
type: Comment
type: QuestionComment
score: 0
has text: Well I looked around too and I found two or three. Obviously the jcraft one isn't the right one. Keep looking. If I found more, you can.
comment on: http://stackoverflow.com/q/25495494

http://stackoverflow.com/q/25513095
tagged with: classnotfoundexception
accepted answer: http://stackoverflow.com/a/25534662
upvote count: 0
tagged with: mysql
has answer: http://stackoverflow.com/a/25534662
has comment: http://stackoverflow.com/comment/39828112
downvote count: 1
favorite count: 0
type: Question
has body: I have a doubt about Class Not Found Exception. I've added all the jars in my file but I cant seem to make it work. I've added the mysql-connector.jar in my project. DOes anyone know how to make it right? try { String driverName = "com.mysql.jdbc.Driver"; Class.forName(driverName); String serverName = "localhost"; String mydatabase = "UFRJSocial"; String url = "jdbc:mysql://" + serverName + "/" + mydatabase; String username = "root"; String password = ""; connection = DriverManager.getConnection(url, username, password); if (connection != null) { status = ("STATUS---&gt;Connected!"); } else { status = ("STATUS---&gt;The connection failed"); } return connection; } catch (ClassNotFoundException e) { System.out.println("The specified driver was nor found"); //THIS IS THE LINE THAT MY CONSOLE IS SHOWING return null; } catch (SQLException e) { System.out.println("it was not possible to connect to the database."); return null; }
has comment: http://stackoverflow.com/comment/39828510
has comment: http://stackoverflow.com/comment/39830958
has answer: http://stackoverflow.com/a/25517823
has comment: http://stackoverflow.com/comment/39827898
has comment: http://stackoverflow.com/comment/39831518
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/25453794
has comment: http://stackoverflow.com/comment/39828435
possible better answer: http://stackoverflow.com/a/25517823
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/39827855
has title: ClassNotFoundException java

http://stackoverflow.com/comment/39764854
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25479203
has text: It's not *just* `return` that's an exception, but every flow-control statement that exits the `switch`. Still, for beginners it's probably better to be overzealous with `break`s.

http://stackoverflow.com/q/25470879
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39749846
score: 0
tagged with: while-loop
answer count: 3
accepted answer: http://stackoverflow.com/a/25471086
possible better answer: http://stackoverflow.com/a/25471048
tagged with: java
has answer: http://stackoverflow.com/a/25471086
has comment: http://stackoverflow.com/comment/39749629
has answer: http://stackoverflow.com/a/25471048
has body: Sample code: Compilation error: The final local variable flag may already have been assigned final boolean flag; while (flag = false) { // I am using = instead of == just to test it System.out.println("inside loop"); } Compilation error: Unreachable code final boolean flag = false; while (flag) { System.out.println("inside loop"); } I know: The local variable must be initialized before its first use. As per the coding standard the final local variable must be initialized at the time of declaration. Questions: What is the difference between these statements? As per my understanding both are same. Why first sample code doesn't talk about unreachable code. The second compilation error is clear to me. If works fine with if condition final boolean flag; if (flag = false) { // no compilation error System.out.println("inside if block"); } If works fine if I add a break statement in the while loop that ensures the compiler that the final local variable can be initialize just one in its life. final boolean flag; while (flag = false) { System.out.println("inside if block"); break; }
type: Question
has comment: http://stackoverflow.com/comment/39749840
has comment: http://stackoverflow.com/comment/39749858
has comment: http://stackoverflow.com/comment/39749812
tagged with: if-statement
tagged with: final
has comment: http://stackoverflow.com/comment/39749763
has comment: http://stackoverflow.com/comment/39749837
has answer: http://stackoverflow.com/a/25471266
has comment: http://stackoverflow.com/comment/39749833
has title: Different compilation error when final local variable is used with while loop
has comment: http://stackoverflow.com/comment/39749687
has comment: http://stackoverflow.com/comment/39749873

http://stackoverflow.com/comment/39677577
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25431441
has text: @Caleryn yes I strongly agree with you.

http://stackoverflow.com/comment/39721161
type: AnswerComment
comment on: http://stackoverflow.com/a/25454367
score: 0
type: Comment
has text: Added a more specific example.

luajava
tags question: http://stackoverflow.com/q/25488239
type: Tag
tag name: luajava

http://stackoverflow.com/a/25462933
type: Answer
has body: It should be casted to an int, or alternatively, used as String and call the method codepointAt(0) char c='Ɵ'; System.out.println((int)c); System.out.println("Ɵ".codePointAt(0));
answers question: http://stackoverflow.com/q/25462660
score: 0

http://stackoverflow.com/comment/39816770
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25507200
type: QuestionComment
has text: could you give a concrete example of your input and output?

http://stackoverflow.com/a/25423169
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25422244
score: 1
has body: You can use recursion in this case, to find your file. You start the searching process in the current/given directory, by checking if your current file matches the given file name. If you find a directory, you continue the recursion searching process in this directory. private static final File findFile(final String rootFilePath, final String fileToBeFound) { File rootFile = new File(rootFilePath); File[] subFiles = rootFile.listFiles(); for (File file : subFiles != null ? subFiles : new File[] {}) { if (file.getAbsolutePath().endsWith(fileToBeFound)) { return file; } else if (file.isDirectory()) { File f = findFile(file.getAbsolutePath(), fileToBeFound); if (f != null) { return f; } } } return null; // null returned in case your file is not found } public static void main(final String[] args){ File fileToBeFound = findFile("C:\\", "INPUT.txt"); // search for the file in all the C drive System.out.println(fileToBeFound != null ? fileToBeFound.getAbsolutePath() : "Not found"); //you can also use your current workspace directory, if you're sure the file is there fileToBeFound = findFile(new File(".").getAbsolutePath() , "INPUT.txt"); System.out.println(fileToBeFound != null ? fileToBeFound.getAbsolutePath() : "Not found"); }
downvote count: 0

http://stackoverflow.com/a/25457643
has comment: http://stackoverflow.com/comment/39724742
has comment: http://stackoverflow.com/comment/39724802
type: Answer
answers question: http://stackoverflow.com/q/25457585
score: 0
has comment: http://stackoverflow.com/comment/39724685
has comment: http://stackoverflow.com/comment/39724846
has body: To add a new dimension value, try creating a new line in the dimens.xml file under the values folder, that looks like: value
has comment: http://stackoverflow.com/comment/39724766

http://stackoverflow.com/comment/39603725
type: QuestionComment
comment on: http://stackoverflow.com/q/25392664
type: Comment
score: 3
has text: `Can anyone please suggest what I am doing wrong?` - only if you tell us what's going wrong.

http://stackoverflow.com/comment/39727249
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25458887
type: Comment
has text: Nice it Refresh the pager , but it not removing deleted image....

http://stackoverflow.com/comment/39822387
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25510070
score: 0
has text: I have. All of the above stack trace is generated by Hibernate, not me. All I am doing is calling merge in Hibernate, which is a common way of updating data. Hibernate is throwing the above error.

http://stackoverflow.com/q/25515860
answer count: 2
has body: I have a project where the service interfaces are annotated with a @Service annotation (custom annotation, not Spring) and there can be multiple implementation for each service (hibernate, mongodb, etc). I am trying to load the implementation classes using reflection like this: Step 1: Load all the interfaces with @Service annotation Step 2: Load all sub classes for each of the interfaces Here is the code: public static void main(String[] args) throws Exception{ Reflections reflections = new Reflections("net.jitix.cfs"); //load annotated interfaces Set&lt;Class&lt;?&gt;&gt; types=reflections.getTypesAnnotatedWith(Service.class); Iterator&lt;Class&lt;?&gt;&gt; typeIterator=types.iterator(); typeIterator.forEachRemaining(new Consumer&lt;Class&lt;?&gt;&gt;() { @Override public void accept(Class&lt;?&gt; type) { if(!type.isInterface()){ typeIterator.remove(); } } }); for(Class&lt;?&gt; type:types){ //load implementation classes Set&lt;Class&lt;?&gt;&gt; implTypes=reflections.getSubTypesOf(type); //error here } //rest of the code } The compile error I am getting: Type mismatch: cannot convert from Set&lt;Class&lt;? extends capture#8-of ?&gt;&gt; to Set&lt;Class&lt;?&gt;&gt; As per my understanding Class&lt;?&gt; signifies that the type can be anything, so I am confused why the method that requires Class&lt;T&gt; cannot take Class&lt;?&gt; as parameter. Could anyone please help me understand why this is happening? Is there any possible alternatives to my approach? Thanks in advance! EDIT: As per the comment by @MGorgon and answers by @StriplingWarrior and @Sotirios Delimanolis using the reflections method is out of question. Is there any way we can get the sub type of a type whose reference is of type Class&lt;?&gt;
linked to: http://stackoverflow.com/q/2745265
has comment: http://stackoverflow.com/comment/39833604
has comment: http://stackoverflow.com/comment/39834048
possible better answer: http://stackoverflow.com/a/25516097
accepted answer: http://stackoverflow.com/a/25516011
has title: Getting subclasses from Class<?>
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39833830
has comment: http://stackoverflow.com/comment/39833479
tagged with: reflections
has comment: http://stackoverflow.com/comment/39833500
tagged with: reflection
tagged with: java
linked to: http://stackoverflow.com/q/1292109
has answer: http://stackoverflow.com/a/25516097
has comment: http://stackoverflow.com/comment/39833637
has answer: http://stackoverflow.com/a/25516011
linked to: http://stackoverflow.com/q/9921676
type: Question

http://stackoverflow.com/q/25421365
linked to: http://stackoverflow.com/q/7918571
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25421880
tagged with: android
linked to: http://stackoverflow.com/q/10032316
possible better answer: http://stackoverflow.com/a/25421393
has title: Android - Showing Alert Dialog leads to BadTokenException in Service class
tagged with: service
type: AnsweredQuestion
tagged with: gps
has answer: http://stackoverflow.com/a/25421393
answer count: 2
linked to: http://stackoverflow.com/q/4343393
tagged with: java
has comment: http://stackoverflow.com/comment/39656733
downvote count: 0
has comment: http://stackoverflow.com/comment/39656898
upvote count: 1
score: 1
has body: I am reading GPS info and sending it to the network every 10 seconds. What I am doing is using an handler which runs my service class GPSTracker public void startGpsService() { handler = new Handler(); task = new Runnable() { @Override public void run() { gps = new GPSTracker(getApplicationContext()); if (gps.canGetLocation()) { ... do something } else { // GPS or Network is not enabled gps.showSettingsAlert(); } handler.postDelayed(task, 10000); } }; task.run(); } if my GPS setting are not enabled gps.showSettingsAlert(); is executed import android.app.AlertDialog; import android.app.Service; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.IBinder; import android.provider.Settings; import android.util.Log; public class GPSTracker extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location; // location double latitude; double longitude; double speed; public double altitude; // The minimum distance to change Updates in meters private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters // The minimum time between updates in milliseconds private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute // Declaring a Location Manager protected LocationManager locationManager; public GPSTracker(Context context) { this.mContext = context; getLocation(); } public Location getLocation() { try { locationManager = (LocationManager) mContext .getSystemService(LOCATION_SERVICE); // getting GPS status isGPSEnabled = locationManager .isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManage…
accepted answer: http://stackoverflow.com/a/25421880

jaxp
type: Tag
tags question: http://stackoverflow.com/q/25486726
tag name: jaxp

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/25504999
tags question: http://stackoverflow.com/q/25421914
tags question: http://stackoverflow.com/q/25487113
tags question: http://stackoverflow.com/q/25449438
tags question: http://stackoverflow.com/q/25425939
tags question: http://stackoverflow.com/q/25457474
tags question: http://stackoverflow.com/q/25506796
tags question: http://stackoverflow.com/q/25511672
tags question: http://stackoverflow.com/q/25484168
tags question: http://stackoverflow.com/q/25489564
tags question: http://stackoverflow.com/q/25455123
tags question: http://stackoverflow.com/q/25449445
tags question: http://stackoverflow.com/q/25491391
tags question: http://stackoverflow.com/q/25480478
tags question: http://stackoverflow.com/q/25481129
tags question: http://stackoverflow.com/q/25446337
tags question: http://stackoverflow.com/q/25510724
tags question: http://stackoverflow.com/q/25520130
tags question: http://stackoverflow.com/q/25425243
tags question: http://stackoverflow.com/q/25450455
tags question: http://stackoverflow.com/q/25484363
tags question: http://stackoverflow.com/q/25434493
tags question: http://stackoverflow.com/q/25513868
tags question: http://stackoverflow.com/q/25465791
tag name: json
tags question: http://stackoverflow.com/q/25462834
tags question: http://stackoverflow.com/q/25514807
tags question: http://stackoverflow.com/q/25429237
tags question: http://stackoverflow.com/q/25486782
tags question: http://stackoverflow.com/q/25499124
tags question: http://stackoverflow.com/q/25407527
tags question: http://stackoverflow.com/q/25423883
tags question: http://stackoverflow.com/q/25483379
tags question: http://stackoverflow.com/q/25535387
tags question: http://stackoverflow.com/q/25493083
tags question: http://stackoverflow.com/q/25477611
tags question: http://stackoverflow.com/q/25475881
tags question: http://stackoverflow.com/q/25440547
tags question: http://stackoverflow.com/q/25521784
tags question: http://stackoverflow.com/q/25398081
tags question: http://stackoverflow.com/q/25403171
tags question: http://stackoverflow.com/q/25407433
tags question: http://stackoverflow.com/q/25439914
tags question: http://stackoverflow.com/q/25420304
tags question: http://stackoverflow.com/q/25546651
tags question: http://stackoverflow.com/q/25447153
tags question: http://stackoverflow.com/q/25494339
tags question: http://stackoverflow.com/q/25413093
tags question: http://stackoverflow.com/q/25460661
tags question: http://stackoverflow.com/q/25494434
tags question: http://stackoverflow.com/q/25414007
tags question: http://stackoverflow.com/q/25496503
tags question: http://stackoverflow.com/q/25408575
tags question: http://stackoverflow.com/q/25545984
tags question: http://stackoverflow.com/q/25542798
tags question: http://stackoverflow.com/q/25475023
tags question: http://stackoverflow.com/q/25412734
tags question: http://stackoverflow.com/q/25517868
tags question: http://stackoverflow.com/q/25397596
tags question: http://stackoverflow.com/q/25425801
tags question: http://stackoverflow.com/q/25482299
tags question: http://stackoverflow.com/q/25437210
tags question: http://stackoverflow.com/q/25420167
tags question: http://stackoverflow.com/q/25506056
tags question: http://stackoverflow.com/q/25441135
tags question: http://stackoverflow.com/q/25430870
tags question: http://stackoverflow.com/q/25498329
tags question: http://stackoverflow.com/q/25522309
tags question: http://stackoverflow.com/q/25529002
tags question: http://stackoverflow.com/q/25420810
tags question: http://stackoverflow.com/q/25434368
tags question: http://stackoverflow.com/q/25446489
tags question: http://stackoverflow.com/q/25488167
tags question: http://stackoverflow.com/q/25419741
tags question: http://stackoverflow.com/q/25474907
tags question: http://stackoverflow.com/q/25425419
tags question: http://stackoverflow.com/q/25484726
tags question: http://stackoverflow.com/q/25440431
tags question: http://stackoverflow.com/q/25497258
tags question: http://stackoverflow.com/q/25404290

http://stackoverflow.com/q/25502457
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39807981
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has title: Change values received from database
type: Question
has comment: http://stackoverflow.com/comment/39807834
type: UnansweredQuestion
has body: I have a JSON file to be generated from this Graph class using the GSON library. This is the code of the class Graph : public class Graph { private List&lt;Node&gt; nodes; private List&lt;Link&gt; links; // Constructors, Getters and Setters } This is the code of the class Node : public class Node { private String name; private int group; private Set&lt;Link&gt; linksForTarget = new HashSet&lt;Link&gt;(0); private Set&lt;Link&gt; linksForSource = new HashSet&lt;Link&gt;(0); // Constructors, Getters and Setters } This is the code of the class Link : public class Link { private Integer idLink; private Node nodeByTarget; private Node nodeBySource; // The two above 'nodeByTarget' and 'nodeBySource' // are foreign keys to `Node` class // Constructors, Getters and Setters } This is the JSON file I would like to generate : { "nodes":[ {"name":"Myriel","group":1}, {"name":"Napoleon","group":1}, {"name":"Mlle.Baptistine","group":2}, {"name":"Mme.Hucheloup","group":2} ], "links":[ {"source":1,"target":0}, {"source":2,"target":0}, {"source":3,"target":1}, {"source":3,"target":2} ] } The problem is that when I get the values from the database and parse them to JSON (using GSON tool) the sources and targets of the links I get are bigger than expected by 1 (since the database's auto-increment never starts with 0) so I get something like this : { "nodes":[ {"name":"Myriel","group":1}, {"name":"Napoleon","group":1}, {"name":"Mlle.Baptistine","group":2}, {"name":"Mme.Hucheloup","group":2} ], "links":[ {"source":2,"target":1}, {"source":3,"target":1}, {"source":4,"target":2}, {"source":4,"target":3} ] } And that is not working for me! Now the idea to reduce the values of the sources and targets I get from the database by 1. I have tried this code : public static List&lt;Link&gt; listLinks() { SessionFactory sf = HibernateUtil.getSessionFactory(); Session session = sf.openSession(); List&lt;Link&gt; links = session.createQuery("from Link").list(); List&lt;Link&gt; modLinks = new ArrayL…

http://stackoverflow.com/q/25404865
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/33126149
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25407019
has title: how to get the features from Geoserver using REST
type: Question
tagged with: openlayers
tagged with: rest
has answer: http://stackoverflow.com/a/33126149
tagged with: java
has body: I have installed Geoserver on my local system. And i am accessing the layers using WFS in OpenLayers, to Show the data. But i need to add the data(features) from the Java code using REST. where can i get information on those.. Help me on how to proceed further to save my geospatial data into Geoserver from Java code.
possible better answer: http://stackoverflow.com/a/25407019
tagged with: geoserver

jetty-9
tag name: jetty-9
tags question: http://stackoverflow.com/q/25485643
type: Tag

http://stackoverflow.com/q/25486800
tagged with: java
linked to: http://stackoverflow.com/q/22650289
has answer: http://stackoverflow.com/a/25487272
downvote count: 0
has title: Compile time error for generic type
upvote count: 1
has answer: http://stackoverflow.com/a/25486913
favorite count: 0
has comment: http://stackoverflow.com/comment/39778862
has body: Normally, in eclipse, I can run my code without any compilation error. However, with ant file, I have faced with error: type argument Map is not within bounds of type-variable Type. What is wrong with my ant file? The code I take error; [javac] class StratI implements Strat<Map> { [javac] ^ [javac] where T is a type-variable: [javac] T extends Map<?,?> declared in interface Strat [javac] 1 error Ant - javac portion; <src path="${src.dir}" /> <classpath refid="classpath" /> Note: I have search Google for this error. I dont see any source which tells the real reason and shows how to solve it.
type: Question
has comment: http://stackoverflow.com/comment/39779749
tagged with: javac
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25487235
tagged with: ant
has comment: http://stackoverflow.com/comment/39779415
has comment: http://stackoverflow.com/comment/39778237
has comment: http://stackoverflow.com/comment/39778365
has comment: http://stackoverflow.com/comment/39778286
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39778202
has comment: http://stackoverflow.com/comment/39779259
has comment: http://stackoverflow.com/comment/39780361
answer count: 3
has comment: http://stackoverflow.com/comment/39782650
has comment: http://stackoverflow.com/comment/70927631
linked to: http://stackoverflow.com/q/976441
score: 1

http://stackoverflow.com/comment/110008198
has text: I recommend you don’t use `java.util.Date`. That class is poorly designed and long outdated. Instead use `LocalDate` from [java.time, the modern Java date and time API](https://docs.oracle.com/javase/tutorial/datetime/).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25458832
score: 0

http://stackoverflow.com/comment/39738861
comment on: http://stackoverflow.com/a/25465266
score: 0
type: Comment
has text: @BheshGurung This example given is a contrived one, and yes, rather awkward, but it was for brevity's sake. In reality I am extending a class from a library which I have no control of the code. In particular the View class of the Android API
type: AnswerComment

http://stackoverflow.com/comment/39848704
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25524568
has text: @christopher, when I chose value from ComboBox i get error `Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String at com.magazyn.view.View$9.itemStateChanged(View.java:659) at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1223) at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1280)`
type: Comment

http://stackoverflow.com/comment/39625525
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25404088
has text: Would a Java `long` not be sufficient? That gives you 18 orders of magnitude to play with, and will be much cheaper than BigDecimal.
type: QuestionComment

http://stackoverflow.com/comment/39666700
score: 0
comment on: http://stackoverflow.com/q/25426778
type: QuestionComment
has text: @Androidiseverythingforme Why the hell log cat is required@CodeMagic has clearly stated the reason and u have also stated the same reason
type: Comment

http://stackoverflow.com/q/25506899
type: UnansweredQuestion
has body: I am using latest jars 1.5.3 from https://java.net/projects/javamail/lists/users/archive/2012-08/message/0 in android Properties props = System.getProperties(); props.setProperty("mail.store.protocol", "gimaps"); Session session = Session.getInstance(props); GmailSSLStore store = (GmailSSLStore) session.getStore("gimaps"); store.connect("-SNIP-@gmail.com", "-SNIP-"); and this error in last line "No provider for gimaps"
tagged with: android
has comment: http://stackoverflow.com/comment/39816314
has comment: http://stackoverflow.com/comment/39838423
tagged with: gmail-imap
has comment: http://stackoverflow.com/comment/39887473
has title: Gmail in Android - Getting No provider for gimaps
has comment: http://stackoverflow.com/comment/39873891
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39904193
has comment: http://stackoverflow.com/comment/39878042
type: Question
tagged with: gmail-api
answer count: 0

http://stackoverflow.com/comment/39835088
comment on: http://stackoverflow.com/a/25516279
score: 0
type: Comment
has text: I actually have decided to use a combination of both your solution and @DavidConrad 's solution.
type: AnswerComment

http://stackoverflow.com/comment/39850709
has text: The above applies to workspaces created with Luna. Interestingly, I just opened in Luna a workspace that had been created with Kepler. Luna prompted me that the workspace would be converted; then I searched for the very same references and they were found.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25525332
score: 0

http://stackoverflow.com/comment/39667165
type: QuestionComment
comment on: http://stackoverflow.com/q/25426917
has text: Step 1: Pick a language. Step 2: ? Step 3: Profit.
score: 3
type: Comment

graph
tags question: http://stackoverflow.com/q/25428833
tags question: http://stackoverflow.com/q/25508143
tags question: http://stackoverflow.com/q/25442365
tags question: http://stackoverflow.com/q/25529042
tags question: http://stackoverflow.com/q/25416929
tag name: graph
type: Tag
tags question: http://stackoverflow.com/q/25405165

http://stackoverflow.com/q/25549265
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4325639
tagged with: android
score: -3
tagged with: javascript
has body: I have this javascript code: &lt;html&gt; &lt;head&gt; &lt;script&gt; for(i=0;i&lt;6;i++) { document.write("my number is "+ i ); } &lt;/script&gt; &lt;/head&gt; &lt;/html&gt; I want to take the output of this javascript code and save in String in android. like this: my number is 0my number is 1my number is 2my number is 3my number is 4my number is 5 How can i do this in android?
upvote count: 0
has title: get output of javascript on android
downvote count: 3
tagged with: java
answer count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25549387
linked to: http://stackoverflow.com/q/10472839

http://stackoverflow.com/q/25428768
has title: Java (eclipse): How to call a int or string from another class in same project?
has answer: http://stackoverflow.com/a/25428928
has comment: http://stackoverflow.com/comment/39670353
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39670461
type: Question
possible better answer: http://stackoverflow.com/a/25428884
has answer: http://stackoverflow.com/a/25428884
downvote count: 0
upvote count: 1
tagged with: string
accepted answer: http://stackoverflow.com/a/25428937
has comment: http://stackoverflow.com/comment/39670497
favorite count: 0
has answer: http://stackoverflow.com/a/25428937
tagged with: class
type: AnsweredQuestion
answer count: 3
score: 1
tagged with: java
has body: How can I use an int or string from another class in same project, for example, here we go with a class called Estadisticas: public class Estadisticas { public void stats() { final String c1 = "Tu personaje"; final int Nivel = 1; final int Salud = 50; final int Ataque = 2; final int Defensa = 1; final String c2 = "Primer monstruo - Rata rabiosa"; final int SaludM1 = 2; final int AtaqueM1 = 1; } } And I want to know how to call for example the String c1 to println like this: public class Start extends Estadisticas { public static void main() { System.out.println(String c1); } } After reading some example codes and people with similar problem, I tried with extends Estadisticas with no luck, and I'm putting this code as I don't know how to call that string from another class in same project. Thanks in advance! Cristobal.

http://stackoverflow.com/comment/39743004
score: 0
comment on: http://stackoverflow.com/q/25467498
has text: The structure of your `stringToEnglish()` method should be similar to your `stringToBinary()` method - within `stringToBinary()` you convert each character to your representation - now do the inverse in `stringToEnglish()`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25549400
tagged with: volatile
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/25550309
has title: Is 'program order' in Java allows reordering?
tagged with: jls
linked to: http://stackoverflow.com/q/25548547
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39894982
has answer: http://stackoverflow.com/a/46261970
score: 0
possible better answer: http://stackoverflow.com/a/46261970
has body: In one thread I have write a = 0 write a = 1 write volatile flag = 1 In 2nd thread I have read volatile flag // This always happens after I write volatile flag in thread 1 read a Can a reordering happen so I see read a returning 0 in the 2nd thread? If not, could someone, please, explain in detail why? I'm asking becuase I'm puzzled by this definition from the JLS: Among all the inter-thread actions performed by each thread t, the program order of t is a total order that reflects the order in which these actions would be performed according to the intra-thread semantics of t. It looks as if allows for reordering in this situation?
tagged with: java
has answer: http://stackoverflow.com/a/25550309
downvote count: 1
linked to: http://stackoverflow.com/q/4919392
has comment: http://stackoverflow.com/comment/39894469
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39894879
upvote count: 1

http://stackoverflow.com/comment/39791895
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25493256
has text: exactly what i was thinking @Totora.
score: 0

http://stackoverflow.com/q/25495543
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39795271
has comment: http://stackoverflow.com/comment/39795476
has comment: http://stackoverflow.com/comment/39795529
has comment: http://stackoverflow.com/comment/39795308
has comment: http://stackoverflow.com/comment/39795907
has comment: http://stackoverflow.com/comment/39795559
has answer: http://stackoverflow.com/a/25496307
has body: Hi I am trying to create a class which plays sounds when I call them in a method. However, I get a null pointer Exception every time i try to play a sound. I cannot figure out what object I have referenced but not linked, everything looks good to me! import java.applet.*; import javax.swing.*; import java.net.*; public class Sound extends JApplet// Holds one audio file { private AudioClip song; // Sound player private URL songPath; //audio path public Sound(String filename) { try { songPath = new URL(getCodeBase(),filename); // Get the Sound URL song = Applet.newAudioClip(songPath); // Load the Sound } catch(Exception e){e.printStackTrace();} // Satisfy the catch } public void playSound() { song.loop(); // Play } public void stopSound() { song.stop(); // Stop } public void playSoundOnce() { song.play(); // Play only once } public static void main(String[] args) { Sound s = new Sound("gameover.wav"); s.playSoundOnce(); } }
tagged with: java
has comment: http://stackoverflow.com/comment/39795393
has title: Java implementing sound clips, NullPointerException
type: Question
score: 0

http://stackoverflow.com/comment/39793140
has text: @Volune SplitS[0] is the array of split strings ex abc 123 are 2, [1] is the 2nd character in the string. Sorry if that wasn't clear. Ex abc[1] = b
comment on: http://stackoverflow.com/a/25435458
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39784289
has text: I have edited my code with your changes. As you can see, there are pre existing times in the rowdata array. As the time changes, I should only see the values that are near the current time in the table. It should show in the table. So every time the time changes, I should see different values every time. @peeskillet
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25488992
type: Comment

http://stackoverflow.com/q/25500199
has answer: http://stackoverflow.com/a/44019304
has answer: http://stackoverflow.com/a/25500503
has answer: http://stackoverflow.com/a/25500535
has comment: http://stackoverflow.com/comment/39803497
downvote count: 2
has answer: http://stackoverflow.com/a/25502421
upvote count: 7
linked to: http://stackoverflow.com/q/21219667
has answer: http://stackoverflow.com/a/25501381
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39803528
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25500299
linked to: http://stackoverflow.com/q/1484347
tagged with: java
has comment: http://stackoverflow.com/comment/39803610
accepted answer: http://stackoverflow.com/a/25500254
has title: find smallest positive number in an array
has answer: http://stackoverflow.com/a/44019778
answer count: 11
has answer: http://stackoverflow.com/a/25500254
has body: So ... I have : int array[] = {-8,2,0,5,-3,6,0,9}; I want to find the smallest positive number ( which in the list above is 2 ) This is what i am doing : int array[] = {-8,2,0,5,-3,6,0,9}; int smallest=0; for(int i=0;i&lt;array.length;i++) // Find the first number in array&gt;0 (as initial // value for int smallest) { if(array[i]&gt;0) { smallest=array[i]; break;// Break out of loop, when you find the first number &gt;0 } } for(int i=0;i&lt;array.length;i++) // Loop to find the smallest number in array[] { if(smallest&gt;array[i]&amp;&amp;array[i]&gt;0) { smallest=array[i]; } } System.out.println(smallest); } My question is : Can we reduce the number of steps ? Is there any smarter/shorter way of doing it, with no other data structure. Thanks.
has answer: http://stackoverflow.com/a/25500234
has answer: http://stackoverflow.com/a/25500345
possible better answer: http://stackoverflow.com/a/25500503
score: 5
has answer: http://stackoverflow.com/a/41414618

http://stackoverflow.com/q/25478223
answer count: 2
linked to: http://stackoverflow.com/q/4393940
tagged with: classloader
has title: Why is custom system classloader not working?
downvote count: 0
accepted answer: http://stackoverflow.com/a/25493910
has answer: http://stackoverflow.com/a/25493910
favorite count: 0
type: Question
type: AnsweredQuestion
tagged with: java
score: 10
possible better answer: http://stackoverflow.com/a/25489403
has answer: http://stackoverflow.com/a/25489403
upvote count: 10
has body: I'm trying to override the system's class loader using the flag -Djava.system.class.loader=MyLoader. However, MyLoader is still not being used when classes are loaded. MyLoader's code: public class MyLoader extends ClassLoader { public MyLoader(ClassLoader parent) { super(S(parent)); } private static ClassLoader S(ClassLoader cl) { System.out.println("---MyLoader--- inside #constructor(" + cl + ")..."); return cl; } @Override public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { System.out.println("---MyLoader--- inside loadClass(" + name + ", " + resolve + ")..."); return super.loadClass(name, resolve); } } This is the main code: public class Main { public static void main(final String args[]) throws Exception { System.out.println("---Main--- first line"); System.out.println("---Main--- getSystemClassLoader(): " + ClassLoader.getSystemClassLoader()); System.out.println("---Main--- getSystemClassLoader()'s loader: " + ClassLoader.getSystemClassLoader().getClass().getClassLoader()); Call("javax.crypto.Cipher"); } public static void Call(final String class_name) throws Exception { System.out.println("---Main--- calling Class.forName(" + class_name + ")..."); Class.forName(class_name); System.out.println("---Main--- call complete"); } } This is the output using the command java -Djava.system.class.loader=MyLoader -verbose -Xshare:off Main (cf. Eclipse run config): [Opened C:\Program Files\Java\jre7\lib\rt.jar] [Loaded java.lang.Object from C:\Program Files\Java\jre7\lib\rt.jar] [Loaded java.io.Serializable from C:\Program Files\Java\jre7\lib\rt.jar] // etc etc... omitted since it's too long [Loaded MyLoader from file:/C:/Documents%20and%20Settings/Owner/Desktop/Programs/Eclipse%20Workspace%202/Test93/bin/] ---MyLoader--- inside #constructor(sun.misc.Launcher$AppClassLoader@158046e)... [Loaded sun.launcher.LauncherHelper from C:\Program Files\Java\jre7\lib\rt.jar] [Loaded java.lang.StringCoding from C:\Program Files\Java\jre7\lib\rt.jar…

http://stackoverflow.com/comment/39849846
comment on: http://stackoverflow.com/q/25523765
score: 0
type: Comment
has text: Exact same problem: http://stackoverflow.com/questions/24587218/android-util-androidruntimeexception-you-cannot-combine-swipe-dismissal-and-the
type: QuestionComment

http://stackoverflow.com/q/25412824
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/25412845
has answer: http://stackoverflow.com/a/25412885
favorite count: 0
type: Question
has body: I am new to Java (as of today!) and am trying to run a very simple program in terminal. Normally, when I run a python (still pretty new) program in Terminal I would simple type in "python name.py" in to terminal and it would run. When I type "Java name.java" it does absolutely nothing. I opened TextWrangler and selected "Run in Terminal" and it returned this error: "This file doesn't appear to contain a valid 'shebang' line (application error code: 13304)" My program is named "hello.java" and it contains the code below. What am I doing wrong? System.out.println("Hello!");
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25412849
tagged with: macos
answer count: 3
has title: How do I run a Java program on Terminal (Mac)?
downvote count: 0

http://stackoverflow.com/comment/41857329
score: 0
comment on: http://stackoverflow.com/q/25483627
has text: I moved to JBoss wildfly-8.0.0.Final with domain model. I could achieve the zero down time deployment with 2 server groups. The only drawback is, users whose requests are 'in process' will get an error 500. If the request processing is completed, this approach will work fine with session replication. By the way this requirement was not the reason to migrate to Wildfly.
type: Comment
type: QuestionComment

port
tags question: http://stackoverflow.com/q/25396459
tags question: http://stackoverflow.com/q/25431436
tags question: http://stackoverflow.com/q/25512243
type: Tag
tags question: http://stackoverflow.com/q/25428405
tag name: port

http://stackoverflow.com/comment/39654386
comment on: http://stackoverflow.com/q/25406231
score: 0
has text: Never seen that. What do you mean by 'integrated in the project'?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39674783
type: QuestionComment
has text: The other problem is that you blindly copied this code without understanding it.
type: Comment
comment on: http://stackoverflow.com/q/25430631
score: 0

http://stackoverflow.com/comment/39706078
score: 5
type: QuestionComment
comment on: http://stackoverflow.com/q/25448196
type: Comment
has text: You've just discovered what happens when you try to fit 21 numbers in an array of size 20

http://stackoverflow.com/q/25399001
has comment: http://stackoverflow.com/comment/39615123
type: Question
has answer: http://stackoverflow.com/a/25399498
tagged with: temperature
has title: Parse a string from a sensor containing 3 floats
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39615195
score: 0
has answer: http://stackoverflow.com/a/25399474
accepted answer: http://stackoverflow.com/a/25399498
has comment: http://stackoverflow.com/comment/39615330
possible better answer: http://stackoverflow.com/a/25399474
answer count: 3
has body: I'm trying to parse information from a temperature sensor. Sensors sends a String with the format: Temp: 1 388 2 358 3 200? Temp: 1 388 2 200? 3 200? (First String contains a valid channel 2 sample and channel 3 disconnected, and second String has channel 2 and 3 disconnected). I need to parse those "dat" which is a float without the dot, and I cant use String.split() because if the sensor doesn't detects anything it adds a '?' to the end of "dat". Output should be: Temp[0]= 38.8 Temp[1]= 35.8 Temp[2]= 20.0 Also I need to parse that '?' to say if a channel it's disconnected.
tagged with: java
tagged with: sensors
has comment: http://stackoverflow.com/comment/39615414
has answer: http://stackoverflow.com/a/25399578

http://stackoverflow.com/comment/39741087
score: 0
comment on: http://stackoverflow.com/q/25436422
type: QuestionComment
has text: I have just checked if I could call LogManager.getLogger() and it worked for me. Could you please provide a sample (your environment packaged into a zip or a code snippet of log4j initialization) to reproduce the problem?
type: Comment

http://stackoverflow.com/q/25501876
has body: We have a Java web application (using struts and hibernate) and want the users to automatically log into the Google apps domain accounts. We have set up the Google apps for Education domain accounts and created the users in it and we have the same users in our java web application also. The requirement is that when the users log into our application portal, their is a link to go to Google apps, once they click on this link, it should log them in without asking for password. We are using Tomcat 7 as our server for the web application. Which SSO tool should we use for doing this? Oracle's SSO is paid, Shiboleth doesn't work with Tomcat 7. Any help highly appreciated? Is SSO the only option or another way to do this. Thanks
tagged with: java
has title: Google Apps domain integration
type: Question
tagged with: single-sign-on
has answer: http://stackoverflow.com/a/25502402
type: UnansweredQuestion
score: 0
answer count: 1
tagged with: web-applications
tagged with: google-apps-for-education

http://stackoverflow.com/comment/39767095
score: 0
has text: Month is 0 indexed, meaning Year = 2014 Month = 0 Day = 11 is jan 11 2014, which is the date 60 days before 12 march 2014
type: Comment
comment on: http://stackoverflow.com/q/25480570
type: QuestionComment

http://stackoverflow.com/q/25471319
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/3481828
type: UnansweredQuestion
tagged with: android
has title: How to get in String from String Array by Split in Java Android
has answer: http://stackoverflow.com/a/25471372
score: 0
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/25471343
has body: This is my Result where i got response from server that I want to get by Soap.I can parse this value by JSON but I'm having a problem doing so as I wish to get this value split. Result=1~Saved successfully~{ "TABLE":[{ "ROW":[ { "COL":{ "UserID":"30068"}} ]}]} I am using this code to get UserId values in tmpVal, however am not obtaining my desired results. String tmpVal = returnValue.toString().split("~")[3];
has comment: http://stackoverflow.com/comment/39749970
tagged with: java
tagged with: http://stackoverflow.com/tag/json
favorite count: 0

http://stackoverflow.com/comment/39840503
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25519613
score: 0
has text: if issue come on production that is on other country and I am in india. I need solve issue instantly.On production side any server log will generated to track the issue or any logger which is the source that can give me tracking issue.(because code has been done my side and after sending to production i need only solution )

virtual-machine
tag name: virtual-machine
type: Tag
tags question: http://stackoverflow.com/q/25474527

http://stackoverflow.com/comment/39822969
comment on: http://stackoverflow.com/a/25456442
score: 0
type: AnswerComment
has text: The problem with this approach is in lines 2 and 3: I don't have control over the vendor-provided classes ABCObject and XYZObject, so I can have them implement a common interface.
type: Comment

http://stackoverflow.com/q/25485434
has comment: http://stackoverflow.com/comment/39777092
has title: Can't connect to PostgreSQL with JDBC driver
tagged with: postgresql
type: Question
tagged with: java
tagged with: jdbc
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/39785428
has comment: http://stackoverflow.com/comment/39775710
upvote count: 2
score: 2
has answer: http://stackoverflow.com/a/25507473
downvote count: 0
tagged with: mysql
answer count: 1
has comment: http://stackoverflow.com/comment/39775571
favorite count: 0
has body: I have my Spring MVC app. dispatcher-servlet.xml &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="org.postgresql.Driver"/&gt; &lt;property name="url" value="jdbc:postgresql://localhost:5432/dailyjob"/&gt; &lt;property name="username" value="root"/&gt; &lt;property name="password" value="root"/&gt; &lt;/bean&gt; When my app is trying to connect to the database, I get the exception Caused by: org.postgresql.util.PSQLException: ?????: ???????????? "root" ?? ?????? ???????? ??????????? (?? ??????) at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:398) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:173) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:136) at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:29) at org.postgresql.jdbc3g.AbstractJdbc3gConnection.(AbstractJdbc3gConnection.java:21) at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connection.java:31) at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24) at org.postgresql.Driver.makeConnection(Driver.java:393) at org.postgresql.Driver.connect(Driver.java:267) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:208) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:153) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.jav…

http://stackoverflow.com/comment/39848967
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25524106
has text: I mean a very few plugins can be used out side of Eclipse but the majority cannot.
type: Comment

http://stackoverflow.com/q/25546750
tagged with: java
has answer: http://stackoverflow.com/a/25546890
possible better answer: http://stackoverflow.com/a/25546890
answer count: 4
has answer: http://stackoverflow.com/a/25548570
score: 8
upvote count: 8
tagged with: nio2
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/77487381
has title: Merge huge files without loading whole file into memory?
has answer: http://stackoverflow.com/a/25547362
tagged with: java-8
accepted answer: http://stackoverflow.com/a/25548570
favorite count: 0
has body: I want to merge huge files containing strings into one file and tried to use nio2. I do not want to load the whole file into memory, so I tried it with BufferedReader: public void mergeFiles(filesToBeMerged) throws IOException{ Path mergedFile = Paths.get("mergedFile"); Files.createFile(mergedFile); List&lt;Path&gt; _filesToBeMerged = filesToBeMerged; try (BufferedWriter writer = Files.newBufferedWriter(mergedFile,StandardOpenOption.APPEND)) { for (Path file : _filesToBeMerged) { // this does not work as write()-method does not accept a BufferedReader writer.append(Files.newBufferedReader(file)); } } catch (IOException e) { System.err.println(e); } } I tried it with this, this works, hower, the format of the strings (e.g. new lines, etc is not copied to the merged file): ... try (BufferedWriter writer = Files.newBufferedWriter(mergedFile,StandardOpenOption.APPEND)) { for (Path file : _filesToBeMerged) { // writer.write(Files.newBufferedReader(file)); String line = null; BufferedReader reader = Files.newBufferedReader(file); while ((line = reader.readLine()) != null) { writer.append(line); writer.append(System.lineSeparator()); } reader.close(); } } catch (IOException e) { System.err.println(e); } ... How can I merge huge Files with NIO2 without loading the whole file into memory?
linked to: http://stackoverflow.com/q/25553673
type: AnsweredQuestion

http://stackoverflow.com/comment/39857546
has text: no you shouldn't recommend someone uses the old Ansi way of joining tables through the Cartesian Product.. there are many limitations when you dont use JOIN
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25529574
type: Comment

jackson
tags question: http://stackoverflow.com/q/25450455
tags question: http://stackoverflow.com/q/25422835
tags question: http://stackoverflow.com/q/25413842
tags question: http://stackoverflow.com/q/25509699
tags question: http://stackoverflow.com/q/25511604
tag name: jackson
tags question: http://stackoverflow.com/q/25491595
tags question: http://stackoverflow.com/q/25407226
tags question: http://stackoverflow.com/q/25498060
tags question: http://stackoverflow.com/q/25526611
tags question: http://stackoverflow.com/q/25464425
tags question: http://stackoverflow.com/q/25414007
tags question: http://stackoverflow.com/q/25464181
tags question: http://stackoverflow.com/q/25530679
tags question: http://stackoverflow.com/q/25397596
tags question: http://stackoverflow.com/q/25512381
tags question: http://stackoverflow.com/q/25511672
tags question: http://stackoverflow.com/q/25437210
tags question: http://stackoverflow.com/q/25480478
tags question: http://stackoverflow.com/q/25511847
tags question: http://stackoverflow.com/q/25425419
tags question: http://stackoverflow.com/q/25497258
tags question: http://stackoverflow.com/q/25465805
tags question: http://stackoverflow.com/q/25503005
type: Tag
tags question: http://stackoverflow.com/q/25447611
tags question: http://stackoverflow.com/q/25509194
tags question: http://stackoverflow.com/q/25545984
tags question: http://stackoverflow.com/q/25542798
tags question: http://stackoverflow.com/q/25402594
tags question: http://stackoverflow.com/q/25482299
tags question: http://stackoverflow.com/q/25425939
tags question: http://stackoverflow.com/q/25529002
tags question: http://stackoverflow.com/q/25420810

http://stackoverflow.com/comment/39864749
score: 0
comment on: http://stackoverflow.com/q/25490596
type: QuestionComment
has text: could you set logLevel=DEBUG in your liquibase properties file and then attach the log?
type: Comment

http://stackoverflow.com/comment/39749469
type: QuestionComment
has text: The answer is, it depends. A single instance`SwingWorker` is, in of it a single `Thread`. So if you want to process all the files, in the background, but in sequence, then you would use the first method. If on the other hand you want to process all the files in the background in parallel, then you would use the second one, with the previous warning in mind
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25470090

http://stackoverflow.com/a/25467626
score: 0
answers question: http://stackoverflow.com/q/25467579
has body: Just use (without starting slash): try { string = readFile("assets/test.txt",Charset.defaultCharset()); } catch (IOException e) { e.printStackTrace(); } To get path relative to project root.
type: Answer

http://stackoverflow.com/a/25541154
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25541100
has body: This code cannot be reached because you already have a return statement just above double average = sum/array.length; You just need to remove return sum;

http://stackoverflow.com/comment/39842069
type: Comment
comment on: http://stackoverflow.com/a/25517772
score: 0
type: AnswerComment
has text: @Spectre - I dint quite get it. I tried `doc.select("div:contains(Pantry/Catering)").get(1)` and it still dint work for me. Btw, there is only one `"Pantry/Catering"` in the code I posted. So how is it matching twice for you?

http://stackoverflow.com/q/25395016
has comment: http://stackoverflow.com/comment/89941860
score: 12
upvote count: 12
has comment: http://stackoverflow.com/comment/39608289
type: AnsweredQuestion
answer count: 2
tagged with: javafx-8
downvote count: 0
tagged with: tableview
tagged with: java
has comment: http://stackoverflow.com/comment/39608210
has title: How can I add rows and columns to a JavaFX 8 TableView
has answer: http://stackoverflow.com/a/25395661
accepted answer: http://stackoverflow.com/a/25395661
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25395527
possible better answer: http://stackoverflow.com/a/25395527
linked to: http://stackoverflow.com/q/46171183
has comment: http://stackoverflow.com/comment/39608268
has comment: http://stackoverflow.com/comment/39608398
has body: I see examples on the internet for adding a row to a TableView, for example using the Person class in the Oracle documentation. But I have a variable number of columns, so I can't bind to a Person (or any other) bean business object. The Oracle example goes on to show how to bind columns to property names, but for that, it only shows how to add columns, but not rows. My question is, can someone point me to a Hello, World example of dynamically adding arbitrary columns and/or rows to a JavaFX 8 TableView?

http://stackoverflow.com/a/25477979
has body: You can decrement the loop counter (the variable i) from inside the for loop; this may not be the best practice, but it will get the job done. Alternately, you can use a while loop (such as while (i &lt; 11) and increment i only when an acceptable value is entered.
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25477960
score: 1
type: Answer

http://stackoverflow.com/a/25397144
has body: It seems like your app is trying to connect a URL via HttpClient, so, please check your network configuration, i.e. proxy settings, make sure your app can access internet!
answers question: http://stackoverflow.com/q/25397036
has comment: http://stackoverflow.com/comment/39633343
has comment: http://stackoverflow.com/comment/39632747
type: Answer
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/comment/39905867
type: AnswerComment
comment on: http://stackoverflow.com/a/25552079
type: Comment
has text: Well, you are wrong here. However, as you did not answer one of my questions it's hard to give an advise. Once you have set the view criteria you get the count by calling getEstimatedRowCount() Which is a select count(1) from (your_query_with_parameter_in_view Criteria)
score: 0

http://stackoverflow.com/comment/121567280
comment on: http://stackoverflow.com/a/48036841
type: AnswerComment
score: 1
type: Comment
has text: Note: GitHub recently changed its Authentication policy. Users have to use Personal Access Token (P.A.T) instead of password while doing pull or push or clone etc. Take a look at: https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

http://stackoverflow.com/q/25517998
tagged with: embedded-tomcat-7
has title: Tomcat was killed by kernel
score: 1
favorite count: 0
type: Question
answer count: 2
upvote count: 1
type: UnansweredQuestion
tagged with: linux
has comment: http://stackoverflow.com/comment/39837297
has body: My tomcat was auto-shutdown suddenly.I checked in log file and found that It was killed with message: kernel: Killed process 17420, UID 0, (java) total-vm:8695172kB, anon-rss:4389088kB, file-rss:20kB My setting for running tomcat is -Xms2048m -Xmx4096m -XX:NewSize=256m -XX:MaxNewSize=512m -XX:PermSize=256m -XX:MaxPermSize=1024m My system when run command "free -m" is: total used free shared buffers cached Mem: 7859 7713 146 0 97 1600 -/+ buffers/cache: 6015 1844 Swap: 0 0 0 I monitor program with "top -p", the result as below Cpu(s): 0.1%us, 0.0%sy, 0.0%ni, 99.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 8048440k total, 7900616k used, 147824k free, 100208k buffers Swap: 0k total, 0k used, 0k free, 1640888k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4473 root 20 0 8670m 2.5g 6568 S 0.0 32.6 71:07.84 java My question is: 1.Why VIRT = 8670m (in "top -p" result) is greater than Mem: 8048440k total but my application is still running? Why my tomcat was kill by kernel? I don't see any strange with memory (It's similar with when it's running) To avoid this error happen, what will I do and why?
has answer: http://stackoverflow.com/a/25518188
has answer: http://stackoverflow.com/a/25518062
tagged with: java
downvote count: 0

http://stackoverflow.com/q/25406659
tagged with: dynamic
answer count: 0
score: 1
has title: WebServiceTemplate soap ws using dynamic wsdl
tagged with: wsdl
downvote count: 0
upvote count: 1
has body: I am trying to build a soap ws client using WebServiceTemplate but I use a dynamic wsdl and when i configure my bean: <constructor-arg ref="messageFactory" /> I get a null pointer exception because it can not find the endpoint for the wsdl or a 404 not found error. We have 2 dynamically generated WSDLs exposed (using Spring features) this way: <sws:dynamic-wsdl id="x" portTypeName="X" locationUri="/endpoints/" requestSuffix="Request" responseSuffix="Response" targetNamespace="http://example.com/gateway/store/x/schema/v1"> <sws:xsd location="/WEB-INF/classes/schemas/x.xsd" /> </sws:dynamic-wsdl> <sws:dynamic-wsdl id="y" portTypeName="Y" locationUri="/endpoints/" requestSuffix="Request" responseSuffix="Response" targetNamespace="http://example.com/gateway/store/y/schema/v1"> <sws:xsd location="/WEB-INF/classes/schemas/y.xsd" /> </sws:dynamic-wsdl> Any help ?
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: java
tagged with: soap
tagged with: spring

http://stackoverflow.com/q/25443529
answer count: 2
possible better answer: http://stackoverflow.com/a/25443616
tagged with: java
has answer: http://stackoverflow.com/a/25443616
has body: Hi im having trouble with how to user the super() keyword properly. It's a bit difficult to explain so please try to understand. So I have a class called "Window" which is a subclass of another class called "Room". This is Room class with a constructor public class Room { private Position position; private Color color; public Room(Position pos, Color colour){ this.position = pos; this.color = color; } } SO I want to give the doors a color Color.RED A Window object is constructed with an input position parameter. What I have so far is: public class Window extends Room{ private Color color; public Window(Position position, Color color) { super(position, color); this.colour = Color.RED; } However in my other classes there is code that create a new Window with only a position parameter This is example code public class example{ private Window window; private Position position; public example() { } @Before public void create() { position = new Position(4,3); window = new Window(position); } So then it becomes a required and found error, telling me that the length is not right. I understand what the error is telling me. So here is my question. How do I redo the Window constructor so that it will satisfy both the super class and my other classes without those classes being changed.
has comment: http://stackoverflow.com/comment/39697660
has title: required and found error in inheritance
type: Question
accepted answer: http://stackoverflow.com/a/25443601
has comment: http://stackoverflow.com/comment/39697695
has answer: http://stackoverflow.com/a/25443601
tagged with: window
tagged with: required
tagged with: inheritance
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/36504183
answers question: http://stackoverflow.com/q/25515119
score: 1
type: Answer
has body: Have to use to_clob in the query select to_clob(xmlelement ( "employee", 'Bob' )) ) as SQLXMLCOL1 from dual then use the toString() in resultSet
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25443290
has comment: http://stackoverflow.com/comment/39704176
has comment: http://stackoverflow.com/comment/39759626
tagged with: java
has comment: http://stackoverflow.com/comment/39776988
has comment: http://stackoverflow.com/comment/39729109
has body: We noticed frequent Full GC entries in the GC log(for more than 3-4 hrs). Our XmX was 1.2g and all full GC's didn't recover much. VM stayed at around 1 g. To see what is held in the heap, we took the heap dump but in Memory Analyzer Tool, we see only 30% occupied and remaining 70% free. Heap file size is 1g though. we used :live option to take the heap dump. /usr/&lt;java_version&gt;/bin/jmap -dump:live,format=b,file=heap.bin &lt;pid&gt; Is there any other way to get the complete snapshot of heap?
has comment: http://stackoverflow.com/comment/39771768
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39697288
has comment: http://stackoverflow.com/comment/39705460
type: UnansweredQuestion
has title: Several Full GCs, heap size reached XmX which is 1.2g but heap dump shows data only for 200m
has comment: http://stackoverflow.com/comment/39769831
tagged with: jvm
has comment: http://stackoverflow.com/comment/39772121
has comment: http://stackoverflow.com/comment/39774049
type: Question
tagged with: jmap
has comment: http://stackoverflow.com/comment/39844463
has comment: http://stackoverflow.com/comment/39767885

http://stackoverflow.com/q/25398185
has comment: http://stackoverflow.com/comment/39613774
favorite count: 0
tagged with: facet
type: Question
tagged with: aggregation
score: 5
upvote count: 5
has body: In Elasticsearch, We have used terms facet and terms aggregations to cope with the above mentioned problem. Unfortunately, this will surely work for small set of data. But we are dealing with data which would be around 10 million documents. Hence, when we query to fetch all the unique values for field(Eg. company field) by using aggregation(setting "size":0) or facet(using "exclude"), we would not be able to get entire result in one stretch. It seems that elasticsearch would take lot of time to respond and ultimately it results in node failure. The sole purpose of this process was to get count of how many unique values are present in a field(Eg. company, count of unique companies). Any suggestions would be appreciable.
has comment: http://stackoverflow.com/comment/39613867
has title: Elasticsearch, how to get all unique values of a field and count of total unique values?
has comment: http://stackoverflow.com/comment/39617638
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25399093
answer count: 1
tagged with: elasticsearch
downvote count: 0
has answer: http://stackoverflow.com/a/25399093
has comment: http://stackoverflow.com/comment/39615255

http://stackoverflow.com/a/25395891
answers question: http://stackoverflow.com/q/25395700
score: 0
upvote count: 1
downvote count: 1
type: Answer
has body: Simply declare it outside of your methods, like this: String[] array; So, your code would look like this: public class Class1 { public static String[] method1() { array = new String[5]; array[0] = "test"; return array; } public static void main(String[] args) { System.out.println(Arrays.toString(method1())); // Converts array to string } static String[] array; // Declaring global variable } The output should look like this: [test, null, null, null, null]

http://stackoverflow.com/comment/39625449
has text: @biziclop: For that, we'd need to trawl through the source code for the platform-specific native methods, which I don't fancy doing right now ;)
score: 5
type: AnswerComment
comment on: http://stackoverflow.com/a/25404386
type: Comment

http://stackoverflow.com/comment/39650737
type: QuestionComment
comment on: http://stackoverflow.com/q/25417583
has text: hmmm.. i tried this yet still the same .. `var A = document.mainform.NAME_1.value; window.parent.document.getElementsByName("name").value= A; window.close();`
score: 0
type: Comment

http://stackoverflow.com/a/25459645
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25458911
has body: I was doing it wrong. JTextArea is for simple text. If you want to add bold, italic text and/or special characters to your text, use JEditPane() or JTextPane() , do all your styling stuff in StyledDocument and finally add StyledDocument to yourJTextPane or JEditPane For readres who might be confused about these things. A lot of good examples can be found here
type: Answer

http://stackoverflow.com/a/25422844
score: 0
has comment: http://stackoverflow.com/comment/39668255
has body: your .classpath file must have line &lt;classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/&gt; Open navigator view and check .classpath file contents If you are using another jdk ... u should see JRE NAME you added instead of JRE_CONTAINER like &lt;classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_27"/&gt;
has comment: http://stackoverflow.com/comment/39730246
type: Answer
answers question: http://stackoverflow.com/q/25422595
has comment: http://stackoverflow.com/comment/39730236

http://stackoverflow.com/comment/39741816
has text: I just realized, that it doesn't do anything when dragged.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25465426

http://stackoverflow.com/comment/39894389
comment on: http://stackoverflow.com/a/25549416
type: AnswerComment
score: 0
type: Comment
has text: @End.Game I've updated my answer, it was wrong before. Note however that this is not the best way to do it.

http://stackoverflow.com/q/25491715
tagged with: selenium-webdriver
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25496142
type: Question
type: UnansweredQuestion
answer count: 1
has body: I have a flag of type boolean "worklogMatch". I need to assert this flag for 'true'. If this is not true, I would need to print the ERROR value. Here is my code, List&lt;WebElement&gt; worklogObj = driver().findElements(By.xpath("//div[@class='ng-scope']"); boolean worklogMatch = false; ArrayList&lt;String&gt; worklogDescriptions = new ArrayList&lt;String&gt;(); for(int i=0; i&lt;worklogObj.size(); i++) { worklogDescriptions.add(worklogObj.get(i).getText()); log.info("Text of the worklogs: "+worklogObj.get(i).getText()); if (worklogObj.get(i).getText().equals(worklogDescription)){ worklogMatch = true; break; } } assertTrue(worklogMatch == true, "worklog Description "+worklogDescription + " is not saved. List of "+ "worklog description found for the incident " +incidentNumber +" is" + worklogDescriptions); When I assert this, the boolean variable worklogMatch is set as false as the String that I'm looking for is not present in the ArrayList. The test case fails as expected. However, the message is not dispalyed in the console. My questions, Is my way of assertion valid? I'm asserting a boolean variable with 'true' Why is my message not being printed when the assertion fails?
has title: how to assert for boolean value in selenium webdriver

http://stackoverflow.com/a/25552772
has comment: http://stackoverflow.com/comment/39906045
has body: Not sure I understand your need, but how about: You can repeat pattern with (?1) or \g1 that will repeat the pattern used for group 1, depending on regex flavor. In your case: "\\dR\\|\\d\\|(((([^\\|]))*\\|){11})" is the same as (removing superfluous grouping): "\\dR\\|\\d\\|([^\\|]*\\|)(?1)(?1)(?1)(?1)(?1)(?1)(?1)(?1)(?1)(?1)"
has comment: http://stackoverflow.com/comment/39920147
type: Answer
answers question: http://stackoverflow.com/q/25549820
score: 0

http://stackoverflow.com/comment/39706071
comment on: http://stackoverflow.com/q/25448165
score: 1
type: Comment
has text: This looks like a duplicate of [this](http://stackoverflow.com/questions/9696836/excel-read-error-invalid-header-signature-how-to-resolve), your question may be closed.
type: QuestionComment

http://stackoverflow.com/comment/39829335
has text: What you want to do depends on the implementation of `Boolean.compareTo()` - the spec for `compareTo()` only requires that a positive or negative value is returned on greater-than or less-than comparisons. In the future this could in-theory return anything `> 0`
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25513763

http://stackoverflow.com/q/25429448
answer count: 1
tagged with: rcp
has title: How to create a dialog with checkboxes that allows multiple selections
type: Question
has answer: http://stackoverflow.com/a/25432102
linked to: http://stackoverflow.com/q/12126311
has comment: http://stackoverflow.com/comment/39675907
has comment: http://stackoverflow.com/comment/39672193
upvote count: 2
has comment: http://stackoverflow.com/comment/39675865
tagged with: swt
downvote count: 0
has comment: http://stackoverflow.com/comment/39673443
tagged with: jface
accepted answer: http://stackoverflow.com/a/25432102
favorite count: 0
has body: Having read this link, I want to create a dialog where I can select multiple items which to be in the form of check boxes. ElementListSelectionDialog doesn't show any elements in the dialog. final ElementListSelectionDialog dialog = new ElementListSelectionDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), new LabelProvider()); dialog.setElements(new String[] { "1", "2", "3" }); dialog.setTitle("Numbers"); dialog.setMultipleSelection(true); dialog.setInitialSelections(new String[] { "1", "2", "3" }); dialog.open(); Using the code above, I get the items in the dialog sometimes, but there are two problems: I only get them sometimes It is not in the form of checkboxes. If you know a better way of doing this, please let me know. I really appreciate any help :)
score: 2
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/39776012
comment on: http://stackoverflow.com/a/25485616
score: 0
type: Comment
has text: Yeah, I just wanted to keep as much of the original regexp to point out what has to be improved.
type: AnswerComment

http://stackoverflow.com/comment/39629390
type: Comment
comment on: http://stackoverflow.com/a/25405729
type: AnswerComment
score: 0
has text: Thanks bro for your valuable suggestion.I will take a look onto it and i will definitely try it. But i got it working with adding @Lazy to the Autowired bean, seems things working at the moment and i dnt think my solution is the apt one, btw i cant use the exact code here, as i fear the proprietary law will make problems for me :)

http://stackoverflow.com/comment/39636496
has text: http://stackoverflow.com/questions/17405165/first-character-of-the-reading-from-the-text-file-ï
type: QuestionComment
comment on: http://stackoverflow.com/q/25410201
score: 0
type: Comment

http://stackoverflow.com/a/25427719
has comment: http://stackoverflow.com/comment/39673797
has comment: http://stackoverflow.com/comment/39673682
has comment: http://stackoverflow.com/comment/39668651
type: Answer
accepted answer of: http://stackoverflow.com/q/25427669
has comment: http://stackoverflow.com/comment/39673653
score: 0
has comment: http://stackoverflow.com/comment/39673719
has comment: http://stackoverflow.com/comment/39674133
has comment: http://stackoverflow.com/comment/39668465
has comment: http://stackoverflow.com/comment/39668357
has comment: http://stackoverflow.com/comment/39668886
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39668776
has comment: http://stackoverflow.com/comment/39673521
has body: Its not possible ArrayList is itself a dynamic array part of Collection Framework refer the docs. Remove the [] bracket from your code. Quote from WikiPedia. In computer science, a dynamic array, growable array, resizable array, dynamic table, mutable array, or array list is a random access, variable-size list data structure that allows elements to be added or removed. It is supplied with standard libraries in many modern mainstream programming languages. Also refer this a very good resource fro beginners. If you want to have fixed size ArrayList answer. for eg What I suggest. EDIT ArrayList&lt;Hashmap&lt;String,String&gt;&gt; list =new ArrayList&lt;Hashmap&lt;String,String&gt;&gt;() Hashmap&lt;String,String&gt; map=new Hasmap&lt;String,String&gt;() map.put("KEY","VALUE"); list.add(map); Remember you should each time you have to create new instance for hashmap. Because it use unique value
answers question: http://stackoverflow.com/q/25427669
has comment: http://stackoverflow.com/comment/39674292

http://stackoverflow.com/a/25506118
downvote count: 0
upvote count: 2
has body: As i can see your code you are first assigning the rows = tables[i].rows.length-1; and then using it to assign rows to span so every time it changes it will be reflected in all the spans so you can directly assign the value tables[i].rows.length-1; to the span no need to use a variable row
answers question: http://stackoverflow.com/q/25505358
has comment: http://stackoverflow.com/comment/39815578
type: Answer
has comment: http://stackoverflow.com/comment/39818540
score: 2

http://stackoverflow.com/a/25545656
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39886767
answers question: http://stackoverflow.com/q/25545518
has body: Use this:
has comment: http://stackoverflow.com/comment/39887443
type: Answer
has comment: http://stackoverflow.com/comment/39887412
has comment: http://stackoverflow.com/comment/39886715
upvote count: 4
score: 4
accepted answer of: http://stackoverflow.com/q/25545518
has comment: http://stackoverflow.com/comment/39887785

http://stackoverflow.com/q/25424782
type: Question
tagged with: ftp
type: UnansweredQuestion
has body: Hi I m trying to connect our alfresco through FTP But I m getting Error Unknownhostexception my code are following public void FTPTest()throws SocketException, IOException { FTPClient ftp = new FTPClient(); System.out.println("1"); ftp.connect("172.17.178.144:2121"); // or "localhost" in your case System.out.println("2"); System.out.println("login: "+ftp.login("admin", "admin")); System.out.println("3"); ftp.changeWorkingDirectory("folder/subfolder/"); // list the files of the current directory FTPFile[] files = ftp.listFiles(); System.out.println("Listed "+files.length+" files."); for(FTPFile file : files) { System.out.println(file.getName()); } // lets pretend there is a JPEG image in the present folder that we want to copy to the desktop (on a windows machine) ftp.setFileType(FTPClient.BINARY_FILE_TYPE); // don't forget to change to binary mode! or you will have a scrambled image! FileOutputStream br = new FileOutputStream("C:\\Documents and Settings\\casonkl\\Desktop\\my_downloaded_image_new_name.jpg"); ftp.retrieveFile("name_of_image_on_server.jpg", br); ftp.disconnect(); } I m getting following error java.net.UnknownHostException: 172.17.178.144:2121
has title: Java Code for connection of alfresco through ftps
score: 0
tagged with: alfresco
has answer: http://stackoverflow.com/a/25435724
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39679227
has comment: http://stackoverflow.com/comment/39662880

http://stackoverflow.com/a/25417216
has body: b = input.nextInt(); doesn't consume the next newline. So when you call input.nextLine() you get a single newline. You could just read it. input.nextLine(); // &lt;-- by adding this System.out.println("Enter your name: "); name = input.nextLine();
accepted answer of: http://stackoverflow.com/q/25417191
has comment: http://stackoverflow.com/comment/39649717
has comment: http://stackoverflow.com/comment/39649642
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25417191
upvote count: 4
has comment: http://stackoverflow.com/comment/39649749
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39649711

http://stackoverflow.com/comment/39722918
type: QuestionComment
comment on: http://stackoverflow.com/q/25456694
has text: You can't move back beyond the application to root (and it shouldn't work on Linux either).
score: 0
type: Comment

http://stackoverflow.com/q/25537722
has comment: http://stackoverflow.com/comment/39872966
has comment: http://stackoverflow.com/comment/39873840
tagged with: multiton
duplicate of: http://stackoverflow.com/q/11126866
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39873132
type: Question
score: 0
has comment: http://stackoverflow.com/comment/39872926
has title: Best Practice : Thread safe Multiton pattern with lazy initialization
tagged with: java
has answer: http://stackoverflow.com/a/25537949
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/39872950
linked to: http://stackoverflow.com/q/11126866
has body: Idea is to create a factory class that returns different singleton instances based on a 'type'. [Multiton pattern]. Also, the singleton instances should be lazily created. Is the below code thread safe? Using ConcurrentHashMap makes it simpler but I want to try with HashMap. public class Multiton { private HashMap&lt;String, Interface&gt; interfaceMap; private static class Holder { public static final Multiton INSTANCE = new Multiton(); } public static Multiton getInstance() { return Holder.INSTANCE; } private Multiton(){ interfaceMap = new HashMap&lt;String, Interface&gt;(); } public Interface getInterface(String key){ Interface value = interfaceMap.get(key); if(null == value){ synchronized(interfaceMap){ // double check locking if(interfaceMap.get(key) == null){ switch(key){ case TypeA : // initialize Type A interface here and put it to map value = new TypeA(); interfaceMap.put(key, value); break; case TypeB : // initialize Type B interface here and put it to map value = new TypeB(); interfaceMap.put(key, value); break; } } } } return interfaceMap.get(key); } }

http://stackoverflow.com/a/25491329
score: 0
has comment: http://stackoverflow.com/comment/39787831
answers question: http://stackoverflow.com/q/25491163
has body: You want getTextContent() rather than getNodeValue() - the latter always returns null for element nodes. See: DOMDocument getNodeValue() returns null (contains an output escaped string)
type: Answer

http://stackoverflow.com/a/25411080
has comment: http://stackoverflow.com/comment/39638041
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25410591
has comment: http://stackoverflow.com/comment/39638711
has comment: http://stackoverflow.com/comment/39656135
has body: If the index is wrong, ArrayIndexOutOfBounds will be thrown. I guess the cardsLabel array is getting updated as null somewhere else in your code and that is the reason why NullPointerException is thrown when it is accessed. Could you please post your GUI class full code?

http://stackoverflow.com/comment/39974102
has text: oh god, i love spaces but why so much guy?
type: AnswerComment
score: 5
comment on: http://stackoverflow.com/a/25592007
type: Comment

http://stackoverflow.com/comment/39644762
comment on: http://stackoverflow.com/a/25414276
has text: @nmore, I agree, that is the reason why @ThreeFx was suggesting for `double[] digit;` But sure, go ahead!
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39651010
type: Comment
has text: wait - if everything is passed by value, then you wouldnt be able to manipulate the objects passed to methods as arguments (and get the modified object back), right?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25417759

http://stackoverflow.com/q/25399785
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25399811
tagged with: encryption
possible better answer: http://stackoverflow.com/a/25399811
accepted answer: http://stackoverflow.com/a/25400892
tagged with: tripledes
type: Question
tagged with: des
has body: I need to encrypt a complete java object. I am having a code which i have seen on internet which shows how to encrypt and decrypt text not the java object. So i was confused whether this is possible to encrypt complete java object. The code which i am using is below. package security; import java.security.spec.KeySpec; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESedeKeySpec; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; /** * This class defines methods for encrypting and decrypting using the Triple DES * algorithm and for generating, reading and writing Triple DES keys. It also * defines a main() method that allows these methods to be used from the command * line. */ public class TripleDesEncryptionDecryption { /** * The program. The first argument must be -e, -d, or -g to encrypt, * decrypt, or generate a key. The second argument is the name of a file * from which the key is read or to which it is written for -g. The -e and * -d arguments cause the program to read from standard input and encrypt or * decrypt to standard output. */ private static final String UNICODE_FORMAT = "UTF8"; public static final String DESEDE_ENCRYPTION_SCHEME = "DES/ECB/NoPadding"; private KeySpec myKeySpec; private SecretKeyFactory mySecretKeyFactory; private Cipher cipher; byte[] keyAsBytes; private String myEncryptionKey; private String myEncryptionScheme; SecretKey key; static String stringToEncrypt=""; public void setKey(String myKey) throws Exception { myEncryptionKey = myKey ; myEncryptionScheme = DESEDE_ENCRYPTION_SCHEME; keyAsBytes = myEncryptionKey.getBytes(UNICODE_FORMAT); myKeySpec = new DESedeKeySpec(keyAsBytes); mySecretKeyFactory = SecretKeyFactory.getInstance(myEncryptionScheme); cipher = Cipher.getInstance(myEncryptionScheme); key = mySecretKeyFactory.generateSecret(myKeySpec); } /** * Method To Encrypt The String */ public String encrypt(String unencryptedString) { String encryp…
tagged with: java
has answer: http://stackoverflow.com/a/25400892
has title: Encrypt complete object with triple des
type: AnsweredQuestion

http://stackoverflow.com/comment/39636289
comment on: http://stackoverflow.com/q/25409533
has text: Yes, i expect to print "AAA", three times. It's just a test, i'm studying
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25458915
score: 27
has comment: http://stackoverflow.com/comment/117718491
accepted answer of: http://stackoverflow.com/q/25458832
has comment: http://stackoverflow.com/comment/113122518
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25458832
has comment: http://stackoverflow.com/comment/121435071
type: Answer
has body: First you have to parse your format into date object using formatter specified Integer value = 19000101; SimpleDateFormat originalFormat = new SimpleDateFormat("yyyyMMdd"); Date date = originalFormat.parse(value.toString()); Remember that Date has no format. It just represents specific instance in time in milliseconds starting from 1970-01-01. But if you want to format that date to your expected format, you can use another formatter. SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd"); String formatedDate = newFormat.format(date); Now your formatedDate String should contain string that represent date in format yyyy-MM-dd
upvote count: 27

http://stackoverflow.com/comment/39947238
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25414210
type: Comment
has text: Do you think the following link would have helped you? http://stackoverflow.com/questions/4185382/how-to-use-jdo-persistence-manager

http://stackoverflow.com/comment/39704086
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25447162
has text: I can't comment until I get 50 reputation
type: Comment

http://stackoverflow.com/a/25479857
has body: To try and get you started, you're going to need a boolean array which represents the mailboxes...boolean is either true (lets say open) or false (lets say closed). boolean[] mailBoxes = new boolean[100]; The nice thing about this, is all the elements in the array are automatically set to false! Start by taking a closer look at the Arrays trail for more details. Next, you're going to need some way to visit each mailbox, now, there are plenty of ways you might do this, but for simplicity, you can use a for-next-loop for (int index = 0; index &lt; mailBoxes.length; index++) { //... } Take a look at The for Statement for more details... Then you need some way to change the state of each mailbox as you visit it, that is, change the assigned value...again, there are multiple ways to do this... You could, use an if-else statement if (mailBoxes[index]) { // is true mailBoxes[index] = false; } else { mailBoxes[index] = true; } Or you could, more simply, just flip the value using a ! (not) operator... mailBoxes[index] = !mailBoxes[index]; This just says that mailBoxes[index] is not what ever mailBoxes[index] currently is, this will have the nice effect of turning true into false and visa-versa... Now, the complex part is, you're going to need to use at least three for-next loops, all with different incrementers...this is why I suggested a for-next-loop For example, the second loop might look something like... for (int index = 0; index &lt; mailBoxes.length; index += 2) { This should give a push in the right direction... Also, don't forget to make use of lots of System.out.println statements to check what's going on ;)
answers question: http://stackoverflow.com/q/25479548
score: 0
type: Answer

http://stackoverflow.com/comment/39607162
score: 0
comment on: http://stackoverflow.com/q/25394084
has text: is yourchoice mode single?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39853561
has text: How did let Activity B know what kind of music the user did select ? Did you use an Intent ?
comment on: http://stackoverflow.com/a/25527285
type: AnswerComment
score: 0
type: Comment

permutation
tags question: http://stackoverflow.com/q/25470920
type: Tag
tag name: permutation

http://stackoverflow.com/comment/39712182
type: Comment
has text: if you're into seeing how this should really be done checkout the sourcecode for BigInteger: http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/00cd9dc3c2b5/src/share/classes/java/math/BigInteger.java
score: 0
comment on: http://stackoverflow.com/q/25451227
type: QuestionComment

http://stackoverflow.com/comment/39738684
has text: As per my comment on Eran's answer, this only work when one of the super's constructors provides a superset of the functionality of the other constructor. This is not the case in my example.
score: 0
comment on: http://stackoverflow.com/a/25465308
type: AnswerComment
type: Comment

model-view-controller
tags question: http://stackoverflow.com/q/25514137
tag name: model-view-controller
tags question: http://stackoverflow.com/q/25397158
type: Tag
tags question: http://stackoverflow.com/q/25465320
tags question: http://stackoverflow.com/q/25416750
tags question: http://stackoverflow.com/q/25392239
tags question: http://stackoverflow.com/q/25502552

http://stackoverflow.com/comment/39873011
type: QuestionComment
score: 0
has text: call `paint` from `paintComponent(Graphics g)`
comment on: http://stackoverflow.com/q/25537439
type: Comment

http://stackoverflow.com/comment/39862012
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25531920
type: Comment
has text: Are you implementing `IEditorPart` directly or extending `EditorPart`?

http://stackoverflow.com/a/25477700
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: The configuration -assumenosideeffects class com.my.package.Logger { *; } is bad indeed, because it includes all Object methods, such as Object#wait(). You probably don't want ProGuard to remove those invocations from your application. You should list your logging methods explicitly. In general, to get rid of the invocation getSimpleName, it may help to specify -assumenosideeffects class java.lang.Object { java.lang.String getSimpleName(); } In this case, the field access isn't removed from the method though (with ProGuard 5.0). This is based on a number of internal rules, which have to take into account that accessing fields can have side-effects. This simple case should have been handled. I'll see how it can be improved.
answers question: http://stackoverflow.com/q/25456167
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25456167

http://stackoverflow.com/comment/39612381
comment on: http://stackoverflow.com/q/25397417
type: Comment
type: QuestionComment
has text: You're playing a dangerous game.
score: 2

http://stackoverflow.com/comment/39713795
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25416293
has text: @user2713030 I was expecting that suggestion to lead to terrible, convoluted, and surely buggy code to get the sort of behavior I want, but when I tried it, it actually worked out quite well. Thanks!
score: 0

http://stackoverflow.com/a/25445710
has comment: http://stackoverflow.com/comment/39704868
type: Answer
has body: Shouldn't it be: ($V{Sum_TAgraf}==null?0,00:$V{Sum_TAgraf})
accepted answer of: http://stackoverflow.com/q/25445500
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25445500

http://stackoverflow.com/comment/39810813
type: QuestionComment
has text: Maybe store them in a `List<String[]>`, for example an [ArrayList](http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html).
score: 0
comment on: http://stackoverflow.com/q/25504230
type: Comment

http://stackoverflow.com/a/39107702
has body: You could use the Java-Arduino Communication Library. It can be found here: https://sourceforge.net/projects/javaarduinolibrary/. (be sure to download both jars) Then your code would look something like this: import arduino.*; class JavaArduinoComm { public static void main(String[] args) { Arduino obj = new Arduino('PortDescription', BAUD_RATE); obj.openConnection(); } } Then you can use any of the following methods: String serialRead(int limit) - returns a string containing as many readings as the value of limit. recommended for reading void serialWrite(String s) - writes the contents of the entire string to the serial at once. written as string to serial. void serialWrite(String s, int noOfChars, int delay) - writes the contents of the strings to the serial gradually. It writes the string in incremental steps with 'noOfChars' charaacters each time, with a pause of 'delay' milliseconds between each write. written as string to serial. recommended to write String void serialWrite(char c) - writes the individual char to the serial in datatype char. void serialWrite(char c, int delay) - writes the individual char to the serial in datatype char and pauses the thread for delay milliseconds after. recommended to write char
type: Answer
answers question: http://stackoverflow.com/q/25502517
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/25503404
score: 2
type: AnsweredQuestion
tagged with: java
answer count: 1
tagged with: fileoutputstream
has comment: http://stackoverflow.com/comment/39809492
has title: File is not received unless i call os.close()
linked to: http://stackoverflow.com/q/1936857
linked to: http://stackoverflow.com/q/2183240
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/39811377
tagged with: fileinputstream
tagged with: sockets
accepted answer: http://stackoverflow.com/a/25503509
downvote count: 0
has answer: http://stackoverflow.com/a/25503509
has body: I am sending file from server to client using java socket programming. Here is my server side code: public void fileSendingProtocol(String filePath) { File myFile = new File(filePath); byte[] mybytearray = new byte[(int) myFile.length()]; FileInputStream fis = null; try { fis = new FileInputStream(myFile); } catch (FileNotFoundException ex) { System.err.println(ex); } BufferedInputStream bis = new BufferedInputStream(fis); try { bis.read(mybytearray, 0, mybytearray.length); os.write(mybytearray, 0, mybytearray.length); os.flush(); System.out.println(filePath + " Submitted"); // File sent, exit the main method } catch (IOException ex) { // Do exception handling System.out.println(ex.toString()); } finally { try { os.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Here i have closed the os in the finally block. Because if i omit os.close() then i am not able to receive the file in the client side. Here is my client file receiving code: public static void fileReceivingProtocol(String filePath) { try { fos = new FileOutputStream(filePath); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } bos = new BufferedOutputStream(fos); /* read question paper from the server. */ try { bytesRead = is.read(aByte, 0, aByte.length); do { baos.write(aByte); bytesRead = is.read(aByte); } while (bytesRead != -1); bos.write(baos.toByteArray()); bos.flush(); fos.close(); } catch (IOException e) { System.err.println("IOException: " + e); } } I need the server first send a file . Then after receiving that file the client need to send another file to server after some minutes. But if i call the os.close() in the server side then my socket get closed and i am not able to continue any further communication between then.

http://stackoverflow.com/comment/39868550
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25535289
has text: you can install signal handlers in the sun jvm if you really want to.
score: 0

http://stackoverflow.com/comment/39759979
type: AnswerComment
comment on: http://stackoverflow.com/a/25476671
has text: not the Activity the Class Test himself please read the answer again. use Serializable
type: Comment
score: 0

http://stackoverflow.com/a/25467134
has body: You may also implement ApplicationSettingsFactory defining method ApplicationSettingsInterface Create() and use it as dependency. Thus, class will be more testable. Factory can incorporate object creation policy (singletone or not). And finally, why don't you use IoC container to define singletone or not? IoC containers are factories itself, and if you are not interested in creation of configuration object in arbitrary places in code, I suggest dependency injection of `ApplicationSettingsInterface' to be best solution. Otherwise, you may use your own factory.
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25462320
type: Answer
has comment: http://stackoverflow.com/comment/115547261

http://stackoverflow.com/a/25400463
type: Answer
score: 0
has body: You want to install openid4java on your system right? You can try native package method.
answers question: http://stackoverflow.com/q/25399965

http://stackoverflow.com/a/25549779
has comment: http://stackoverflow.com/comment/39894662
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25549638
has comment: http://stackoverflow.com/comment/39895310
has body: When I run this class, a text file is completely printed. Could it be that you console buffer is simply not big enough, since you are using System.out to print the lines?
accepted answer of: http://stackoverflow.com/q/25549638
has comment: http://stackoverflow.com/comment/39894807
type: Answer

http://stackoverflow.com/q/25488246
has comment: http://stackoverflow.com/comment/39781386
has title: Named query not known: findById
has comment: http://stackoverflow.com/comment/39781440
has answer: http://stackoverflow.com/a/25488701
score: 0
has answer: http://stackoverflow.com/a/25488695
has comment: http://stackoverflow.com/comment/39781188
answer count: 3
type: UnansweredQuestion
has body: I'm trying to build this simple project but I keep getting the same error. Can anybody help figure this out? HibernateTest.java public class HibernateTest { public static void main(String[] args) { SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Session session = sessionFactory.openSession(); session.beginTransaction(); UserDetails user = new UserDetails(); Query query = session.getNamedQuery("findById"); List&lt;?&gt; list = query.list(); if (!list.isEmpty()) { UserDetails userD = (UserDetails) list.get(0); System.out.println(userD); } } } UserDetails.java package com; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.Table; @Entity @Table (name="UserDetails") @NamedQuery( name = "findById", query = "SELECT x FROM UserDetails x WHERE x.id = '3'") public class UserDetails { @Id @Column(name="UserID") private int id; @Column(name="UserName") private String name; public void setId(int id) { this.id = id; } public int getId() { return id; } public void setName(String name) { this.name = name; } public String getName() { return name; } } I'm not exactly sure what's wrong because I have the same query running in a different project and it works fine.
type: Question
has comment: http://stackoverflow.com/comment/39781311
tagged with: named-query
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25488684

http://stackoverflow.com/q/25451719
has answer: http://stackoverflow.com/a/25451807
tagged with: java
has comment: http://stackoverflow.com/comment/39712987
downvote count: 7
has title: Java System.out.println syntax help for multiple variables
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39712933
has answer: http://stackoverflow.com/a/25451829
has comment: http://stackoverflow.com/comment/39718227
accepted answer: http://stackoverflow.com/a/25451829
has answer: http://stackoverflow.com/a/25451783
possible better answer: http://stackoverflow.com/a/25451783
linked to: http://stackoverflow.com/q/25274010
has answer: http://stackoverflow.com/a/25451803
answer count: 4
has body: I'm new to java and trying to print the values of multiple variables.But the quotes inside the System.out.println confusing me.Can anybody explain the following syntax? Why "+ b1.cc" is outside the quotes ? My code: System.out.println("Bike data " + b1.brand + " " + b1.color + " " + b1.cc);
upvote count: 2
type: AnsweredQuestion
score: -5

http://stackoverflow.com/a/25516292
accepted answer of: http://stackoverflow.com/q/25516006
has body: This is an example of an builder, it will build the object for you when you call methods on it. When using a builder you can chain all methods to build your object or do it step by step (or an combination!) NotificationCompat.BigPictureStyle builder = new NotificationCompat.BigPictureStyle(notificationBuilder); Which you can use like every other object. builder.setBigContentTitle(bigContentTitle) .bigPicture(imageBitmap); if (summaryText.length() &gt; 0){ builder.setSummaryText(summaryText); // only apply if parameter length &gt; 0 } return (builder.build());
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25516006
score: 3
type: Answer

http://stackoverflow.com/comment/39722371
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25456371
has text: You should only flat your own `List`. Don't mind about flattening the possible collection that may be stored inside your `List`.
type: Comment

http://stackoverflow.com/comment/39630823
type: Comment
has text: Then unless you can exploit some clever trick of the map I believe you'll have to consider all possible permutations of the Gs.
comment on: http://stackoverflow.com/a/25407123
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39887651
type: AnswerComment
score: 0
has text: Should be 'student.getName()'
type: Comment
comment on: http://stackoverflow.com/a/25546218

http://stackoverflow.com/comment/39784425
comment on: http://stackoverflow.com/a/25463773
type: AnswerComment
has text: @Rudydev - The setValueAt() implementation above will work for your case. I have made column 3 & 4 to adjust itself based on the value entered in one of those two column and for the rest of the columns, the value will get updated to the table as you entered. If you want to have 2 different columns to get adjusted automatically, just change the column number in the above code and that it will as expected.
score: 0
type: Comment

http://stackoverflow.com/comment/39731884
type: AnswerComment
comment on: http://stackoverflow.com/a/25461624
score: 0
type: Comment
has text: Here I have link related to vector: http://docs.oracle.com/javase/7/docs/api/java/util/Vector.html The link consist of list of method the vector has, but inside the list got no Enumeration method.

http://stackoverflow.com/a/27475646
score: 0
type: Answer
has body: I know this is old question. But the answer will be helpful for others. (1) Add below line to dispatcher-servlet.xml assuming dispatcher is your DispatcherServlet name in web.xml &lt;mvc:annotation-driven/&gt;
answers question: http://stackoverflow.com/q/25473192

http://stackoverflow.com/q/25485091
has comment: http://stackoverflow.com/comment/39776736
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25485240
has comment: http://stackoverflow.com/comment/39775591
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/39775057
has comment: http://stackoverflow.com/comment/39774966
tagged with: inheritance
has comment: http://stackoverflow.com/comment/40030192
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39775119
has comment: http://stackoverflow.com/comment/39775095
has comment: http://stackoverflow.com/comment/39774927
has title: Diamond occur in java
has comment: http://stackoverflow.com/comment/40031177
type: Question
has body: I was trying to check what java interface allows in java &amp; I get some result I am surprised that it allows inner class in java. and hence we can generate Diamond Problem easily. even if java have taken care for it. What I have done is. MainInterface.java public interface MainInterface { class MyTest{ public MyTest(){ System.out.print("AAAA"); } } } Test.java(interface) public interface Test extends MainInterface{ public void abc(); class MyTest{ public MyTest(){ System.out.print("AAAA"); } } } Test2.java(interface) public interface Test2 extends MainInterface{ class MyTest { public MyTest() { System.out.print("BBBB"); } } } Implemented class public class AllTest implements Test,Test2{ public void abc() { } } Main Class public class Main { public static void main(String[] args) { AllTest.MyTest test = new AllTest.MyTest();// at this line it conflict. } } My Questions are what should be its solution ? 2) why java allows to let it be?(as we all know java stops multiple extends because of diamond problem.)
has answer: http://stackoverflow.com/a/25485176
has comment: http://stackoverflow.com/comment/39775006
score: 3
tagged with: java

http://stackoverflow.com/comment/39749836
score: 0
comment on: http://stackoverflow.com/q/25468270
type: Comment
type: QuestionComment
has text: you need to draw the texture region using the `SpriteBatch` in the `render()` function. I recommend looking at the initial code that LibGDX generates for you when you first create the project - it displays an image.

http://stackoverflow.com/q/25399676
tagged with: asynchronous
favorite count: 0
has comment: http://stackoverflow.com/comment/39616681
tagged with: android-asynctask
type: Question
answer count: 2
score: 5
has body: Im currently developing an application that implements apigee, however, i've come across an issue when trying to update entities. Below is the method i'm currently using. Map&lt;String, Object&gt; updatedEntity = new HashMap&lt;String, Object&gt;(); ArrayList&lt;Map&lt;String,Object&gt;&gt; subPropertyArray = new ArrayList&lt;Map&lt;String,Object&gt;&gt;(); Map&lt;String, Object&gt; subProperty = new HashMap&lt;String, Object&gt;(); subProperty.put("age", ""); subProperty.put("auto_checkin_times", auto_checkin_times); subProperty.put("auto_checkins_enabled", "on"); subProperty.put("bio", ""); subProperty.put("max_age", "999"); subProperty.put("min_age","18"); subProperty.put("dob", mDob); subProperty.put("locale",""); subProperty.put("sex", mGender); subProperty.put("sexual_preference", mSexualPreference); subProperty.put("utc_offset",""); subPropertyArray.add(subProperty); updatedEntity.put("type", "user"); updatedEntity.put("info", subPropertyArray); dataClient.updateEntityAsync(entityID, updatedEntity, new ApiResponseCallback() { @Override public void onResponse(ApiResponse apiResponse) { if (apiResponse != null) { Intent intent = new Intent(SetupPage.this, HomePage.class); startActivity(intent); } } @Override public void onException(Exception e) { Log.e("", e.toString()); } }); However I'm getting the following error: "Error PUT to 'https://api.usergrid.com/ORGNAME/APPNAME/user/USERID" followed by: "No authentication challenges found" "doHttpRequest returned null" Any assistance would be highly appreciated. Thanks
accepted answer: http://stackoverflow.com/a/30262582
tagged with: apigee
tagged with: android
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/30262582
possible better answer: http://stackoverflow.com/a/25738604
has title: Error when updating APIGEE Entities
has answer: http://stackoverflow.com/a/25738604
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39621317
tagged with: java

http://stackoverflow.com/a/25511332
upvote count: 4
answers question: http://stackoverflow.com/q/25511198
has comment: http://stackoverflow.com/comment/49888551
type: Answer
has comment: http://stackoverflow.com/comment/39826747
has comment: http://stackoverflow.com/comment/39879479
has body: Using alternation it will populate only one group out of many but you can use lookaheads to populate all 3 groups you want: (?=(a?bc))(?=(ab?c))(?=(abc?)) It will populate abc in all 3 groups as you want. RegEx Demo Java Code Demo Update: Also you need to use Matcher#find() in order to get multiple matches: Pattern p = Pattern.compile("(?=(a?bc))(?=(ab?c))(?=(abc?))"); Matcher m = p.matcher("abc"); while (m.find()) { System.out.printf("%s::&lt;%s&gt; &lt;%s&gt; &lt;%s&gt;%n", m.group(), m.group(1), m.group(2), m.group(3)); }
has comment: http://stackoverflow.com/comment/49888496
has comment: http://stackoverflow.com/comment/39825308
has comment: http://stackoverflow.com/comment/39831080
score: 3
has comment: http://stackoverflow.com/comment/49888638
has comment: http://stackoverflow.com/comment/39824681
downvote count: 1

http://stackoverflow.com/q/25414121
has answer: http://stackoverflow.com/a/25414474
type: Question
has comment: http://stackoverflow.com/comment/39644254
type: UnansweredQuestion
tagged with: android
tagged with: android-adapter
has answer: http://stackoverflow.com/a/25414447
answer count: 4
has answer: http://stackoverflow.com/a/25414150
score: 0
tagged with: android-listview
tagged with: java
has answer: http://stackoverflow.com/a/25414353
has title: android how do i find out which view was clicked in a listview
has comment: http://stackoverflow.com/comment/39644051
has body: im quite a newby to android and java. I created a my own adapter and listView and i want to know how do i find out which view or row was pressed in my listView so i can do a specific task for row was picked (task includes sending data and info to another activity). I thought that maybe the position variable contains the name of the row clicked so i tried it but when a row is clicked the app crashes hangarList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long l) { Toast.makeText(getApplicationContext(), position,Toast.LENGTH_SHORT); } }); can someone help

http://stackoverflow.com/comment/39838574
score: 1
comment on: http://stackoverflow.com/q/25518842
type: Comment
has text: `x` is `int`, is primitive type and doesn't have `getText()`. Did you mean `edi.getText().toString()`?
type: QuestionComment

http://stackoverflow.com/a/39831928
has body: To my knowledge no Java IDE's exist that enables using a non-local JVM transparently. However, if the virtual machine controlled by vagrant is powerful enough you can install the desktop for the distribution you use through the package system and then run a full IDE inside your vagrant image. For virtualbox you may need to use the virtualbox GUI to show the screen of the virtual machine in a window. You may also want to install the virtualbox tools.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25453682

http://stackoverflow.com/q/25479875
tagged with: rest
tagged with: java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39768429
score: 0
has title: Restlet cannot process json
has body: This is my simple restlet code: public class MailServerResource extends ServerResource { @Get("json") public String getMail() { return this.getRequest().getEntityAsText(); } @Post("json") public String sendMail() { return this.getRequest().getEntityAsText(); } } Now when I access this resource and pass this string: {"employees":[ {"firstName":"John", "lastName":"Doe"}, {"firstName":"Anna", "lastName":"Smith"}, {"firstName":"Peter", "lastName":"Jones"} ]} It throws: The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method
answer count: 1
has comment: http://stackoverflow.com/comment/39766104
accepted answer: http://stackoverflow.com/a/25501223
tagged with: restlet
has answer: http://stackoverflow.com/a/25501223
type: Question

http://stackoverflow.com/a/25475056
score: 1
downvote count: 0
upvote count: 1
has body: You can use the library Gson from google. Here's an example of a json object converted to Java object of type Map: Gson gson=new Gson(); String json="{\"k1\":\"v1\",\"k2\":\"v2\"}"; Map&lt;String,String&gt; map=new HashMap&lt;String,String&gt;(); map=(Map&lt;String,String&gt;) gson.fromJson(json, map.getClass()); Another solution to try with Gson library is the following: Gson gson = new Gson(); String json="{\"k1\":\"v1\",\"k2\":\"v2\"}"; LinkedTreeMap result = gson.fromJson(json, LinkedTreeMap.class); You need to import these two classes: import com.google.gson.Gson; import com.google.gson.internal.LinkedTreeMap; You can check this post about the same subject: How can I convert JSON to a HashMap using Gson?
has comment: http://stackoverflow.com/comment/39757133
type: Answer
answers question: http://stackoverflow.com/q/25474907
has comment: http://stackoverflow.com/comment/39757240

http://stackoverflow.com/comment/39706698
type: QuestionComment
comment on: http://stackoverflow.com/q/25447957
type: Comment
score: 0
has text: If you get "Empty", that means that request.getAttribute("Item") returns null. So check that you have indeed stored a list of items under the request attribute "Item" before executing the JSP. And please stop using scriptlets. Learn the JSP EL and the JSTL.

http://stackoverflow.com/comment/39859350
type: AnswerComment
comment on: http://stackoverflow.com/a/25529574
has text: @Caffé I thought I already had with the LEFT JOIN.. I mean I can try and work up an example if thats what you mean. but you can't produce the same result when you want to join the data without filtering some in one table without a LEFT JOIN
type: Comment
score: 0

http://stackoverflow.com/q/25496881
linked to: http://stackoverflow.com/q/12189698
possible better answer: http://stackoverflow.com/a/25497893
has comment: http://stackoverflow.com/comment/39797903
has comment: http://stackoverflow.com/comment/39797695
linked to: http://stackoverflow.com/q/4240080
has answer: http://stackoverflow.com/a/73342177
has comment: http://stackoverflow.com/comment/39797853
accepted answer: http://stackoverflow.com/a/25497035
has comment: http://stackoverflow.com/comment/39797859
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39797928
answer count: 3
downvote count: 0
has body: Firstly, I'll start off by saying English is not my first language so I apologize for any poor explanations. I want to know how to get every single substring of a String with so many different orders. Before you tell me this question has been asked before, I want to say that almost every code implementation of this task I see does not include duplicates. But Say I had a string "enviroment" and I wanted every single substring including "ment", "met", "ten", "net","note", "more" e.t.c e.t.c how would I acheive this?? This is the function I wrote. public static ArrayList&lt;String&gt; getAllSubstringsOfAString(String inputString) { ArrayList&lt;String&gt; allSubstrings = new ArrayList&lt;String&gt;(); String sub; for(int i = 0; i &lt; inputString.length(); i++) { for (int j = 1; j &lt;= inputString.length() - i; j++) { sub = inputString.substring(i , i + j); allSubstrings.add(sub); } } return allSubstrings; } When I run this function public static void main(String[] args) throws IOException { ArrayList&lt;String&gt; allSubStrings = getAllSubstringsOfAString("environment"); for (String allSubString : allSubStrings) { System.out.println(allSubString); } it prints this out e en env envi envir enviro environ environm environme environmen environment n nv nvi nvir nviro nviron nvironm nvironme nvironmen nvironment v vi vir viro viron vironm vironme vironmen vironment i ir iro iron ironm ironme ironmen ironment r ro ron ronm ronme ronmen ronment o on onm onme onmen onment n nm nme nmen nment m me men ment e en ent n nt t Which is only a small part of what I want. I want the function to be able to get substrings in every order. For example, If I wanted it to include Strings like "net", "ten", "never" e.t.c, as they are all substrings of the word "environment". What changes do I have to make on my function to attain this? Also, as I am a Java beginner, I would like to know If my code is well written and what changes I can make to my code to make it perform better and look bett…
has comment: http://stackoverflow.com/comment/39797807
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39797847
has answer: http://stackoverflow.com/a/25497893
tagged with: string
has comment: http://stackoverflow.com/comment/39797744
has answer: http://stackoverflow.com/a/25497035
has comment: http://stackoverflow.com/comment/39798020
favorite count: 0
type: Question
has title: Java - Get All Permutations, Substrings and Permutations of every Substring of a String

http://stackoverflow.com/a/25433526
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25433460
answers question: http://stackoverflow.com/q/25433460
type: Answer
score: 2
upvote count: 2
has body: See this question: Java Method invocation vs using a variable. In general, you should code for readability rather than performance. The compiler may very well optimize away get() calls for you. If it doesn't, and this turns out to be an issue, you can always profile your code after it is finished to identify and eliminate bottlenecks. To start off, though, definitely go for readability.
type: AcceptedAnswer

http://stackoverflow.com/a/25455269
answers question: http://stackoverflow.com/q/25455258
downvote count: 0
upvote count: 1
score: 1
type: Answer
has body: You didn't start the thread, you merely called run on it, so it's executed in your current thread. Call start to start the thread instead. Change }).run(); to }).start();

http://stackoverflow.com/a/33321585
upvote count: 3
type: Answer
has body: You can change settings of JVM heap in configuration file neo4j-wrapper.conf # Java Heap Size: by default the Java heap size is dynamically # calculated based on available system resources. # Uncomment these lines to set specific initial and maximum # heap size in MB. #wrapper.java.initmemory=512 #wrapper.java.maxmemory=512 http://neo4j.com/docs/stable/server-performance.html
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/25530538

http://stackoverflow.com/comment/39808479
has text: Think it works now. :) If it does not, in case, I don't check as you wouldn't handle one more comment which tells you your errors. :P
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25500254
type: AnswerComment

http://stackoverflow.com/a/25412885
answers question: http://stackoverflow.com/q/25412824
score: 0
has body: "Run in terminal" attempts to run the software as an interpreted script. On UNIX-like systems (meaning almost everything except Windows), a shebang line is used to indicate, what interpreter is to be used. It consists of the characters #! followed by the command to invoke the interpreter (e.g. #!/usr/bin/python or #!/usr/bin/ruby). However, Java is not (only) interpreted. java only runs compiled Java bytecode, so it does not work on source files Instead, head over to the terminal yourself, compile the code with javac and run the resulting bytecode (the .class files) with java: javac the_file_name.java java the_class_name where the_file_name.java is the file containing main(...) and the_class_name is the name of the class containing main(...) (this should usually be the same as the_file_name)
type: Answer

http://stackoverflow.com/comment/39704896
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25446411
has text: @user3615209 Swing is already double-buffered (by default): drawing on the passed `graphics` already happens on a buffer which will be made visible at the end of painting process of the `JComponent`. So your attempt to double-buffer is completely unnecessary and redundant.

http://stackoverflow.com/a/25543356
has comment: http://stackoverflow.com/comment/39882747
type: Answer
has body: In reality, there will be two objects created. "Raj" and new String("Raj"); Your friend is either incorrect or is... stringing you along. I'm sorry. Edit: As correctly pointed out, a third object is created, which is the char[] object in the internal of the String.
answers question: http://stackoverflow.com/q/25543314
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/41513933
comment on: http://stackoverflow.com/q/25540502
has text: This approach is somewhat helpful http://stackoverflow.com/a/25811665/701368
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39775025
comment on: http://stackoverflow.com/a/25485161
has text: so what to do for that , do I need to remove that?
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/a/25516561
has comment: http://stackoverflow.com/comment/39835693
answers question: http://stackoverflow.com/q/25516426
has comment: http://stackoverflow.com/comment/39835295
type: Answer
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/39834869
type: AcceptedAnswer
has body: You probably need to add the 2nd activity to your manifest. Most common mistake ;) Yep, there's the proof: 08-26 17:53:53.194: E/AndroidRuntime(1278): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.myfirstapp/com.example.myfirstapp.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml? Get rid of the fully qualified name and use .DisplayMessageActivity instead.
accepted answer of: http://stackoverflow.com/q/25516426
score: 3

http://stackoverflow.com/comment/39841401
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25520433
has text: @LearningBasics-Android see updated answer to get xml file from assets.

http://stackoverflow.com/comment/39720261
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25455169
has text: change answer,use this
type: Comment

http://stackoverflow.com/q/25449103
has body: So I have a .jsp page which has a form on it, like this (naturally this is a massive simplification): <form:form commandName="myCommand" method="post"> <form:select path="values" class="select-tall" multiple="multiple" id="mySelect"> first second third </form:select> Save </form:form> When the submit button is pressed, the form is submitted(somehow) and the path= attributes are used to bind the data inside the form elements to the properties of an instance of a plain old java object. I understand how this POJO is specified, and I understand how the POST request is routed to the correct controller, but I don't understand where or how the form values are mapped to the given POJO. What I don't understand is: How does the spring tag library modify the form such that this binding takes place? How would one go about doing this in a manual or ad-hoc fashion(using a Javascript onSubmit() method, say)? Essentially my question is: How does the spring-form.tld tag library work? Any resources, or even a high-level explanation in your own words, would be extremely helpful. I've implemented a work-around solution in the mean time (dynamically adding items to a hidden form element), but I feel like this is hack-y and the wrong solution.
tagged with: javascript
has comment: http://stackoverflow.com/comment/39762476
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/39708100
score: 0
has comment: http://stackoverflow.com/comment/49311093
answer count: 0
tagged with: jsp
has title: How does the Spring forms .jsp tag library work?
has comment: http://stackoverflow.com/comment/39736105
type: Question
tagged with: java

http://stackoverflow.com/q/25453790
tagged with: android
has body: I have one array that is displayed in a listview and one textview. I want that every item is selected on the list view, add a value to a counter that is displayed in the textview. For example if I select "THREE" in the listView, the texview must show "Value is 3", and if I also select "TWO", the texview shows "Value is 5" (3 + 2). I have made a second listview_array with values that I have tried to pass to integer, but its not working. Any idea or help please? This is the code for my question: package com.javaya.proyecto002; import android.app.Activity; import android.app.AlertDialog; import android.os.Bundle; 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.CheckBox; import android.widget.ListView; import android.widget.TextView; ; public class activity2 extends Activity { TextView tv1; ListView lv1; int counter; int counter2; String listview_array[] = { "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN" }; String listview_array2[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity2); tv1 = (TextView)findViewById(R.id.textView1); counter = 0; lv1 = (ListView) findViewById(R.id.listView1); lv1.setAdapter(new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_activated_1, listview_array)); lv1.setChoiceMode(lv1.CHOICE_MODE_MULTIPLE); lv1.setOnItemClickListener(new OnItemClickListener(){ private String[] listview_array2 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int position, long id){ if (lv1.isItemChecked(position)); String name = this.listview_array2[position]; counter2 = Integer.parseInt(name); counter = counter + counter2; tv1…
type: AnsweredQuestion
score: 0
tagged with: java
has title: Adding numbers to a TexView from Listview multiple choice
tagged with: textview
accepted answer: http://stackoverflow.com/a/25454047
answer count: 1
has answer: http://stackoverflow.com/a/25454047
type: Question

http://stackoverflow.com/a/25450987
has body: color is a simple Java integer (32-bit). You can just use Map&lt;String,Integer&gt; in place of what you're doing. The simple Processing doc actually explicits it: they may be specified directly using hexadecimal notation such as #FFCC00 or 0xFFFFCCOO
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25450916
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25450916

indexoutofboundsexception
tags question: http://stackoverflow.com/q/25499667
tags question: http://stackoverflow.com/q/25521385
tags question: http://stackoverflow.com/q/25393198
tag name: indexoutofboundsexception
tags question: http://stackoverflow.com/q/25479195
tags question: http://stackoverflow.com/q/25547329
type: Tag

http://stackoverflow.com/a/25410334
upvote count: 1
has body: The problem is the YYYY which means: Y Week year; The actual year, which is what you are looking for would be yyyy. I really recommend that you go in the link above to see the full list. You should also replace the milliseconds to .SSS as you can't get more precise than that.
accepted answer of: http://stackoverflow.com/q/25410088
score: 1
has comment: http://stackoverflow.com/comment/39637051
type: Answer
answers question: http://stackoverflow.com/q/25410088
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39859908
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25530538
has text: Post your code for loading this dataset. There are common errors in loading that cause out of memory exceptions that wouldn't otherwise happen. You can also increase your memory, but it might be smarter to go about the load differently so you don't have to increase memory in the first place. Misuses of CREATE vs. MERGE can really easily create this problem.
score: 0

http://stackoverflow.com/q/25442874
type: UnansweredQuestion
has body: public interface AFEvent { public String UNKNOWN ="Unknown"; public String ERROR = "EQUINOX_EVENT_ERROR"; public String REJECT = "EQUINOX_EVENT_REJECT"; public String ABORT = "EQUINOX_EVENT_ABORT"; } And public class AFEvent { public static final String UNKNOWN ="Unknown"; public static final String ERROR = "EQUINOX_EVENT_ERROR"; public static final String REJECT = "EQUINOX_EVENT_REJECT"; public static final String ABORT = "EQUINOX_EVENT_ABORT"; } Then I can call it in the same way. Whats the difference when calling attribute from interface vs static class ?
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39696415
score: 0
has answer: http://stackoverflow.com/a/25442893
has title: What is the difference when calling attribute from interface vs static class
tagged with: java
has comment: http://stackoverflow.com/comment/39697158
has comment: http://stackoverflow.com/comment/39696537
has comment: http://stackoverflow.com/comment/39696661
has comment: http://stackoverflow.com/comment/39696754
type: Question
has answer: http://stackoverflow.com/a/25442961
has comment: http://stackoverflow.com/comment/39696334
answer count: 2
has comment: http://stackoverflow.com/comment/39702935

http://stackoverflow.com/comment/39836626
has text: The jars are located in ~\.ivy2\, or you need to filter the project jars?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25517470

http://stackoverflow.com/q/25448871
answer count: 0
upvote count: 3
tagged with: websocket
downvote count: 0
has comment: http://stackoverflow.com/comment/39708817
tagged with: socket.io
favorite count: 0
type: Question
has body: I am developing a chat for service for my application and have been trying to connect to socket.io from my native android application. I am using :- https://github.com/nkzawa/socket.io-client.java https://github.com/nkzawa/engine.io-client.java https://github.com/TooTallNate/Java-WebSocket my activity class looks like private Socket socket; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_main); message = (EditText) findViewById(R.id.editText1); send = (Button) findViewById(R.id.button1); try { socket = IO.socket("http://ridewithme.in:49154/socket"); } catch (URISyntaxException e) { e.printStackTrace(); } send.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub if(v.getId() == R.id.button1) { text = message.getText().toString(); socket.connect(); socket.send(text); socket.disconnect(); } } but i keep on getting XHR polling error (logs from the Socket.emit()) com.github.nkzawa.engineio.client.EngineIOException: xhr poll error com.github.nkzawa.socketio.client.SocketIOException: Connection error My server uses socket.io v1.0.X and it seems to be working fine from a browser. What is possibly going wrong here? Is it an acces origin problem?
type: UnansweredQuestion
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/42265915
has comment: http://stackoverflow.com/comment/39707557
tagged with: node.js
has title: connect to socket.IO from native android
score: 3

http://stackoverflow.com/comment/39888157
type: Comment
comment on: http://stackoverflow.com/a/25541621
has text: You need a rooted device for that, try to run the code in emulator and look into /data/... with DDMS on the emulator.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25513788
tagged with: classpath
has answer: http://stackoverflow.com/a/65840450
favorite count: 0
has body: I'm having a problem where IntelliJ 13.1.4, when running a unit test, can't find a ServiceLoader file in the src/test/resources directory of my module. Please note before answering that I've done all of the following: The module is a Gradle project, and if I run gradle test the unit test runs fine. I've run this unit test successfully in IntelliJ in the past, and it found the module. (Maybe an earlier version of IntelliJ?) I've double checked the IntelliJ module settings and the src/test/resources directory is marked as being a test resources directory. (See screenshot below.) I'm dumping the unit test class's classloader's classpath in the class; it has the build/classes/test/ and build/classes/java directories, but neither build/resources/test/ nor build/resources/main/. I've clicked the button to refresh all Gradle projects. Any ideas on what else could be causing IntelliJ to fail here? Screenshot of my module configuration, showing the Test Resource Folders setting.
type: Question
has comment: http://stackoverflow.com/comment/40828953
has comment: http://stackoverflow.com/comment/39831972
answer count: 9
possible better answer: http://stackoverflow.com/a/39289902
has answer: http://stackoverflow.com/a/62453383
has title: IntelliJ can't find classpath test resource
has comment: http://stackoverflow.com/comment/40346691
tagged with: intellij-idea
downvote count: 0
has answer: http://stackoverflow.com/a/49893867
score: 67
has answer: http://stackoverflow.com/a/52082951
has comment: http://stackoverflow.com/comment/39829826
has answer: http://stackoverflow.com/a/49618962
has answer: http://stackoverflow.com/a/74396617
has comment: http://stackoverflow.com/comment/40764749
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26033752
linked to: http://stackoverflow.com/q/18733729
has answer: http://stackoverflow.com/a/26033752
has answer: http://stackoverflow.com/a/39289902
tagged with: java
has answer: http://stackoverflow.com/a/64044684
has comment: http://stackoverflow.com/comment/40838592
has comment: http://stackoverflow.com/comment/45166630
has comment: http://stackoverflow.com/comment/40762506
upvote count: 67
has comment: http://stackoverflow.com/comment/94583015

http://stackoverflow.com/q/25423526
type: Question
has answer: http://stackoverflow.com/a/25423717
has answer: http://stackoverflow.com/a/25423654
has comment: http://stackoverflow.com/comment/39661984
has comment: http://stackoverflow.com/comment/39661315
tagged with: hashset
has body: I have a scenario that I am iterating over a set using iterator. Now I want to remove 1st element while my iterator is on 2nd element. How can I do it. I know Set is unordered and there is nothing like first or second element but my question is I want to remove an element which is not being currently returned by Iterator.next I dont want to convert this set to list and using listIterator. I dont want to collect all objects to be removed in other set and call remove all I cant store it and remove after the iteration sample code. Set&lt;MyObject&gt; mySet = new HashSet&lt;MyObject&gt;(); mySet.add(MyObject1); mySet.add(MyObject2); ... Iterator itr = mySet.iterator(); while(itr.hasNext()) { // Now iterator is at second element and I want to remove first element }
has comment: http://stackoverflow.com/comment/39660612
type: AnsweredQuestion
tagged with: iterator
answer count: 3
possible better answer: http://stackoverflow.com/a/25423654
has comment: http://stackoverflow.com/comment/39660738
score: 1
upvote count: 1
tagged with: java
tagged with: set
has comment: http://stackoverflow.com/comment/39660657
downvote count: 0
has answer: http://stackoverflow.com/a/25424521
accepted answer: http://stackoverflow.com/a/25424521
has title: How to remove an element from set using Iterator?
has comment: http://stackoverflow.com/comment/68881424
favorite count: 0

http://stackoverflow.com/comment/39747117
type: Comment
has text: Frank N. Stein! i have Arabic image words.Like A,B,C,D.. etc and i need to display ABCD.but in my case in arabic word.here link that i want. https://play.google.com/store/apps/details?id=sa.edu.ksu.Ayat&hl=en
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25469684

http://stackoverflow.com/comment/39785057
has text: Look, honestly this is a fairly simple examples. You need to understand how tables and their models work. The timer is the simplest component. You know you that everything in the `actionPerformed` will occur every so many milliseconds, So do your stuff there, where you want to change the table values. All I do in my code is traverse the table model and set the values. Please take some time to read [How to use Tables](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html) and [How to Use Swing Timers](http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html) for more help.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25488992
type: Comment

http://stackoverflow.com/comment/39934031
comment on: http://stackoverflow.com/q/25542262
type: Comment
type: QuestionComment
score: 0
has text: Your stack trace doesn't tell us what the root cause of the exception is. Please update your question with the full stack.

http://stackoverflow.com/comment/39683868
has text: I downvoted you for the cast from a primitive to String -- you need to use `Integer.toString(int)`.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25435605

http://stackoverflow.com/q/25472391
has body: I'm trying to scrape the Steam Marketplace with JSoup, and after using the JSoup Cookbook and advice from other questions on this site, I'm stuck. I can successfully parse a single page, but I am having GREAT difficulty getting to the second page of the market list. I know what the URLs look like on the subsequent pages. The first page looks like this: http://steamcommunity.com/market/search?q=m4a1 The second page of items looks like this: http://steamcommunity.com/market/search?q=m4a1#p2_default_desc And the "page number" increases reasonably as expected in a web browser (I use Chrome). So I built the web parser that way, and it always returns what looks like a new query on the original results (the first 10 items are shown again, and again, and again regardless of the "page" number in the URL... So, I added in cookies to pass the session ID as well (and in one iteration, just passing back all cookies), but that didn't seem to work either. Any ideas? Here's the Source Code I'm using. For now, it doesn't do anything fancy, just prints out the item description and stuff to the screen. public class MarketWebParser { public static void main(String[] args) { MarketWebParser myParser = new MarketWebParser(); myParser.parseMainUrl("http://steamcommunity.com/market/search?q=m4a1"); } void parseMainUrl(String inputUrl) { try { int page = 1; int searchResultsEnd = 10; int searchResultsTotal = 1000; String sessionId; Map<String, String> steamCookies; Response res = Jsoup.connect(inputUrl).method(Method.POST).execute(); steamCookies = res.cookies(); sessionId = res.cookie("sessionid"); System.out.println("Session: " + sessionId); while (searchResultsEnd != searchResultsTotal) { String pageAddition = "#p" + Integer.toString(page); String currUrl = inputUrl + pageAddition; System.out.println(currUrl); Document doc = Jsoup.connect(currUrl).cookie("sessionid",sessionId).get(); Element content = doc.getElementById("searchResults"); Elements marketLinks = content .getElementsByClass…
tagged with: cookies
tagged with: java
accepted answer: http://stackoverflow.com/a/25472693
has title: How to webscrape Steam Marketplace using JSoup
tagged with: jsoup
answer count: 1
tagged with: web-scraping
has answer: http://stackoverflow.com/a/25472693
type: Question
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25467314
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25466455
has body: One very simple modification i would add to your for loop (or to other suggested answers as well) is to go through only odd numbers. we know for sure that even numbers (except 2) cannot be prime. So this would reduce the number of iterations by 50%: for(int i=500001;i&lt;10000000;i+=2) And secondly save the result into memory (into an array for example) and store at once the entire result list to the file. A single access to memory is more efficient than your for loop.
downvote count: 0

http://stackoverflow.com/q/25414867
has comment: http://stackoverflow.com/comment/39645588
downvote count: 2
has comment: http://stackoverflow.com/comment/39645571
has comment: http://stackoverflow.com/comment/39645468
tagged with: java-8
has answer: http://stackoverflow.com/a/25496716
type: AnsweredQuestion
tagged with: guava
has comment: http://stackoverflow.com/comment/39673261
upvote count: 3
score: 1
has body: The following block of code compiles just fine in 1.8.11, but throws an error in 1.8.20 private static String calculateSyntheticOrderTypePrice( FluentIterable&lt;? extends CalculatorProvider&gt; pendingProviders ) { FluentIterable &lt;? extends CalculatorProvider&gt; mlsLegProvidersAll = pendingProviders.filter(Predicates.and( IS_MLS_PROVIDER, Predicates.not(IS_SYNTHETIC))); FluentIterable &lt;? extends CalculatorProvider&gt; mlsLegProvidersNewest = reduceToNewestMlsPrices(mlsLegProvidersAll); FluentIterable &lt;? extends CalculatorProvider&gt; otherLegProviderAll = pendingProviders.filter(Predicates.and( Predicates.not(IS_MLS_PROVIDER), Predicates.not(IS_SYNTHETIC))); FluentIterable &lt;String&gt; mlsHeadPriceTypes = mlsLegProvidersNewest.transform(TO_MLS_SPREAD_PRICE_FUN); /* MLS head: spread price */ FluentIterable &lt;String&gt; orderPriceTypes = otherLegProviderAll.transform(TO_ORDER_TYPE_PRICE_FUN); /* non-MLS orders: option spread or pairs */ FluentIterable &lt;String&gt; formattedOrderHeadPriceTypes = orderPriceTypes.transform(new FormatOrderTypePriceFun(creditOrDebit(otherLegProviderAll))); FluentIterable &lt;String&gt; allFormatted = FluentIterable.from(Iterables.concat(mlsHeadPriceTypes, formattedOrderHeadPriceTypes)); return CalculatorValues.rollupStrings(allFormatted); } The error I get is java:not suitable method found for filter (com.google.common.base.Predicate) Was there a change between update 8 and 20 that would affect this code? I am using the same version of guava in both cases 17.0 (latest stable) and the only change is update version in Java. Any help is greatly appreciated. edit The line showing the error is FluentIterable &lt;? extends CalculatorProvider&gt; mlsLegProvidersAll = pendingProviders.filter(Predicates.and( IS_MLS_PROVIDER, Predicates.not(IS_SYNTHETIC)));
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25496716
has title: Java 1.8.20 Compiler error
favorite count: 0
type: Question

http://stackoverflow.com/a/25470050
has comment: http://stackoverflow.com/comment/39747659
score: 1
has comment: http://stackoverflow.com/comment/39747730
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25469913
has comment: http://stackoverflow.com/comment/39747673
has body: I think that the problem is not in the code you've provided. Try this (added logging and cards initialization) and it works: private void tryToSuffle() { int newI; Integer temp,temp2,temp3; Random randIndex = new Random(); //initializing data. Integer cardsInDeck = 52; ArrayList&lt;Integer&gt; cards = new ArrayList&lt;Integer&gt;(); for (int i =0; i &lt; cardsInDeck; i++) { cards.add(i); } //.... //no change in the algorythm itself for (int i = 0; i &lt; cardsInDeck; i++) { newI = randIndex.nextInt(cardsInDeck); temp = cards.get(i); temp2= cards.get(newI); cards.set(i, temp2); cards.set(newI, temp); } //printing the result. for (int i =0; i &lt; cardsInDeck; i++) { System.out.println(cards.get(i)); } } So without changing the main algorythm it works as planned. So probably what your not doing is assigning the returned value to the proper variable. Why inside this method your using some instance field cards? Couldn't you pass them as argument? EDIT: Just to support what I've writen above I made this test, and it works (without changes in the shuffling algorythm): public class ShufflerTest { private final Integer cardsInDeck = 52; public static void main(String args[]) { new ShufflerTest().run(); } private void run() { ArrayList&lt;Integer&gt; cards = new ArrayList&lt;Integer&gt;(); for (int i =0; i &lt; cardsInDeck; i++) { cards.add(i); } cards = tryToShuffle(cards); //printing the result. System.out.println(cards.toString()); } private ArrayList&lt;Integer&gt; tryToShuffle(final ArrayList&lt;Integer&gt; cards) { int newI; Integer temp,temp2; Random randIndex = new Random(); ArrayList&lt;Integer&gt; shuffledCards = new ArrayList&lt;Integer&gt;(); shuffledCards.addAll(cards); for (int i = 0; i &lt; cardsInDeck; i++) { newI = randIndex.nextInt(cardsInDeck); temp = shuffledCards.get(i); temp2= shuffledCards.get(newI); shuffledCards.set(i, temp2); shuffledCards.set(newI, temp); } return shuffledCards; } } In the example I've added the shuffledCards array not to change th…
upvote count: 1

http://stackoverflow.com/comment/39616569
has text: @Spurdow: This is not the builder pattern.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25399735

http://stackoverflow.com/q/25429479
tagged with: java
has body: ... ... &lt;owl:DatatypeProperty rdf:about="http://www.semanticweb.org/administrator/ontologies/2014/2/untitled-ontology-5#fileName"&gt; &lt;rdfs:label&gt;fileName&lt;/rdfs:label&gt; &lt;rdfs:comment&gt;Name of File&lt;/rdfs:comment&gt; &lt;rdfs:domain rdf:resource="http://www.semanticweb.org/administrator/ontologies/2014/2/untitled-ontology-5#File"/&gt; &lt;rdfs:range rdf:resource="&amp;xsd;string"/&gt; &lt;/owl:DatatypeProperty&gt; &lt;owl:DatatypeProperty rdf:about="http://www.semanticweb.org/administrator/ontologies/2014/2/untitled-ontology-5#fileLastAccessed"&gt; &lt;rdfs:label&gt;fileLastAccessed&lt;/rdfs:label&gt; &lt;rdfs:comment&gt;Time when the file was last accessed.&lt;/rdfs:comment&gt; &lt;rdfs:domain rdf:resource="http://www.semanticweb.org/administrator/ontologies/2014/2/untitled-ontology-5#File"/&gt; &lt;rdfs:range rdf:resource="&amp;xsd;dateTime"/&gt; &lt;/owl:DatatypeProperty&gt; ... ... Above is a portion of the ontology that I have developed in protege. You can see that datatype of the #fileName properties is &amp;xsd;string and datatype of #fileLastAccessed is &amp;xsd;dateTime I am developing an application in which I would need to programmatically read the datatype of a property. My question is that how would I know programmatically the datatype of a property.
answer count: 1
type: Question
tagged with: http://stackoverflow.com/tag/rdf
linked to: http://stackoverflow.com/q/24250198
tagged with: owl
tagged with: jena
has title: programmatically reading the datatype of a property
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25431197
score: 0
has comment: http://stackoverflow.com/comment/39677317
has answer: http://stackoverflow.com/a/25431197

http://stackoverflow.com/a/25416062
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25415049
accepted answer of: http://stackoverflow.com/q/25415049
type: Answer
has body: TL;DR: Yes, it's possible, but it requires a bit of a hacky workaround. First of all, I'm going to move the HTML to it's own separate file, to make editing easier, and just create cleaner code in general. editor.html Example Live-view The basic structure is really simple, but what about the element? What does it do? document.querySelector("textarea").addEventListener("keyup", function(){ window.status = this.value; }); AFAIK, it isn't possible to straight out get the value of an input in JavaFX, so you have to make a workaround. In this case, I'm setting the window status with the textarea value, whenever there is a keyup event in the textarea. Now we need to set up the webview in our JavaFX. WebviewInputValue.java package webviewinputvalue; public class WebviewInputValue extends Application { private WebView InitWebview(){ //Create browser WebView browser = new WebView(); WebEngine render = browser.getEngine(); //Load simple HTML String editor = WebviewInputValue.class.getResource("editor.html").toExternalForm(); render.load(editor); //Listen for state change render.getLoadWorker().stateProperty().addListener((ov, o, n) -> { if (Worker.State.SUCCEEDED == n) { render.setOnStatusChanged(webEvent -> { //Call value change onValueChange(webEvent.getData()); }); } }); return browser; } //called when value changes private void onValueChange(String data){ //Print out data System.out.println(data); //If the data is equal to "exit", close the program if("exit".equals(data)){ //Print goodbye message System.out.println("Received exit command! Goodbye :D"); //Exit System.exit(0); } } @Override public void start(Stage primaryStage) { //Create browser WebView browser = InitWebview(); StackPane root = new StackPane(); root.getChildren().add(browser); Scene scene = new Scene(root, 300, 250); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args)…

http://stackoverflow.com/comment/39708501
has text: Check the title, do you mean `maintain` session ?
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25449483
type: Comment

http://stackoverflow.com/q/25528969
has title: Not found exception while doing svn update
has body: I'm having the following situation: A configuration file (config.cfg) that gets accessed a lot by different processes. Config.cfg is under version control - SVN. I develop and test on a staging environment, when everything is working I go to the server and execute svn up on the config.cfg. The problem is: During svn up I get an exception by the processes accessing config.cfg: "config.cfg" not found. It seems that svn causes a short period where the file is beeing replaced and therefore not accessible for my processes. Any input on how to solve this issue is very much appreciated.
type: AnsweredQuestion
downvote count: 0
upvote count: 1
score: 1
answer count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39883717
tagged with: svn
tagged with: java
has comment: http://stackoverflow.com/comment/39921420
has answer: http://stackoverflow.com/a/25563828
has comment: http://stackoverflow.com/comment/39897802
accepted answer: http://stackoverflow.com/a/25563828
has comment: http://stackoverflow.com/comment/39861850
tagged with: atomic

http://stackoverflow.com/a/25450757
downvote count: 0
upvote count: 1
has body: You are using the wrong connection string. Your configuration uses the MariaDB protocol/dialect. To get your database connection working, just replace "mariadb" with "mysql".
type: Answer
accepted answer of: http://stackoverflow.com/q/25450510
score: 1
answers question: http://stackoverflow.com/q/25450510
type: AcceptedAnswer

http://stackoverflow.com/comment/39756571
type: AnswerComment
comment on: http://stackoverflow.com/a/25474980
has text: if you see there is a setMethod on my Display class.
type: Comment
score: 0

http://stackoverflow.com/a/25520504
has body: In Java the call sv.takeAway(); is actually compiled to StaticVerifier.takeAway() You can check it by calling javap -c StaticVerifier.class. A good IDE will warn you if you call a static method on instance. So C# is just more strict in this.
type: Answer
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39860145
answers question: http://stackoverflow.com/q/25520385
has comment: http://stackoverflow.com/comment/39858511
downvote count: 0
has comment: http://stackoverflow.com/comment/39861324

http://stackoverflow.com/comment/125682455
score: 0
type: AnswerComment
has text: This requires overring the /error endpoint.
type: Comment
comment on: http://stackoverflow.com/a/54539641

http://stackoverflow.com/comment/39808963
has text: am not sure but the language your using for recognisation is must be present in your device (am not sure ) you can find these languages in your device through settings
comment on: http://stackoverflow.com/q/25503059
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25472196
accepted answer of: http://stackoverflow.com/q/25471758
upvote count: 1
answers question: http://stackoverflow.com/q/25471758
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: If you want to preserve the &lt;br/&gt; tags in the parsed content, a somewhat simplistic solution to your problem would be to replace all &lt;br/&gt; tags in the original HTML code with text placeholders (a handy regexp to do it from here): html.replaceAll("(?i)&lt;br[^&gt;]*&gt;", "br2n") Then you could do textString.split("br2n") if this is what you've been trying to achieve.

http://stackoverflow.com/comment/39833546
comment on: http://stackoverflow.com/q/25515680
has text: After removing those annotations, it now gives the following: HTTP Status 500 - Could not resolve view with name '/WEB-INF/jsp/Dash.jsp' in servlet with name 'scorpio-restservice'
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25404062
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25404901
tagged with: selenium
has body: I am using chromedriver and try to locate button that found on popup. When I try using xpath it return nothing but on IE it works. So I try using class name and then loop on all buttons and find the one with text "OK". I got Exception "org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document" from the b.getText() command and I see that the button was clicked. List&lt;WebElement&gt; all = Test1.driver.findElements(By .className("btn-primary")); for (WebElement b : all) { if (b.getText().trim().equals("OK")) { b.click(); break; } }
has title: ChromeDriver - getText cause the button to click in debug mode
type: Question
tagged with: selenium-chromedriver
has comment: http://stackoverflow.com/comment/39639126
type: UnansweredQuestion
score: 0

http://stackoverflow.com/q/25467722
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39743737
tagged with: math
has answer: http://stackoverflow.com/a/25467794
score: -2
tagged with: eclipse
has answer: http://stackoverflow.com/a/25467756
has title: User input and finding multiples
has comment: http://stackoverflow.com/comment/39743316
answer count: 3
has body: I'm new to java and I have an assignment asking to prompt user for a number between 2 and 10 and it is supposed to print out multiples of that number. It is also supposed to use a for loop. I think I have the general idea with the for loop I'm just trying to figure out how to do the multiples. Any help is greatly appreciated! This is where I am so far: public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Please Enter a number between 2 and 10:"); for(int i = 2; i&lt;= 100; i++){ System.out.println(+ i); }
upvote count: 0
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/39743378
favorite count: 0
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/25467858

http://stackoverflow.com/a/25471510
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39751016
downvote count: 0
has comment: http://stackoverflow.com/comment/39750407
has comment: http://stackoverflow.com/comment/39750362
answers question: http://stackoverflow.com/q/25471371
type: Answer
has body: sleep is a static method. It makes the calling thread sleep. More generally, there is no direct way to make another thread do anything, including sleep. You need a specific inter-thread communication mechanism for any such task. Make a thread end by following the rules of the interruption mechanism (consult the documentation for Thread#interrupt() and Thread#isInterrupted().

http://stackoverflow.com/comment/39833434
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25515724
has text: This may not be the cause of your problem, but never compare Strings with `==` but instead use `.equals(...)` or `equalsIgnoreCase(...)`. The reason is that `==` compares if two variables refer to the one same object, something you don't care about, while the equals method checks if the Strings hold the same chars in the same order. And you do care about that.
score: 3

http://stackoverflow.com/a/25517739
has comment: http://stackoverflow.com/comment/39836833
has body: Because T extends Comparable, you should be using the compareTo method instead, for example... static &lt;T extends Comparable&lt;T&gt;&gt; T Max(T[] arr) { T current = arr[0]; for (int i = 1; i &lt; arr.length; i++) { if (arr[i].compareTo(current) &gt; 0) { current = arr[i]; } } return current; } From the JavaDocs for Comparable#compareTo... Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.) The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 &amp;&amp; y.compareTo(z)>0) implies x.compareTo(z)>0. Finally, the implementor must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z. It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals." In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive.
score: 4
answers question: http://stackoverflow.com/q/25517714
has comment: http://stackoverflow.com/comment/39836853
type: Answer
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25517714

http://stackoverflow.com/a/25427919
has body: The second one, the first is potentially vulnerable to SQL injection. Especially when (as it appears to be here) the id is a String. pstmt = con.prepareStatement(QUERY)); pstmt.setString(1, id); pstmt.setString(2, id); pstmt.setString(3, id); pstmt.setString(4, id); pstmt.setString(5, id); pstmt.setString(6, id); Also, the above should perform better since the statement query cache can potentially reuse the statement for different id(s). That is not true of the first example.
answers question: http://stackoverflow.com/q/25427880
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6
upvote count: 6
accepted answer of: http://stackoverflow.com/q/25427880

http://stackoverflow.com/a/25403895
type: Answer
has body: You can add the following line to Cyril's code: System.out.println(c.get(Calendar.DAY_OF_WEEK)); wednesday results in 4, but I doubt if you have any difficulties in substracting 1 from the result.
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25402243
has comment: http://stackoverflow.com/comment/39624787

http://stackoverflow.com/q/25397031
has comment: http://stackoverflow.com/comment/39612317
has answer: http://stackoverflow.com/a/25397362
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25397206
answer count: 3
tagged with: file-io
tagged with: java
has title: how to send variable to another class and the save it and send it back to another class
has body: so what im trying to do is take the int "inc" and .putPutExtra("Inc",inc) it to my second class called "Settings" and then save it via "SharedPreferences" and then when the user pushes the button to go back to my main class it auto loads that into a int heres the code i used to send it to the settings class from MainActivity int inc = 0; Intent GoToSettings = new Intent(getApplicationContext(), settings.class); GoToSettings.putExtra("Inc", inc); startActivity(GoToSettings) heres the code that receves it Intent intent = getIntent(); Inc = intent.getIntExtra("Inc", 10); heres the code that saves "Inc" SharedPreferences Saveinc=getSharedPreferences("IncSave", Context.MODE_PRIVATE); SharedPreferences.Editor SaveIncE=Saveinc.edit(); SaveIncE.putInt("IncSave", Inc); SaveIncE.commit(); heres the code that receves the int after its saved int inc = 1; Intent GoToMain = getIntent(); inc = GoToMain.getIntExtra("IncSave", 1); SharedPreferences GetSavedinc=getSharedPreferences("IncSave", Context.MODE_PRIVATE); int IncSave=GetSavedUpCount.getInt("IncSave", 1); inc=IncSave; i no its not the prittyest layout but im new and havent really learned the syntex perfictly. im also new to the website to so if i dissobay a rule im sorry.
type: Question
linked to: http://stackoverflow.com/q/24772291
has comment: http://stackoverflow.com/comment/39612155
has answer: http://stackoverflow.com/a/25398655
tagged with: android
has comment: http://stackoverflow.com/comment/39611775
accepted answer: http://stackoverflow.com/a/25397362
possible better answer: http://stackoverflow.com/a/25397206

http://stackoverflow.com/comment/39685500
has text: Note that your desired output is not going to work as the quotes for your onclick attribute aren't nested properly.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25436244
type: QuestionComment

http://stackoverflow.com/a/25490914
has body: You are masking all bytes with the term data[pointer ++] &amp; 0xFF creating all-unsigned values. For values consisting of two bytes you are creating int values between 0 and 65536 which, after dividing by 32767.0, yield to values between 0.0 and 2.0 whereas Matlab using signed interpretation produces values in the range -1.0 and 1.0. To illustrate this: The short value 0xFFFE, interpreted as signed value is -2, and the division is -2/32768.0 produces -6.10351562500000e-05 while interpreted as unsigned is 65534 and 65534/32767.0 produces 2.0. (Note that the negative value was divided by the absolute value of Short.MIN_VALUE rather than Short.MAX_VALUE…) It’s not clear how you could calculate an average of -44567.3253 from that. Even for your unsigned values (between 0.0 and 2.0) that is way off. After all, you are better off not doing everything manually: ShortBuffer buf=ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN) .asShortBuffer(); int numOfSamples = buf.remaining(); double[] amplitudes = new double[numOfSamples]; for (int i = 0; i &lt; numOfSamples; i++) { amplitudes[i] = buf.get() * (1.0/32768.0); } return amplitudes; Since I don’t know how Matlab does the normalization I cannot guaranty that the values are the same. It’s possible that the loop body has to look like this instead: final short s = buf.get(); amplitudes[i] = s * (s&lt;0? (1.0/32768.0): (1.0/32767));
answers question: http://stackoverflow.com/q/25489953
has comment: http://stackoverflow.com/comment/39792795
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39795491
has comment: http://stackoverflow.com/comment/39792731
has comment: http://stackoverflow.com/comment/39805028
accepted answer of: http://stackoverflow.com/q/25489953
type: Answer

http://stackoverflow.com/q/25493742
favorite count: 0
has answer: http://stackoverflow.com/a/51850679
type: Question
type: UnansweredQuestion
tagged with: java
has body: I tried to add jasperreports.jar file to the artifactory under libs-release-local:net/sf/jasperreports/jasperreports/5.0.1/jasperreports-5.0.1.jar and the deployment was successful. pom.xml dependency jasperreports-htmlcomponent jasperreports-htmlcomponent 5.0.1 net.sf.jasperreports jasperreports <!--version>5.1.0</version--> 5.0.1 xml-apis xml-apis commons-collections commons-collections But when I try to run the application from Intellij, I get the error path to dependency Both the jar files are present in the artifactory but is not getting recognized. [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9.864 s [INFO] Finished at: 2014-08-25T15:51:47-05:00 [INFO] Final Memory: 16M/243M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.3.4:run-app (default-cli) on project MPF-SalesQuote: Failed to create classpath for Grails execution. Could not transfer artifact com.lowagie:itext:jar:2.1.7.js1 from/to metasystems-snapshots (http://javaguru.metasystems.com:8081/artifactory/metasystems-snapshot): Failed to transfer file: http://javaguru.metasystems.com:8081/artifactory/metasystems-snapshot/com/lowagie/itext/2.1.7.js1/itext-2.1.7.js1.jar. Return code is: 409, ReasonPhrase: The repository 'metasystems-snapshot' rejected the artifact 'metasystems-snapshot:com/lowagie/itext/2.1.7.js1/itext-2.1.7.js1.jar' due to its snapshot/release handling policy.. [ERROR] com.lowagie:itext:jar:2.1.7.js1 [ERROR] [ERROR] from the specified remote repositories: [ERROR] metasystems-snapshots (http://javaguru.metasystems.com:8081/artifactory/metasystems-snapshot, releases=true, snapshots=true), [ERROR] metasystems-release (http://javaguru.metasystems.com:8081/artifactory/metasystems-release, releases=true, snapshots=true), [ERROR] local-releases (http://javaguru.metasystems.com:8081/artifactory/libs-release-local, releases=true, s…
tagged with: grails
answer count: 2
has title: maven build fails after adding jar to artifatory .m2/repository do not contain the jar file
score: 1
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/25494565
tagged with: artifactory
downvote count: 0
tagged with: maven
linked to: http://stackoverflow.com/q/45920419
upvote count: 1

http://stackoverflow.com/a/25524508
answers question: http://stackoverflow.com/q/25524284
has body: This works: public static void main(String[] args) throws Exception { String s = "01:19 PM"; Date time = null; DateFormat parseFormat = new SimpleDateFormat("hh:mm a", Locale.ENGLISH); System.out.println(time = parseFormat.parse(s)); } ouputs: Thu Jan 01 13:19:00 KST 1970
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25524284
has comment: http://stackoverflow.com/comment/39848490
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/77544793
has comment: http://stackoverflow.com/comment/39848394

http://stackoverflow.com/comment/39857574
has text: Hi thanks, will this convert a variable with the value 2014001 for example, into a date with a format like 11-OCT-13 15.30.54.000000000 +02:00?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25529422
type: Comment

http://stackoverflow.com/comment/39876156
score: 0
comment on: http://stackoverflow.com/q/25539347
type: Comment
type: QuestionComment
has text: Sure thing. Gimme a minute; I'm on a mobile.

http://stackoverflow.com/comment/39896169
comment on: http://stackoverflow.com/q/25550474
type: Comment
type: QuestionComment
score: 0
has text: "the NoClassDefFoundError message means that the class definition could be found at compile-time, but not at runtime" -- it's the opposite. Since Java is dynamic, it can search for classes in runtime even if it's not available during compile-time.

http://stackoverflow.com/comment/39852016
score: 0
has text: The cause is `java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet`. Looks like `spring-web.jar` is missing in your classpath.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25526591

http://stackoverflow.com/q/25549401
accepted answer: http://stackoverflow.com/a/25549487
possible better answer: http://stackoverflow.com/a/25549612
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25549487
type: AnsweredQuestion
tagged with: java
has title: Cannot find symbol. java compiler error
score: -1
type: Question
has answer: http://stackoverflow.com/a/25549612
upvote count: 0
has comment: http://stackoverflow.com/comment/39893792
answer count: 2
has body: I started to learn java earlier this week (Monday) and now whilst just going through the excercises from http://programmingbydoing.com/ (Specific excercise I'm doing is http://programmingbydoing.com/a/a-little-quiz.html) and now I've run into an error that I can't seem to fix. import java.util.Scanner; public class Quiz { public static void main ( String[] args) { Scanner keyboard = new Scanner(System.in); String ready,answer3; int answer1,answer2, score; score = 0; System.out.println ( "Are you ready for a quis?(Y/N) "); ready = keyboard.next(); if (ready == Y) { System.out.println ( "Great, let's get to it then!"); } else if (ready == N) { System.out.println ( "Well since you did start this program of your own volition I assume you are ready and you're simply having a go at me."); } else { System.out.println ( "Error, wrong input!"); } System.out.println (); System.out.println ( "Q1) What is the capital of Australia?" ); System.out.println ( " 1) Brisbane" ); System.out.println ( " 2) Sydney" ); System.out.println ( " 3) Canberra" ); answer1 = keyboard.nextInt(); if ( answer1 == 1) { System.out.println ( "Sorry, Canberra is the capital of Australia"); } else if ( answer1 == 2) { System.out.println ( "Sorry, Canberra is the capital of Australia"); } else if ( answer1 == 3) { System.out.println ( "Correct!"); score = score+1; } else { System.out.println ( "Error, wrong input!"); } System.out.println(); System.out.println ( "Q2) Can you store the value 'cat' in a varible of the int type? "); System.out.println ( " 1) Yes" ); System.out.println ( " 2) No" ); answer2 = next.keyboardInt(); System.out.println(); if ( answer2 == 1) { System.out.println ( "Sorry, 'cat' is a string, ints can only store numbers." ); } else if ( answer2 == 2) { System.out.println ( "That's right!" ); score = score+1; } else { System.out.println( "Error, wrong input"); } System.out.println(); System.out.println ( "Did vikings wear horned helmets in combat?(Y/N)"); System.out.println ( " 1) Yes…

http://stackoverflow.com/comment/39686040
type: AnswerComment
comment on: http://stackoverflow.com/a/25435106
has text: yep, I tried `p.destroy();` and `p.destroyForcibly();` but not stopped.
score: 0
type: Comment

http://stackoverflow.com/a/27547121
score: 0
has body: I got it solved by doing , double version = article.getVersion(); version = MathUtil.format(version + 0.1, 1, 1); article.setVersion(version);
type: Answer
answers question: http://stackoverflow.com/q/25549202

http://stackoverflow.com/a/25433685
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25430481
accepted answer of: http://stackoverflow.com/q/25430481
has body: As far as I know Chef does not provide that rollback out of the box. Regarding your questions: Uninstalling the Chef client won't uninstall what the Chef run could have installed nor revert the changes in config files, etc. That script should have to be created manually. The way to revert things in Chef (or uninstall something) is to create a recipe that removes what needs to be removed (for example to rollback an Apache installation you would create a recipe that uninstalls it). The latest is the recommended and you could do it by: Adding the "chef-client" cookbook to the run list of your nodes so it runs periodically. This way it will watch for changes in the run list and apply them. If something fails, you can update the run list of the node and leave there the "rollback recipes". In the next Chef client run, the state will be reverted. When using the Chef client periodically, it is extremely important that all recipes you use are idempotent so they can be run many times without failing (by definition they should!).
type: Answer
downvote count: 0

http://stackoverflow.com/a/25443124
type: Answer
has body: No a try with resource should always be used and must be used when the closable object is created. Even if you have an object that is passed in, that means the caller must have a try-catch block in which it called your method. Then the outer caller's try-catch will close the object.
score: 0
answers question: http://stackoverflow.com/q/25442850

http://stackoverflow.com/a/25429398
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25428983
type: Answer
has body: The relationships between the 3 tables require an "outer join" if joining all 3 at the same time. SELECT items.id , coalesce(shoes.name,shirts.name) as name FROM ITEMS LEFT OUTER JOIN SHOES ON SHOES.item_id = ITEMS.id LEFT OUTER JOIN SHIRTS ON SHIRTS.item_id = ITEMS.id Take items.id = 22. This exists only in SHIRTS, not SHOES. So if the joins only allow "exact matches" you cannot "exact match" both SHOES and SHIRTS to 22. an "inner join" requires exact matches. An "outer join" allows non-matching conditions to exist, so here we definitely need these. The function COALESCE() returns the first NON-NULL value from the parameters. So if a shoe name is NULL it would return the shirt name, and vice versa.

http://stackoverflow.com/q/25450036
has comment: http://stackoverflow.com/comment/39709815
tagged with: ajax
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25520763
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has answer: http://stackoverflow.com/a/25520763
type: Question
has comment: http://stackoverflow.com/comment/39709609
has title: How to get parameter long html page string from request in java?
tagged with: javascript
has body: I post request in javascript. I send html page in post data. In java, i use String html = request.getParameter("templateHtml"); I see html string in request, when i was debug mode. But "html" variable is null. my javascript code is here: var postData = {}; postData["templateHtml"] = "Html page's string is too long"; $.ajax({ type: 'POST', url: createUrl, data: postData, success: function(data) { onSuccess(data); }, error: function(message) { onFail(message); }, }); Why am I receiving a null "html" variable? How can I fix it?
tagged with: jquery

http://stackoverflow.com/comment/39623940
comment on: http://stackoverflow.com/q/25403262
type: Comment
has text: Change default memory. Define new JVM size
score: 0
type: QuestionComment

http://stackoverflow.com/q/25482299
has comment: http://stackoverflow.com/comment/39780781
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39771881
tagged with: jackson
has title: unable to serialize JSON to Set correctly with Spring MVC/jackson
has comment: http://stackoverflow.com/comment/39770925
type: Question
tagged with: spring-mvc
score: 0
has body: public class Parent { private List<Child> childs; } public class Parent { private Set<Child> childs; } @RequestMapping(value = "/save", method = RequestMethod.POST) public void saveFooter(@RequestBody Parent parent, Model model) below is the sample JSON object. {child: [{ name: 'a'}, { name: 'b'}]} When I use Set for childs in Parent.class, parent.getChilds.size(), the size of childs is 1 only(which is wrong). But when I use List for childs in Parent.class, parent.getChilds.size(), the size of childs is 2 (which is correct) Edit: public class Child { private String name; } jackson maven dependency com.fasterxml.jackson.core jackson-core 2.4 com.fasterxml.jackson.core jackson-annotations 2.4 com.fasterxml.jackson.core jackson-databind 2.4 com.fasterxml.jackson.datatype jackson-datatype-hibernate4 2.4 Edit： public class Child { private Long id; private String name; @Override public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final Child other = (Child) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } } found out that the problem is due to I implemented the equals method of Child.class which make the two object equal.
tagged with: java
has comment: http://stackoverflow.com/comment/39770129
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25483616
has comment: http://stackoverflow.com/comment/39771761

http://stackoverflow.com/comment/39894914
has text: @RicardoMoctezumaS Have you tried with a short file? Works with ist?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25549638
score: 0

http://stackoverflow.com/a/25446686
has body: There is a plugin called Startup Profiler for VisualVM 1.3.6 or newer. It allows you to profile your application from the beginning.
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/25433517
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39722539

http://stackoverflow.com/a/25497893
type: Answer
has comment: http://stackoverflow.com/comment/39800790
score: 2
has comment: http://stackoverflow.com/comment/39799866
downvote count: 0
has body: With a bit of help from this other question, I threw this together. public static void main(String[] args) { List&lt;String&gt; list = perms("codes"); list.forEach(s -&gt; System.out.println(s)); } public static List&lt;String&gt; perms(String string) { List&lt;String&gt; result = new ArrayList&lt;String&gt;(); char[] values = string.toCharArray(); for (int width = 1; width &lt;= values.length; width++) { // for every length int stack[] = new int[width]; for (int i = 0; i &lt; stack.length; i++) { // start from a specific point without duplicates stack[i] = stack.length - i - 1; } int position = 0; while (position &lt; width) { position = 0; StringBuilder sb = new StringBuilder(); while (position &lt; width) { // build the string sb.append(values[stack[position]]); position++; } result.add(sb.toString()); position = 0; while (position &lt; width) { if (stack[position] &lt; values.length - 1) { stack[position]++; if (containsDuplicate(stack) == false) break; else position = 0; } else { stack[position] = 0; position++; } } } } return result; } private static boolean containsDuplicate(int[] stack) { for (int i = 0; i &lt; stack.length; i++) { for (int j = 0; j &lt; stack.length; j++) { if (stack[i] == stack[j] &amp;&amp; i != j) { return true; } } } return false; } It doesn't re-use letter from the word unless the word contains the letter twice. In which case there would be doubles. It doesn't use recursion so stack overflow won't be a problem.
has comment: http://stackoverflow.com/comment/39800724
upvote count: 2
answers question: http://stackoverflow.com/q/25496881

http://stackoverflow.com/comment/39712740
type: QuestionComment
has text: @KrazyGlew - I can think of better justifications for capability architectures. But they'll never happen (in any real sense) in my lifetime nor likely in yours.
score: 0
comment on: http://stackoverflow.com/q/25429815
type: Comment

http://stackoverflow.com/comment/39709061
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25449687
type: QuestionComment
has text: Create a string, that will be your final result, inside your while loop append to that string the value of index(converted to string) , and after the while loop will be finished, you can just show that string in messagebox:)

http://stackoverflow.com/q/25455698
has title: VisualVM profiler error: "Class JavaLaunchHelper is implemented in both ..bin/java and ..jre/lib"
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25709616
tagged with: profiler
upvote count: 3
tagged with: java
downvote count: 0
answer count: 1
has body: When running the VisualVM profiler, it gives this error in the console of the program being run: objc[1145]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. Profiler Agent: Waiting for connection on port 5140 (Protocol version: 15) Profiler Agent: Established connection with the tool Profiler Agent: Local accelerated session What does it mean and how do I fix it? The profiler does still give a result but I want to make sure everything working correctly as it's hard to use common sense to know if the result given is right.
favorite count: 0
type: Question
score: 3
tagged with: visualvm

microphone
tag name: microphone
tags question: http://stackoverflow.com/q/25442096
type: Tag

decode
tag name: decode
tags question: http://stackoverflow.com/q/25505091
tags question: http://stackoverflow.com/q/25442725
type: Tag

http://stackoverflow.com/q/25529566
type: Question
has title: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
tagged with: jsp-tags
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39918776
tagged with: jsp
score: 0
tagged with: taglib
tagged with: java
has comment: http://stackoverflow.com/comment/39857810
has body: Can someone please tell me why I am getting above error? I have below code in JSP : &lt;c:set var="username" value="${cookie.username.value}" /&gt; &lt;s:hidden key="appInfo.createdBy" value="${username}" /&gt; For which I am getting above error. I searched a lot on google and many replies said talked about JSTL tag whihc I already have in my tags as : &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; And in web.xml I have : &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"&gt; what am I missing here?? Thanks for your help.
has answer: http://stackoverflow.com/a/26757684

build
tag name: build
type: Tag
tags question: http://stackoverflow.com/q/25473496
tags question: http://stackoverflow.com/q/25441702
tags question: http://stackoverflow.com/q/25494338
tags question: http://stackoverflow.com/q/25424338

http://stackoverflow.com/a/25497234
has body: You need to create the Random only once. From then on, calling nextInt or nextDouble will return random numbers. You also need to use doubles instead of ints so that calculated values are not rounded to integers. public class RandomGenerator { private Random _r = new Random(); private String GetRandom(String nLow, String nHigh) { double low = Double.Parse(nLow); double high = Double.Parse(nHigh); double R = _r.nextDouble(); string nRandom = ((high - low + 1) * R + low).ToString(); return nRandom; } }
score: 0
answers question: http://stackoverflow.com/q/25497129
has comment: http://stackoverflow.com/comment/41082532
type: Answer

http://stackoverflow.com/comment/39888786
type: AnswerComment
has text: Yeah, it looks a good idea. I have to try it .
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25545995

http://stackoverflow.com/a/25549295
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25549208
has comment: http://stackoverflow.com/comment/39897172
answers question: http://stackoverflow.com/q/25549208
has comment: http://stackoverflow.com/comment/39893709
has body: It wasn't really a need to have this. After all, we have survived since the beginning of Java without them. But it's a nice to have. It's quite frequent to have an interface (Collection, for example), with another class containing static utility methods dealing with this interface (Collections, for example). Putting the utility methods in the interface makes finding these utility methods easier, and there is no reason not to allow static methods in interfaces, so why not allowing them.....
has comment: http://stackoverflow.com/comment/39893705
type: Answer
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25511920
downvote count: 0
score: 1
upvote count: 1
has body: Here is the answer using the same object type JsonNode. The node itself can be an array: Jackson how to transform JsonNode to ArrayNode without casting?
type: Answer
answers question: http://stackoverflow.com/q/25511672

http://stackoverflow.com/comment/39602294
has text: Thank you Blaise Doughan, `@XmlElementWrapper` was definitely the missing one +1. Now program is trying to pull the three <book> inside the books. but values are null. Something wrong in Book.java? I will post the current o/p in the question section as an update
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25391761

http://stackoverflow.com/comment/39737723
score: 0
has text: If the user presses back button or cancels the picture after capturing it (on the preview screen), the result code in onActivityResult() will be 0 (RESULT_CANCELED). Just check is the resultCode is 0 and show yout AlertDialog
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25462324

http://stackoverflow.com/q/25505138
has body: I just deployed a CometD project, wich was working fine in Jetty to WAS 8.0.0.8. The application installs and starts, but upon startup throws the following exception in the SystemOut.log: [26.08.14 13:35:06:062 CEST] 00000031 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service Uncaught service() exception thrown by servlet cometd: java.lang.NoClassDefFoundError: org.eclipse.jetty.server.AbstractHttpConnection at org.eclipse.jetty.websocket.WebSocketFactory.upgrade(WebSocketFactory.java:235) at org.eclipse.jetty.websocket.WebSocketFactory.acceptWebSocket(WebSocketFactory.java:396) at org.cometd.websocket.server.WebSocketTransport.handle(WebSocketTransport.java:106) at org.cometd.server.CometdServlet.service(CometdServlet.java:165) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97) at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:247) at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:210) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3774) at com.ibm.ws.webco…
tagged with: servlets
type: Question
tagged with: websphere
answer count: 0
has comment: http://stackoverflow.com/comment/40007353
has comment: http://stackoverflow.com/comment/40012386
has comment: http://stackoverflow.com/comment/40110004
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40071172
has title: CometD on WAS: ServletWrapper service Uncaught service() exception thrown by servlet cometd
tagged with: cometd
score: 0
has comment: http://stackoverflow.com/comment/40007486
tagged with: java
has comment: http://stackoverflow.com/comment/40061353

http://stackoverflow.com/comment/39837297
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25517998
score: 0
has text: You'll likely get a wider audience on [Server Fault](http://serverfault.com/about).

http://stackoverflow.com/comment/39834968
score: 0
comment on: http://stackoverflow.com/a/25516352
type: Comment
type: AnswerComment
has text: Agreed. I was trying to use ceiling to retrieve an element from a set to avoid the iterator. (In a set orderd by score)

http://stackoverflow.com/comment/39788347
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25477942
has text: can you please tell me where should I paste the code ... to be specific in mainactivity.java or imageadapter.java

http://stackoverflow.com/q/25395360
favorite count: 0
accepted answer: http://stackoverflow.com/a/25398338
has answer: http://stackoverflow.com/a/25398338
type: Question
upvote count: 2
tagged with: camera
tagged with: android
tagged with: parameters
has body: When dumping Android Camera.Parameters I've noticed a parameter called fast-fps-mode=0. Does anyone have any information on how this parameter is altered? It doesn't appear to be mentioned in any documentation that I can find. Ideally I'm trying to improve my frame rate, more ideally set a constant frame rate.
tagged with: frame-rate
score: 2
has title: fast-fps-mode in Android Camera.Parmaters - how to access and alter?
type: AnsweredQuestion
tagged with: java
downvote count: 0
answer count: 1

http://stackoverflow.com/a/25489941
has comment: http://stackoverflow.com/comment/96700743
answers question: http://stackoverflow.com/q/25489359
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: Anyway, I managed to resolve this problem. You need to do something using JPA before the table can be created. For example... package sessionBean; import javax.ejb.Stateless; import entity.userEntity; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.PersistenceContext; import javax.persistence.Query; @Stateless public class userSessionBean implements userSessionBeanLocal { @PersistenceContext private EntityManager entityManager; @Override public userEntity getUser(String userName) { Query query = entityManager.createQuery("SELECT u FROM userEntity u WHERE u.userName = :inUserName"); query.setParameter("inUserName", userName); userEntity systemUser = null; try { systemUser = (userEntity) query.getSingleResult(); } catch (NoResultException ex) { ex.printStackTrace(); } return systemUser; } }
accepted answer of: http://stackoverflow.com/q/25489359
type: Answer

http://stackoverflow.com/q/25396395
answer count: 0
type: UnansweredQuestion
tagged with: 64-bit
downvote count: 0
has body: I installed Eclipse 3.7.2 (64 bits) and update svn connector polarion 1.8.5. After that, I checked out project from svn successfully but I have 2 problems with Eclipse and svn information Sometimes, Svn information of project does not show and I can't update or commit data When I try to expand some folders from my project data, the Eclipse has been crashed. A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x000000342067997a, pid=31186, tid=1082423616 JRE version: 6.0_27-b07 Java VM: Java HotSpot(TM) 64-Bit Server VM (20.2-b06 mixed mode linux-amd64 compressed oops) Problematic frame: C [libc.so.6+0x7997a] short+0x3a An error report file with more information is saved as: /users/jimmy/hs_err_pid31186.log If you would like to submit a bug report, please visit: http://java.sun.com/webapps/bugreport/crash.jsp Please help me to find out the problems
upvote count: 1
favorite count: 0
type: Question
tagged with: linux
score: 1
tagged with: svn
tagged with: java
has comment: http://stackoverflow.com/comment/39610650
has title: Eclipse 3.7.2 (64 bits) crash when using svn connector polarion 1.8.5
tagged with: eclipse

http://stackoverflow.com/a/25542932
answers question: http://stackoverflow.com/q/25542767
has comment: http://stackoverflow.com/comment/39882146
has body: There is no direct connection between Android and MySql &amp; PHP. In your screen shot you see phpMyAdmin this is just a UI for MySQL database (there are more). To achieve your goal you need a server, for example wamp which contains Apache, MySql &amp; PHP. With PHP and MySql you need to create a web services. After you create these services you can write an Android application that call these services.
has comment: http://stackoverflow.com/comment/39883313
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39677084
type: Comment
type: AnswerComment
has text: java.text.ParseException: Unparseable date: ""
comment on: http://stackoverflow.com/a/25418742
score: 0

http://stackoverflow.com/q/25447462
has answer: http://stackoverflow.com/a/25447812
has comment: http://stackoverflow.com/comment/39704655
tagged with: loops
upvote count: 1
tagged with: methods
has answer: http://stackoverflow.com/a/25448499
has comment: http://stackoverflow.com/comment/39704652
favorite count: 0
has comment: http://stackoverflow.com/comment/39704648
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39704844
tagged with: arrays
score: -1
linked to: http://stackoverflow.com/q/4040001
has title: How do I create a simple Random Number Generator in Java that has no duplicates and stores the results in an array to print out to the end user?
has body: I'm a beginner in Java and I'm stuck on how to make a working random number generator that has no duplicates (ie. create lotto numbers in a certain range). I know how to display a menu through JOptionPane and also accepting a user input through showInputDialog, but the generator has me stumped for days. Would I need to use loops and use other methods within my program also? Many Thanks. EDIT: I have this example from a Poker Project I found, see generateUniqueHand, how can I take that code out and work in a program where i run that and output the array? import javax.swing.JOptionPane; public class PokerPart2ToDateWithMethods { public static String userMessage = ""; public static void main(String[] args) { int handSize = 5, winType; int[] cards = new int[handSize]; int[] suits = new int[handSize]; int[] values = new int[handSize]; generateUniqueHand(cards); determineSuitsAndValues(cards, suits, values); orderValuesInDescendingSequence(suits, values); displayCardsToEndUser(suits, values); winType = evaluateHandOfCards(suits, values); getTypeOfWinIfAnyInText(winType); JOptionPane.showMessageDialog(null,userMessage); } public static void generateUniqueHand(int [] cards) { int deckSize = 52; int uniqueNumbersRequired = cards.length, aRandomNumber; int index = 0, duplicateIndex; while (index &lt; uniqueNumbersRequired) { aRandomNumber = (int) (Math.random() * deckSize); cards[index] = aRandomNumber; duplicateIndex = 0; while (cards[duplicateIndex] != aRandomNumber) duplicateIndex++; if (index == duplicateIndex) index++; } } public static void determineSuitsAndValues(int [] cards, int [] suits, int [] values) { for (int i = 0; i &lt; cards.length; i++) { suits[i] = cards[i] / 13; values[i] = cards[i] % 13; } } public static void orderValuesInDescendingSequence(int [] suits, int [] values) { int pass, comparison, temp; boolean sorted = false; for (pass = 1; pass &lt;= values.length - 1 &amp;&amp; !sorted; pass++) { sorted = true; for (comparison = 1; comparison &lt;= values…
has answer: http://stackoverflow.com/a/25447879
tagged with: random
answer count: 3
has comment: http://stackoverflow.com/comment/39704654
tagged with: java
downvote count: 2

http://stackoverflow.com/a/25450890
score: 0
type: Answer
has body: Running chcp 1253 sets your console codepage to Windows 1253, and yet you set Java to not use it... If you are running your program via a batch script, save it as UTF-8 and add -Dfile.encoding=UTF-8 to parameters for the java command. If you are running your program via the console, run chcp 65001 to switch the console to UTF-8. Also, you set the variable correctly, you can leave it that way, but you can also run Java with this option set explicitly: chcp 65001 java -Dfile.encoding=UTF-8 -jar binks.jar EDIT: If Windows is still complaining and/or messing stuff up, try changing 65001 to 1523 and UTF-8 to Windows-1253. You'll lose support for most of Unicode, but there's greater chance now it will work.
has comment: http://stackoverflow.com/comment/39712483
answers question: http://stackoverflow.com/q/25449772

http://stackoverflow.com/comment/39842192
score: 0
has text: @lavekush ip address 10.0.x.x will not work for all the cases. But if you get your ipv4 using ipconfig in cmd prompt. Ip will look like 192.x.x.x. and it will definitely work.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25519326

http://stackoverflow.com/comment/39886027
score: 0
type: AnswerComment
has text: I deleted my answer. I totally misunderstood the question. This answer is correct.
type: Comment
comment on: http://stackoverflow.com/a/25545315

http://stackoverflow.com/comment/39891454
type: AnswerComment
has text: thank you, you confirm what I hoped wasn't the case which is I need to create an app on the wearable itself now as well to do what i need.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25548109

http://stackoverflow.com/comment/40077441
has text: [`BarChartDemo5`](http://www.jfree.org/jfreechart/samples.html) looks like a working example.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25533639
type: AnswerComment

http://stackoverflow.com/a/25463493
has comment: http://stackoverflow.com/comment/39735886
has body: Here's the code that solves your issue: In Jquery: $(document).ready(function(){ $('form').submit(function(event){ event.preventDefault(); }); }); or In Javascript: Calling function as onclick="cancelFormSubmission()" function cancelFormSubmission(e) { var evt = e ? e:window.event; if (evt.preventDefault){ evt.preventDefault(); } evt.returnValue = false; // Add your validation code from here ---- ---- ---- }
has comment: http://stackoverflow.com/comment/39735529
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25463427
has comment: http://stackoverflow.com/comment/39735555

http://stackoverflow.com/q/25515393
has answer: http://stackoverflow.com/a/48036841
downvote count: 0
has answer: http://stackoverflow.com/a/25515427
favorite count: 0
tagged with: git
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25515427
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39832501
answer count: 2
accepted answer: http://stackoverflow.com/a/48036841
has body: How do I add an existing java project in eclipse to git? I noticed when creating the project there was an option to add to source control but I can't find this option for an existing project. Is this possible from the git plugin in eclipse or must it be done from the command line? (I am using a Mac)
upvote count: 35
score: 35
tagged with: java
has title: How do I add existing eclipse java project to git

http://stackoverflow.com/a/25469179
downvote count: 0
has comment: http://stackoverflow.com/comment/39747064
has comment: http://stackoverflow.com/comment/39747101
has comment: http://stackoverflow.com/comment/39746794
has comment: http://stackoverflow.com/comment/39746733
has comment: http://stackoverflow.com/comment/39746900
has comment: http://stackoverflow.com/comment/39746813
has comment: http://stackoverflow.com/comment/39747052
has comment: http://stackoverflow.com/comment/39747035
has comment: http://stackoverflow.com/comment/39746925
has comment: http://stackoverflow.com/comment/39747086
answers question: http://stackoverflow.com/q/25469114
type: Answer
has comment: http://stackoverflow.com/comment/39747076
has comment: http://stackoverflow.com/comment/39746950
has comment: http://stackoverflow.com/comment/39747013
score: 2
upvote count: 2
has body: java -cp . JdbcPostgresqlConnection So, clearly, the only thing that is in the classpath is the current directory (.). The postgresql driver jar is not. You need to add it to the classpath: java -cp .:/path/to/driver.jar JdbcPostgresqlConnection on Linux/MacOS, or java -cp .;c:\path\to\driver.jar JdbcPostgresqlConnection on Windows.

http://stackoverflow.com/q/25473938
has title: Matrix multiplication index out of bounds exception
upvote count: 0
type: UnansweredQuestion
score: -2
downvote count: 2
has body: import java.util.Scanner; class matrixmultiply { static void matrixmultiply(int x[][],int y[][]) { int i=0; int matrix3[][]=new int[x.length][y[i].length]; for(i=0;i&lt;matrix3.length;i++) { for(int j=0;j&lt;matrix3[i].length;i++) { matrix3[i][j]=0; for(int ip=0;ip&lt;y.length;ip++) { matrix3[i][j]+=x[i][ip]*y[ip][j]; } } } for(i=0;i&lt;matrix3.length;i++) { for(int j=0;j&lt;matrix3[i].length;i++) { System.out.println(matrix3[i][j]+" "); } System.out.println(); } } public static void main(String args[]) { Scanner x=new Scanner(System.in); int m,n,p,q; System.out.println("enter rows and columns of 1st matrix"); m=x.nextInt(); n=x.nextInt(); int matrix1[][]=new int[m][n]; System.out.println("enter rows and columns of 2nd matrix"); p=x.nextInt(); q=x.nextInt(); int matrix2[][]=new int[p][q]; if(n==p) { System.out.println("matrices can be multiplied"); for(int i=0;i&lt;matrix1.length;i++) { for(int j=0;j&lt;matrix1[i].length;i++) { matrix1[i][j]=x.nextInt(); } } for(int i=0;i&lt;matrix2.length;i++) { for(int j=0;j&lt;matrix2[i].length;i++) { matrix2[i][j]=x.nextInt(); } } matrixmultiply(matrix1,matrix2); } else System.out.println("matrices can't be multiplied"); } } The problem occurring is: Exception in thread "main" java.lang.Arrayindexoutofboundsexception: 2 at matrixmultiply.main&lt;matrixmultiply.java:46&gt;
has answer: http://stackoverflow.com/a/25473975
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25474094
favorite count: 0
type: Question

http://stackoverflow.com/q/25489745
has comment: http://stackoverflow.com/comment/39784103
has answer: http://stackoverflow.com/a/25489823
has comment: http://stackoverflow.com/comment/39784114
has body: I have a List of Pojo which has about 10000 objects. I need to remove an object from this List where pojo.getAccountId() = provided String. Is this possible to remove this object without having to iterate over the whole list? I have to do a lot of removals and so I don't want to iterate over the list. Currently I am planning to create a hashmap&lt;&gt; from my list where key = pojo.getAccountId(). Using map i can do map.remove(key). I would like to avoid this conversion process if possible at all.
answer count: 4
type: AnsweredQuestion
score: 0
tagged with: list
has comment: http://stackoverflow.com/comment/39784174
has answer: http://stackoverflow.com/a/25490064
tagged with: java
possible better answer: http://stackoverflow.com/a/25489927
has comment: http://stackoverflow.com/comment/39784236
has title: Remove object from list that matched a specified criteria
has answer: http://stackoverflow.com/a/25489948
has answer: http://stackoverflow.com/a/25489927
type: Question
accepted answer: http://stackoverflow.com/a/25490064

http://stackoverflow.com/q/25414385
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/26046275
type: Question
score: 0
has title: Hibernate One-to-One unidirectional on foreign key
answer count: 1
accepted answer: http://stackoverflow.com/a/25415207
tagged with: mysql
has body: I have 2 table: CREATE TABLE product( `id` INT NOT NULL AUTO_INCREMENT, // SOME OTHER DATA PRIMARY KEY (`id`)); CREATE TABLE announce ( `id` INT NOT NULL AUTO_INCREMENT, `productId` INT NOT NULL, // SOME OTHER DATA PRIMARY KEY (`id`), UNIQUE INDEX `productIdd_UNIQUE` (`productId` ASC), CONSTRAINT `FK_ANNOUNCE_PRODUCT` FOREIGN KEY (`productId`) REFERENCES `product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE); I would like to realize One-to-One unidirectional on foreign key with hibernate 4 here my configuration hbm.xml : <column name="id" /> <generator class="native" /> <one-to-one name="product" foreign-key="productId" cascade="all-delete-orphan" lazy="false" /> ... <column name="id" /> <generator class="native" /> ... I'm able to get the data in base, but when i tried to create an announce with an existing product my code throw an SQLException 22:56:17.565 DEBUG o.h.e.jdbc.spi.SqlExceptionHelper - could not execute statement [n/a] java.sql.SQLException: Field 'productId' doesn't have a default value The save generate the id of my foreign key, but i don't understand why. the java code (my dao make base instruction like sessionFactory.save etc...): Announce announce = new Announce(); ... Product product = this.productDao.getProduct(productId); announce.setProduct(product); this.announceDao.save(announce); Someone have an idea how to solve my problem ?
has answer: http://stackoverflow.com/a/25415207

http://stackoverflow.com/a/25518062
has body: Linux OS has a OOM Mechanism, when OS's memory is insufficient. The OOM will kill the cost max memory program(In most situations, Linux Out Of Memory Management). Obviously Your tomcat own the max memory. How to solve? In my experience, you must observe the memory usage of OS, you can use the top command to observe, and find the proper process. and at the same time, you can use the jvisualvm to observe the usage memory of tomcat.
answers question: http://stackoverflow.com/q/25517998
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39837479
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39777910
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25486539
has text: Or you just drag the lower right corner (there should be a small black sqare) of B1 downwards...
score: 1

http://stackoverflow.com/comment/39848191
has text: Are you actually sending a line anywhere ? i.e. a string ending with a \n
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25524414

http://stackoverflow.com/comment/39756111
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25451561
has text: I tried but didn't worked out, In children query request I am getting 0 count though parent user story has 10 children.

http://stackoverflow.com/a/25495646
has body: "http://almaden.ibm.com//".replace(/\/\/$/,'/') /\/\/$/ matches a // at the end of the string
answers question: http://stackoverflow.com/q/25495472
type: Answer
score: 0

http://stackoverflow.com/a/25422289
has comment: http://stackoverflow.com/comment/39658603
has body: You are printing a full square in the second loop. The first one is producing multiple squares. Try this code: public static void main(String[] args) { // int a=input.nextInt(); int a = 4; for (int i = 1; i &lt;= a; i++) { for (int k = 0; k &lt; a; k++) { System.out.print(i + k); System.out.print(" "); } System.out.println(); } }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25421856
upvote count: 2
score: 2

http://stackoverflow.com/a/25463421
upvote count: 2
has comment: http://stackoverflow.com/comment/39737610
accepted answer of: http://stackoverflow.com/q/25462954
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39735634
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39739151
answers question: http://stackoverflow.com/q/25462954
has comment: http://stackoverflow.com/comment/39735447
has body: It's because of some things that happen behind the scenes. The bullet wrapper calls bullet via JNI. This happens mostly via the class CollisionJNI which has lots of static methods. When looking at the source of the ContactListener class you will see the following constructor: public ContactListener() { this(false); if (!setEvents()) throw new com.badlogic.gdx.utils.GdxRuntimeException("Only one method per callback event can be overridden."); enable(); } ... public void enable() { CollisionJNI.ContactListener_enable(swigCPtr, this); } As you see the constructor of ContactListener (which is called when you instantiate any subclass extending it as well) automatically will call enable() which registers this instance via JNI as the callback listener. No black magic here :=) If it will make you feel more comfortable, you can add a call to myContactListener.enable() yourself. The same way it is possible to call myContactListener.disable() to turn it off.

http://stackoverflow.com/comment/39820498
has text: There is a similar question at codereview http://codereview.stackexchange.com/questions/44849/construct-date-sequence-in-scala
comment on: http://stackoverflow.com/q/25503958
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25524345
type: UnansweredQuestion
score: 1
answer count: 1
downvote count: 0
upvote count: 1
has body: I have the following controller in an MVC application with Spring and Hibernate: @RequestMapping(value = { "/mypage"}, method = RequestMethod.POST) public ModelAndView showPage(Model model, HttpServletRequest request) { ModelAndView mv = new ModelAndView(); try { // Here I call a Service and then a DAO, where I can get HibernateException } catch (Exception ex) { ex.printStackTrace(); } mv.setViewName("mypage"); return mv; I'm not sure the exceptions are handled correctly here. First of all: I don't throw any checked exception (HibernateException is also unchecked). However I need to catch all the exceptions, because I want to show to the user the same page anyway with a notification error (instead of an error page). In my DAO I didn't catch or rethrew any exceptions. My questions are: Is it fine to catch and deal with exceptions in that way? Should I also catch HibernateException separately in the controller? Should I do something more than just logging? Should I also catch the exception in the DAO and then rethrow it? Should rethrow a different type of exception to the controller?
favorite count: 0
type: Question
has title: Exception in an MVC app and dealing with Hibernate Exception
has answer: http://stackoverflow.com/a/25524519
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/39749959
has text: then what will be the solution
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25471343

http://stackoverflow.com/a/25471086
has comment: http://stackoverflow.com/comment/39749705
has comment: http://stackoverflow.com/comment/39749568
has comment: http://stackoverflow.com/comment/39749587
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39749498
has comment: http://stackoverflow.com/comment/39749626
accepted answer of: http://stackoverflow.com/q/25470879
has body: What is the difference between these statements? As per my understanding both are same. How can both your codes be same??? In your first case, you are initialising your flag variable with false, so it will be assuming initailisation of flag variable with each iteration of loop (decision taken by compiler at compile-time as it doesn't know about the no. of iterations), BUT IN REALITY THIS CODE WON'T BE EXECUTED EVER---thereby treating it as a non-final variable, hence, contradiction, whereas in second case it also won't run as the flag has already been declared false at the declaration step only, NOT INSIDE THE BODY OF LOOP!!! So, the second one will be an infinite loop! final boolean flag; while (flag = false) { // First code---flag final variable initialised with each iteration System.out.println("inside loop"); } final boolean flag = false; while (flag) { // Second code System.out.println("inside loop"); } Why first sample code doesn't talk about unreachable code. The second compilation error is clear to me. Because either of the compilation error is reported first. In this case, the first one is showing error related to flag variable incorrect declaration. As taken from Wikipedia: A final variable can only be initialized once, either via an initializer or an assignment statement. It does not need to be initialized at the point of declaration: this is called a "blank final" variable. A blank final instance variable of a class must be definitely assigned in every constructor of the class in which it is declared; similarly, a blank final static variable must be definitely assigned in a static initializer of the class in which it is declared;
has comment: http://stackoverflow.com/comment/39749528
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25470879
has comment: http://stackoverflow.com/comment/39749674
downvote count: 1
has comment: http://stackoverflow.com/comment/39749748
has comment: http://stackoverflow.com/comment/39810293
has comment: http://stackoverflow.com/comment/39749505

http://stackoverflow.com/comment/39712799
has text: @Vlad PL/Perl or PL/Python are part of the core PostgreSQL distribution. Python's `urlparse` is part of Python's core. Pretty safe bet IMO, and you can always fall back to one of the `split_part` solutions already offered by others if you really needed to for some reason.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25448770
type: AnswerComment

http://stackoverflow.com/comment/39816371
type: AnswerComment
has text: @Buzz: I updated my answer to show how to load properties with Spring and use them in Java code
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25506711

http://stackoverflow.com/q/25524556
tagged with: optimization
type: Question
has body: So I have the following code that takes the input of two arrays, and apply some queries to match elements from Array1 with elements from Array2, then it returns the number of elements that are similar in the two ArrayLists. Here is the code I use: public static void get_ND_Matches() throws IOException{ @SuppressWarnings("rawtypes") List<String> array1 = new ArrayList<String>(); List<String> array2 = new ArrayList<String>(); array1 = new ArrayList<String>( ClassesRetrieval.getDBpediaClasses()); array2 = new ArrayList<String>( ClassesRetrieval.fileToArrayListYago()); String maxLabel=""; HashMap<String,Integer> map = new HashMap<String,Integer>(); int number; HashMap<String,ArrayList<String>> theMap = new HashMap<>(); for(String yagoClass:array2){ theMap.put(yagoClass, getListTwo(yagoClass)); System.out.println("Done for : "+yagoClass ); } for(String dbClass:array1){ ArrayList<String> result = get_2D_Matches(dbClass); for(Map.Entry<String, ArrayList<String>> entry : theMap.entrySet()){ String yagoClass=entry.getKey(); Set<String> IntersectionSet =Sets.intersection(Sets.newHashSet(result), Sets.newHashSet(entry.getValue())); System.out.println(dbClass + " and "+ yagoClass+ " = "+ IntersectionSet.size()); number = IntersectionSet.size(); map.put(yagoClass, number); } int maxValue=(Collections.max(map.values())); for(Entry<String, Integer> entry:map.entrySet()){ if(entry.getValue()==maxValue && maxValue != 0){ maxLabel = entry.getKey(); } if(maxValue==0){ maxLabel = "Nothing in yago"; } } System.out.println("-------------------------------"); System.out.println(dbClass+" from DBPEDIA Corresponds to "+ maxLabel); System.out.println("-------------------------------"); } } This code returns for example: Actor from DBPEDIA Corresponds to Yago_Actor Album from DBPEDIA Corresponds to Yago_Album SomeClass from DBPEDIA Corresponds to nothing in Yago Etc.. Behind the scenes, this code uses getDBpediaClasses and then applies Get_2D_Matches(); method to get an arrayList of results f…
has answer: http://stackoverflow.com/a/25527518
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/39849818
tagged with: concurrency
has comment: http://stackoverflow.com/comment/39848520
upvote count: 0
type: UnansweredQuestion
tagged with: multithreading
answer count: 1
has title: Need to use of concurrency in this java method
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39789162
type: QuestionComment
has text: "I understand that when you divide a double by an integer it truncates" This is not true. This only happens when you divide an integer by another integer, which is what you're doing.
score: 1
comment on: http://stackoverflow.com/q/25492246
type: Comment

http://stackoverflow.com/comment/39859693
score: 0
comment on: http://stackoverflow.com/q/25529003
type: Comment
has text: 2014-08-27 11:01:01,530 ERROR [batchJobRunExecuter-1][:] org.springframework.integration.handler.LoggingHandler : org.springframework.integration.MessageDeliveryException: Dispatcher has no subscribers. at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:108) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:101)
type: QuestionComment

http://stackoverflow.com/comment/40019670
has text: @DharshanSithamparam Because these are special characters that have their own meaning in regular expressions. For example, `.` denotes a special character that means any character.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25544445

http://stackoverflow.com/q/25505870
linked to: http://stackoverflow.com/q/23058309
type: AnsweredQuestion
has title: Does Java use AES-NI when available?
upvote count: 3
answer count: 2
duplicate of: http://stackoverflow.com/q/23058309
has comment: http://stackoverflow.com/comment/39815050
downvote count: 0
tagged with: instruction-set
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39816006
score: 3
has comment: http://stackoverflow.com/comment/39860284
tagged with: aes-ni
has answer: http://stackoverflow.com/a/25512009
possible better answer: http://stackoverflow.com/a/25512009
has comment: http://stackoverflow.com/comment/39814146
tagged with: java
tagged with: cryptography
has answer: http://stackoverflow.com/a/25508946
accepted answer: http://stackoverflow.com/a/25508946
tagged with: aes
has body: I just heard of the instruction set extension AES-NI. Does Java's JIT compiler compile the application to use AES-NI if it is available to enhance performance? And if yes, does it also do so if it is not sure that AES will be used (like when using TLS)?

http://stackoverflow.com/comment/39626932
comment on: http://stackoverflow.com/q/25402487
has text: sorry if i didn't explain myself , i meant that is not possible to create array that depend on one of the value of the array. for example if my array is {4,5,6,5} and { 6,5,3,2,20} so one solution for this is to create new array with size 20 and then pass cell by cell and insert each value to his relevant index for example value 4 will go to cell 4 (in the new array ) and value 3 will go to cell 3.. and so on , the problem in this way is that is required at list 20 cells in my array .. and if i received a very high number i getting out of memory( logic ).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39835244
has text: This is sleek =), I love the compactness of it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25498058
type: AnswerComment

http://stackoverflow.com/comment/39855874
type: Comment
has text: But how can i set a layout when I have a canvas already? I am not experienced on the android development and I know how to do layouts and those... But how to set a layout that will take place on the game itself without hurting its screen?(I mean without controlling the view of the game..?)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25527963

http://stackoverflow.com/q/25431255
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/25440020
tagged with: powermock
upvote count: 0
type: UnansweredQuestion
has title: powermock mock private method but not executing the private method
score: -3
answer count: 1
has body: How mock private method that invoked by a public method, but i don't want the private method's code executing: the code: @RunWith(PowerMockRunner.class) @PrepareForTest(B.class) public class A { public static void main(String[] args) throws Exception{ B b = PowerMockito.spy(new B()); PowerMockito.doReturn("test").when(b,"test"); // MY PROBLEM: // there: console print "test method" // i just want return "test" and don't real execute test() String t = b.print(); System.out.println(t); } } class B{ public String print(){ System.out.println("pp method"); return test(); } private String test(){ System.out.println("test method"); return "t"; } }
has comment: http://stackoverflow.com/comment/39687922
favorite count: 0
tagged with: private
tagged with: java
has comment: http://stackoverflow.com/comment/39675764
downvote count: 3

http://stackoverflow.com/comment/39738455
type: Comment
has text: Application design is independent of Unchecked exception. Can you design a software that prevents a remote server from going down or returning a 404 error when you anticipate a content containing webpage?
type: QuestionComment
comment on: http://stackoverflow.com/q/25465131
score: 0

http://stackoverflow.com/q/25403470
tagged with: entitymanager
type: AnsweredQuestion
score: 0
has title: distinct(true) - could not prepare statement
has body: I am using hibernate with spring. However, when adding .distinct(true) like criteria.select(cb.construct(Customer.class, root.get("Name"))).distinct(true);. Then I am receiving the following exception: Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not prepare statement at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:273) at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getResultList(CriteriaQueryCompiler.java:254) at com.limitCalculator.dao.FilterDaoImpl.getFilter(FilterDaoImpl.java:83) at com.limitCalculator.dao.FilterDaoImpl$$FastClassByCGLIB$$a62bf500.invoke(&lt;generated&gt;) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631) at com.limitCalculator.dao.FilterDaoImpl$$EnhancerByCGLIB$$6ca0bd06.getFilter(&lt;generated&gt;) at com.limitCalculator.service.FilterServiceImpl.getFilter(FilterServiceImpl.java:37) at com.limitCalculator.gui.timerSelection.MainTabPanel.placeS…
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/44328840
possible better answer: http://stackoverflow.com/a/44328840
accepted answer: http://stackoverflow.com/a/25403771
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25403771

http://stackoverflow.com/a/51439869
has body: There's an easier, more efficient way documented at https://github.com/bytedeco/javacpp/issues/38#issuecomment-140728812, in short: To JavaCPP/JavaCV: Mat mat2 = new Mat((Pointer)null) { { address = mat.getNativeObjAddr(); } }; To official Java API of OpenCV: Mat mat = new Mat(mat2.address()); EDIT: OpenCVFrameConverter now provides an easier and safer way to do this, for example: OpenCVFrameConverter.ToMat converter1 = new OpenCVFrameConverter.ToMat(); OpenCVFrameConverter.ToOrgOpenCvCoreMat converter2 = new OpenCVFrameConverter.ToOrgOpenCvCoreMat(); Mat mat = ...; org.opencv.core.Mat cvmat = converter2.convert(converter1.convert(mat)); Mat mat2 = converter2.convert(converter1.convert(cvmat));
has comment: http://stackoverflow.com/comment/100214001
has comment: http://stackoverflow.com/comment/100199216
downvote count: 0
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25535057
upvote count: 4
has comment: http://stackoverflow.com/comment/96530448

http://stackoverflow.com/q/25536845
answer count: 2
has comment: http://stackoverflow.com/comment/39871469
has title: How to run a Java program on all files in a directory from command line
has comment: http://stackoverflow.com/comment/39871664
has comment: http://stackoverflow.com/comment/39871606
accepted answer: http://stackoverflow.com/a/25536904
linked to: http://stackoverflow.com/q/3154488
type: Question
has body: I've got this java program which is currently programmed to take in a filename as an argument from command line, open it and then read it. I want to configure it so I can pass it a directory name and the program will execute on the files in the directory. Not really sure how to go about it. This is my code currently: static XMLInputFactory factory = XMLInputFactory.newInstance(); XMLEventReader reader = null; XMLEventFactory eventFactory = null; public XMLTrimmer(File ifp) throws XMLStreamException, FileNotFoundException { this(new FileInputStream(ifp)); } public XMLTrimmer(InputStream str) throws XMLStreamException, FileNotFoundException { try { reader = factory.createXMLEventReader(str); } catch (XMLStreamException e) { e.printStackTrace(); } } In main it goes like this: public static void main(String args[]) throws IOException, XMLStreamException { File readFile = new File(args[0]); XMLTrimmer xr = new XMLTrimmer(readFile); please let me know, any help is appreciated.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25537197
score: 0
has answer: http://stackoverflow.com/a/25537197
tagged with: java
tagged with: command-line-arguments
duplicate of: http://stackoverflow.com/q/3154488
tagged with: unix
has answer: http://stackoverflow.com/a/25536904
tagged with: command-line

http://stackoverflow.com/q/25488498
tagged with: esx
has comment: http://stackoverflow.com/comment/39781807
has comment: http://stackoverflow.com/comment/39781879
tagged with: java
has title: Slow performance during maven build on VMware ESX Virtual Machine
has comment: http://stackoverflow.com/comment/39783271
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/79452174
has answer: http://stackoverflow.com/a/25883369
answer count: 2
downvote count: 0
tagged with: maven
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39782307
has comment: http://stackoverflow.com/comment/39782298
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/39782001
tagged with: vmware
has comment: http://stackoverflow.com/comment/39783790
has body: In my company's CI environment we have two build servers - ubuntu server 14.04 and windows server 2008 R2 - both deployed on VMware ESX VM, with the best resources available (cpu, memory and SSD storage). However, when we build our java code using maven, it takes about 25 minutes, whereas on each developer's local pc it takes less than 5 minutes. We made some troubleshooting and we may have narrowed down possible causes to the integration between JVM and the actual VM (not OS). Seems like the maven process is not 'requesting' the expected disk resources it should be asking for fast performance (iops is our indication). Did any of you encounter such problems? Do you know of any special configuration needed in order to maximize JVM performance on VMware ESX VM? Thanks!
type: Question

http://stackoverflow.com/comment/39747570
comment on: http://stackoverflow.com/a/25463919
has text: Still not exactly what i was looking for but better then an if statement since that would be running when published anyway. This does not get compiled at all when export/publish my project if i understand it properly?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25499359
has comment: http://stackoverflow.com/comment/39887442
score: 1
tagged with: java
tagged with: mapreduce
has body: I am trying to do a secondary sort on 4 values in my output. I referred to this tutorial. I have a 4 node cluster running Hadoop 2.2.0. I use Idea IntelliJ IDE for debugging locally. Following are all the classes I am using. MAPPER: public class MapredHiveMapper extends Mapper&lt;LongWritable, Text, CompositeKey, Text&gt; { private Text finalString = new Text(); private CompositeKey internalKey; boolean flag = false; String pt_timestamp = null; private int assetId = 0; public void map(LongWritable key, Text value,Context context) throws IOException, InterruptedException { String append = ""; String row = value.toString(); String[] line; line = row.split(",", -1); finalString.set(row); internalKey = new CompositeKey(Integer.parseInt(line[0]),line[1],Integer.parseInt(line[2]),Integer.parseInt(line[3])); context.write(internalKey, finalString); } } REDUCER: public class MapredHiveReducer extends Reducer&lt;CompositeKey, Text, Text, Text&gt; { private Text outputValue = new Text(); private Text customKey = new Text(); boolean flag = false; String pt_timestamp = null; private int assetId = 0; public void reduce(CompositeKey key,Text values,Context context) throws IOException, InterruptedException { String append = ""; String row = values.toString(); String[] line; line = row.split(",", -1); if(Integer.parseInt(line[7])==0 || (Integer.parseInt(line[7])&gt;0 &amp;&amp; line[4]==line[6])) { if (!line[4].equals("\\N")) { assetId = Integer.parseInt(line[0]); pt_timestamp = line[4]; append = row; flag = true; } else { if (flag) if (Integer.parseInt(line[0])==assetId) append = row + ", new :- " + pt_timestamp; else append = row; } } outputValue.set(append); customKey.set(key.toString()); context.write(customKey, outputValue); } } CompositeKey.java public class CompositeKey implements WritableComparable&lt;CompositeKey&gt; { private Integer assetId; private String date; private Integer hourNum; private Integer quarterNum; public CompositeKey() { } public CompositeKey(int assetId…
has title: Hadoop MapReduce secondary sort: Reducer not getting called
favorite count: 0
type: Question
tagged with: hadoop
answer count: 0
type: UnansweredQuestion
downvote count: 0
upvote count: 1
tagged with: sorting

http://stackoverflow.com/comment/39820057
type: AnswerComment
comment on: http://stackoverflow.com/a/25505097
score: 0
type: Comment
has text: I mean that I still cannot get responses with status different from 0 when invoking REST services from the GWT client to the Spring server. Unfortunately, it is not an issue of capital letters in the header.

http://stackoverflow.com/q/25435531
tagged with: android-activity
answer count: 4
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25561657
has title: How do I save (make the spinner remember) the position of a selected item on the spinner drop down
has comment: http://stackoverflow.com/comment/39683517
upvote count: 2
type: UnansweredQuestion
tagged with: android
downvote count: 0
has body: I need to save the selected items in the spinner. Currently I have 3 sections, topnews/mynews and breakingviews. Each section has a dynamic list consisting of items say topnews has europe/asia/germany/frontnews etc. On the side I have a menu button from where I can add or remove the items to be displayed in each of these 3 categories. Now,everytime I select an item in the spinner say "germany" and then I click on the menu button and add or remove any item above or below germany, the position shifts on the spinner too , to the previously selected item or to the next item. How do I make the spinner remember the last selection irrespective of the item added or removed from the menu list through the menu button. I have added the following code in the sharedpreferencesmanager.java: private static final String PROPERTY_NEWS_INDEX = "newsindex"; public void savenewsselectedindex(int selectedindex) { mSharedPreferences.edit().putInt(PROPERTY_NEWS_INDEX, selectedindex).apply(); Log.d("newsdash", ""); } public int getnewsselectedindex(){ return mSharedPreferences.getInt(PROPERTY_NEWS_INDEX, 0); } The following is my fragment class: (i still haven't applied the sharedpreferences to it, am not sure where to add it and how to add it, whether to the position parameter or to the string displayed: public class NewsCategoriesFragment extends AbsLoaderFragment implements OnItemSelectedListener, OnClickListener, OnMenuItemClickedListener,Dialog.OnDismissListener { public static final String TAG_NEWS_CATEGORIES_FRAGMENT = "NewsCategoriesFragment"; private static int mSelectedCategoryCodePosition; private NewsCategorySpinnerAdapter mCategoryAdapter; private List&lt;AdapterRow&gt; mTopNewsRows; private List&lt;AdapterRow&gt; mMyNewsRows; private List&lt;AdapterRow&gt; mBreakingViewsRows; private List&lt;AdapterRow&gt; mMostReadNewsRows; private boolean mHasNonMyNewsCategoriesLoaded; private boolean mHasMyNewsCategoriesLoaded; private String mSelectedCategory; private boolean mFirstTimeLo…
tagged with: android-intent
has comment: http://stackoverflow.com/comment/39683958
has answer: http://stackoverflow.com/a/25435920
score: 2
has answer: http://stackoverflow.com/a/25499233
tagged with: android-fragments
has answer: http://stackoverflow.com/a/31861393
tagged with: java

http://stackoverflow.com/comment/39732197
comment on: http://stackoverflow.com/q/25461741
score: 1
type: Comment
type: QuestionComment
has text: possible duplicate of http://stackoverflow.com/a/6521412/2158970

http://stackoverflow.com/comment/39970753
type: Comment
has text: thank-you for your response ... the issue updated...
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25530150

http://stackoverflow.com/comment/39694867
type: Comment
type: AnswerComment
has text: went through both your links, I am really not able to understand what to do in the first link. In the second link, I again don;t understand what I need to do in the "/etc/profile" link. Can you please elaborate and help me with that?
comment on: http://stackoverflow.com/a/25436928
score: 0

http://stackoverflow.com/a/25432372
upvote count: 1
downvote count: 0
has body: Here is a solution that uses your enum more effectively. I see why your using map so you can pass the whole collection, but there is a better way using .values() see below public enum LocaleEnum { en_US("en_US", "English"), es_MX("es_MX", "Espanol"); private final String locale; private final String desc; LocaleEnum(String locale, String desc) { this.locale = locale; this.desc = desc; } public String getLocale() { return locale; } public String getDesc() { return desc; } } Then change your method that adds the enum to the model to. Note .values() is a static method for enums that returns an array. public LocaleEnum getLocales() { return LocaleEnum.values(); } so then your thymeleaf page then looks like ---- Select ---- Englishy
has comment: http://stackoverflow.com/comment/39689300
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25417504
has comment: http://stackoverflow.com/comment/39714164
has comment: http://stackoverflow.com/comment/59318984

strophe
tags question: http://stackoverflow.com/q/25412848
tag name: strophe
type: Tag
tags question: http://stackoverflow.com/q/25455638

http://stackoverflow.com/a/25466325
has body: You can't (at least not in a way that would function everywhere). That functionality uses Javascript, and HttpClient doesn't understand Javascript. You could go through the page source and determine if there's a way to fetch more content, but it can be tricky (minified javascript or other similar obstacles).
score: 0
answers question: http://stackoverflow.com/q/25466283
has comment: http://stackoverflow.com/comment/39740704
has comment: http://stackoverflow.com/comment/39741902
type: Answer

http://stackoverflow.com/a/25446231
downvote count: 0
has comment: http://stackoverflow.com/comment/39702126
answers question: http://stackoverflow.com/q/25446189
has body: Add this: int count = 0; // &lt;-- here for (int i = 0; i &lt; kalimat.length(); i++) { if (kalimat.charAt(i) == 's') { upperLetter += 'S'; count++; // &lt;-- and here } else { upperLetter += kalimat.charAt(i); } } In the end you will have the number of substitutions in the variable count.
score: 3
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/39702181
has comment: http://stackoverflow.com/comment/39702587

http://stackoverflow.com/comment/39767094
comment on: http://stackoverflow.com/q/25480570
type: QuestionComment
type: Comment
has text: What's the problem? `Calendar` use `0` based months (so January is `0`)...
score: 0

http://stackoverflow.com/comment/108560771
comment on: http://stackoverflow.com/a/25396866
type: AnswerComment
has text: No modern OS will allow one process to access the memory address space of another. As the address space of a process is virtual, the actual memory which one process addresses as 0xABCD is different than what any other process addresses as 0xABCD. The only way for two processes to communicate is with some mechanism explicitly provided by the OS for that purpose (pipes, memory mapped files, etc.). Of those, java only supports memory mapped files.
score: 0
type: Comment

javadoc
tags question: http://stackoverflow.com/q/25514373
tags question: http://stackoverflow.com/q/25456256
tags question: http://stackoverflow.com/q/25431696
type: Tag
tag name: javadoc
tags question: http://stackoverflow.com/q/25493177
tags question: http://stackoverflow.com/q/25432565
tags question: http://stackoverflow.com/q/25442947
tags question: http://stackoverflow.com/q/25422297

http://stackoverflow.com/comment/39746251
score: 0
has text: chartPanel is added twice to graph1
comment on: http://stackoverflow.com/q/25469360
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25429389
tagged with: android
has answer: http://stackoverflow.com/a/61073689
tagged with: imap
has body: My Android app must access to Gmail by IMAP with OAuth2, without the user's password. I have implemented the example: https://java.net/projects/javamail/pages/OAuth2 adding a Provider as required (The SASL XOAUTH2 provider will be added to the Java security configuration when SASL support is first used) this is my code: get access token public void getAndUseAuthTokenBlocking() throws JSONException { String token = ""; try { // Retrieve a token for the given account and scope. It will always return either // a non-empty String or throw an exception. String scope = "oauth2:https://mail.google.com/"; Log.i("Access TOKEN account",accountName); token = GoogleAuthUtil.getToken(activity.getApplicationContext(), accountName, scope); // Do work with token. URL url = new URL("https://www.googleapis.com/oauth2/v1/tokeninfo?access_token="+ token); HttpURLConnection con = (HttpURLConnection) url.openConnection(); int serverCode = con.getResponseCode(); if (serverCode == 200) { access_token = token; return; //bad token, invalidate and get a new one } else if (serverCode == 401) { // invalidate the token that we found is bad so that GoogleAuthUtil won't // return it next time (it may have cached it) GoogleAuthUtil.invalidateToken(activity.getApplicationContext(), token); // consider retrying getAndUseTokenBlocking() once more Log.w("Access TOKEN","INVALIDATO"); getAndUseAuthTokenBlocking(); } else { Log.e("SERVER CODE","Server returned the following error code: " + serverCode); return; } return; } catch (GooglePlayServicesAvailabilityException playEx) { Dialog alert = GooglePlayServicesUtil.getErrorDialog( playEx.getConnectionStatusCode(), activity,1); } catch (UserRecoverableAuthException userAuthEx) { // Start the user recoverable action using the intent returned by // getIntent() activity.startActivityForResult( userAuthEx.getIntent(), 1); return; } catch (IOException ioEx) { // network or server error, the call is expected to succeed if you try again later. // Don't attempt to…
score: 2
has comment: http://stackoverflow.com/comment/39679167
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/73000463
upvote count: 2
tagged with: java
tagged with: oauth-2.0
downvote count: 0
has title: IMAP Gmail Authentication: Invalid Credentials
answer count: 1
has comment: http://stackoverflow.com/comment/39673720
favorite count: 0
has comment: http://stackoverflow.com/comment/39672580
type: Question
has comment: http://stackoverflow.com/comment/39681826
type: UnansweredQuestion

http://stackoverflow.com/q/25515494
tagged with: sdk
type: UnansweredQuestion
tagged with: android
tagged with: eclipse
score: 0
tagged with: java
answer count: 1
has title: android progress bar for android browser
has answer: http://stackoverflow.com/a/25517483
type: Question
has body: I am making android browser app and completed 90%. I just want to know how can,I put some progress bar on my application so that people can see that page is loading and they have to wait. like this while the browser is uploading a page somewhat a this type of bar shows at top of the sccreen http://cdn.css-tricks.com/wp-content/uploads/2011/02/progressbars-fine.png thank you in advance

http://stackoverflow.com/q/25404020
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25404266
type: UnansweredQuestion
has body: Is it possible for equals() to return false, even if contents of two Objects are same? If yes, how do I prove it in the below code: In the below example how does p1.equals(p2) result in 'false' I know that incorrectly implemented equals() and hashcode() methods can result in this situation but wanted to know under what datasets will equality fail. public class Equalitytest { public static void main(String[] args) { Person p1 = new Person("abc",12); Person p2 = new Person("abc",12); //Is there any way which results in // assert p1.equals(p2) == false //What dataset will will satisfy the assertion to false? } public class Person { private String name; private int age; public Person(String name, int age){ this.name = name; this.age = age; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Person other = (Person) obj; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { return false; } if (this.age != other.age) { return false; } return true; } @Override public int hashCode() { int hash = 3; hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 53 * hash + this.age; return hash; } }
has comment: http://stackoverflow.com/comment/39624341
has comment: http://stackoverflow.com/comment/39624355
has comment: http://stackoverflow.com/comment/39624226
score: -1
tagged with: java
has comment: http://stackoverflow.com/comment/39624619
answer count: 1
downvote count: 3
has comment: http://stackoverflow.com/comment/39624348
has comment: http://stackoverflow.com/comment/39624242
has title: Is it possible for equals() to return false, even if contents of two Objects are same?

http://stackoverflow.com/q/25415030
favorite count: 0
type: Question
has title: Java functional map() with threading
answer count: 0
type: UnansweredQuestion
has body: I have an array of many hundreds of thousands of elements and I need to run a time consuming operation on each. I'm hesitant to use Executor due to the shear number of elements, is there any way I can do the computation on all the elements utilising multithreading without rolling my own solution?
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/39645688
tagged with: functional-programming
has comment: http://stackoverflow.com/comment/39645760
score: 1
has comment: http://stackoverflow.com/comment/39646965
tagged with: java
downvote count: 0

http://stackoverflow.com/q/25418087
has title: how to deploy java web application. steps to deploy
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39651155
accepted answer: http://stackoverflow.com/a/25418415
downvote count: 3
has answer: http://stackoverflow.com/a/25418415
favorite count: 0
linked to: http://stackoverflow.com/q/19097115
possible better answer: http://stackoverflow.com/a/25418205
type: Question
upvote count: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39651137
has answer: http://stackoverflow.com/a/25418205
tagged with: jsp
tagged with: tomcat
score: -3
has comment: http://stackoverflow.com/comment/39680160
tagged with: servlets
has body: I have done jsp servlet project in eclipse. I want to upload that project online. Project Developed in jsp,servlet. Server : Tomcat 7.0 What are the steps to deploy that project? What are the needs to our server. Is that possible to upload our project without war file.

http://stackoverflow.com/a/25484519
score: 0
has body: @paul What time-jone your system has? If it is GMT then only your comparision is valid. otherwise you will have to consider timezone offset in comparision too.
answers question: http://stackoverflow.com/q/25484036
type: Answer

http://stackoverflow.com/comment/39601814
comment on: http://stackoverflow.com/q/25391701
type: QuestionComment
has text: No, but you could do `@Path("/resource/add/class1")` and `@Path("/resource/add/class2")`
score: 0
type: Comment

http://stackoverflow.com/comment/39815949
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25502911
has text: Extract Source code from jar using JD GUI. And and then remove desired line, compile it, make jar file of it and then make smali files of it. Now compare original smali with new smali. you will get solution/clue.

http://stackoverflow.com/a/25550236
has body: public void onClick(DialogInterface dialog, int whichButton) { String pin = pinEntry.getText().toString().trim(); String secret = "0000"; if (pin.equalsIgnoreCase( secret)){ Toast.makeText(getApplicationContext(),"Access Approved", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(),"Access Denied", Toast.LENGTH_SHORT).show(); } Toast.makeText(getApplicationContext(),pin, Toast.LENGTH_SHORT).show(); } });
score: 0
answers question: http://stackoverflow.com/q/25550092
type: Answer

http://stackoverflow.com/q/25506056
tagged with: arrays
has answer: http://stackoverflow.com/a/25535977
tagged with: android-intent
has answer: http://stackoverflow.com/a/25506633
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39816853
has title: Put JSON array data in Hashmap and pass it through Intent Extra
has comment: http://stackoverflow.com/comment/39814714
type: Question
score: 0
answer count: 2
type: UnansweredQuestion
has body: In my app, I have successfully implemented passing JSON Objects via Intent to a new activity by doing find "findviewByid." Now this is a restaurant finder app, and each restaurant has several menu photos. I was looking all over stackoverflow to find sth like it but couldn't implement. This is a part of my JSON file: [ { login_id: "6", name: "Urban Spice", location: "banani", latitude: "23.790327", longitude: "90.409007", address: "House- 119, Road-11, Block-E, Banani", rating: "4.00", costfortwopeople: "0", openingclosingtime: "", type: "restaurant,ice cream parlour", perks: "kids zone,home delivery,catering", cuisine: "indian,indonesian", phone: "01777899901,2,3,9862672", image: - [ "http://www.petuuk.com/restaurant_images/img_2146.jpg", "http://www.petuuk.com/restaurant_images/img_2147.jpg" ], menu: - [ "http://www.petuuk.com/restaurant_images/.jpg", "http://www.petuuk.com/restaurant_images/.jpg", "http://www.petuuk.com/restaurant_images/.jpg", "http://www.petuuk.com/restaurant_images/.jpg", "http://www.petuuk.com/restaurant_images/.jpg", "http://www.petuuk.com/restaurant_images/.jpg", "http://www.petuuk.com/restaurant_images/.jpg", "http://www.petuuk.com/restaurant_images/.jpg" ] }, { login_id: "7", name: "The Sky Room Dining", location: "banani", latitude: "23.793972", longitude: "90.403190", address: "ABC House, 12th Floor, 8 Kemal Ataturk Avenue, Banani", rating: "4.00", costfortwopeople: "0", openingclosingtime: "", type: "restaurant", perks: "rooftop view,catering", cuisine: "thai,indian", phone: "01675019211,9822017", image: - [ "http://www.petuuk.com/restaurant_images/img_2204.jpg", "http://www.petuuk.com/restaurant_images/img_2205.jpg", "http://www.petuuk.com/restaurant_images/img_2206.jpg" ], etc.................................................................. I'm having a hard time retrieving the JSON array "menu" and "image" from the JSON output as above. I was able to retrieve the other JSON Objects such as login_id, name, location etc. The main obje…

http://stackoverflow.com/q/25431959
score: 15
has answer: http://stackoverflow.com/a/49826454
tagged with: focus
type: AnsweredQuestion
tagged with: java
tagged with: javafx
answer count: 3
accepted answer: http://stackoverflow.com/a/25433175
downvote count: 0
possible better answer: http://stackoverflow.com/a/25467653
has answer: http://stackoverflow.com/a/25433175
tagged with: nodes
favorite count: 0
has answer: http://stackoverflow.com/a/25467653
has body: I know that your can give focus to a node in javafx by doing node.requestFocus(); but is there a way to take away focus from a node in javafx or prevent focus on an object?
type: Question
has title: Is there a way to take away focus in javafx?
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/39677618
upvote count: 15

http://stackoverflow.com/a/25419160
score: -1
has body: You create session with HttpServletRequest object as follows. HttpSession session = httpServletRequest.getSession(); This will give you new session if one is not already created or return existing session object.
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/25419004
type: Answer

http://stackoverflow.com/q/25448226
score: 0
answer count: 0
tagged with: java
tagged with: runnable
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39706633
has comment: http://stackoverflow.com/comment/39706249
type: Question
has comment: http://stackoverflow.com/comment/39706883
has comment: http://stackoverflow.com/comment/39708487
has comment: http://stackoverflow.com/comment/39706202
has title: Runnable jar cannot find project jars
has body: I have an old project in Eclipse, I used to export it as a runnable jar w/o problems. I'm trying to export it as a runnable jar now, but when I try to run it, it cannot find the project jars like the mysql-connector.jar I added the jars by doing "Build path > configure build path > Add Library > Created a user lib with the external jars > added to project", after that the project runs in Eclipse w/o a problem. I can actually open the runnable jar, it shows the login screen (the first GUI on my software) but when I try to log in, it doesn't find the mysql.jar... When I run it from Eclipse, it works perfectly fine. So far I have no idea of what I'm doing wrong.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39707420
has comment: http://stackoverflow.com/comment/39706694
has comment: http://stackoverflow.com/comment/39706998
tagged with: jar
has comment: http://stackoverflow.com/comment/39709814
has comment: http://stackoverflow.com/comment/39709910
has comment: http://stackoverflow.com/comment/39707156

http://stackoverflow.com/comment/39817240
score: 0
comment on: http://stackoverflow.com/q/25504028
has text: Ok, I have edited the code. I have realized an error when I used copy/paste from Netbeans
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25452866
tagged with: rest
has comment: http://stackoverflow.com/comment/39716124
type: UnansweredQuestion
tagged with: jpa
tagged with: merge
has comment: http://stackoverflow.com/comment/39716022
has body: I have the object Usuario, I want to update it into the database, but it only save the changes in some attributtes. @Entity public class Usuario { @Id String nombre_Usuario; String contrasena; String estado; @OneToOne(cascade = CascadeType.ALL, fetch=FetchType.EAGER) @PrimaryKeyJoinColumn Posicion miPosicion; } @Entity public class Posicion { @Id int id; float latitud; float longitud; float altura; public Posicion() { id = (int) Math.floor(Math.random()*1000); latitud = longitud = altura = 0; } public Posicion(float alatitud, float alongitud, float aaltura) { id = (int) Math.floor(Math.random()*1000); latitud = alatitud; longitud = alongitud; altura = aaltura; } I'm working with a restfull service and when I want to change the object I do: Usuario u = new Usuario(); u = todoService.obtenerUsuarioBusqueda("user_name"); //Here I get the object I want to change u.setEstado("New Estado"); u.setmiPosicion(new Posicion(10,10,10)); todoService.saveUsuario(u); public String saveUsuario(Usuario u){ try{ entityManager.merge(u); }catch(Exception e){ return "false"+e.getMessage(); } return "true"; } I make this for update the object in the database. And when I make a find(u), the estado is "New Estado", but when I try to get the attribute miPosicion it is null. Just after making u.setmiPosicion(), if I make u.getmiPosicion() it is correct, the Posicion I have set. But when I make it from the object from find(u) it is null.
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/39715643
tagged with: java
has title: Restfull service, not updating some attributes of an object
tagged with: mysql
has comment: http://stackoverflow.com/comment/39716327
type: Question

http://stackoverflow.com/comment/39819931
score: 0
has text: Have you tried if it works as release? If so, perhaps you need to configure your remote host to support snapshots
type: Comment
comment on: http://stackoverflow.com/a/25494565
type: AnswerComment

http://stackoverflow.com/comment/39757098
has text: **[3.4. Optional configuration properties](http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#configuration-optional)**
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25475210

moxy
tag name: moxy
tags question: http://stackoverflow.com/q/25426170
type: Tag
tags question: http://stackoverflow.com/q/25536008

android-service
tags question: http://stackoverflow.com/q/25462719
tags question: http://stackoverflow.com/q/25426064
tags question: http://stackoverflow.com/q/25464257
tags question: http://stackoverflow.com/q/25497312
tags question: http://stackoverflow.com/q/25418951
tags question: http://stackoverflow.com/q/25470295
type: Tag
tags question: http://stackoverflow.com/q/25419550
tags question: http://stackoverflow.com/q/25458319
tag name: android-service

http://stackoverflow.com/comment/39704371
has text: Hmm, strange. Does the new `.classpath` still contain the absolute path entries (like `C:/gradlehome/caches...`) or only the `org.springsource.ide.eclipse.gradle.classpathcontainer`?
score: 0
comment on: http://stackoverflow.com/a/25427866
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25427185
score: 6
has comment: http://stackoverflow.com/comment/39667589
accepted answer of: http://stackoverflow.com/q/25426781
has body: In programming, reflection is the ability of a program to modify its own structure and behavior at runtime through analysis of runtime details, such as the actual implementing class of an object instance. The Class class is a part of the Java API for the purposes of reflection. Whereas the class keyword is a structure of the Java language marking the definition of a new class, the Class class is used to type variables and parameters as classes themselves. It's a way for the program to use class definitions themselves as objects to program around (you can programmatically enumerate over the class' public methods, for example). Additionally, any instance o of type Object (that is, any object in Java at all) inherits the getClass instance method. This yields the actual runtime class of the object, irrespective of the compile-time code-stated class of the variable the object is stored in. For example, for some defined class X: Object o = new X(); Class&lt;?&gt; type = o.getClass(); type will now be a reference to the X class itself, which matches the Class&lt;?&gt; generic description because the X class is in fact an instance of type Class&lt;X&gt;. Every defined class also has one static variable called class referring back to the class itself. Calling getClass on an instance of class X will return the same Class&lt;X&gt; instance as that class' class static variable: ("some string").getClass() == String.class It is worth noting that the primitive types all have a static class variable as well even though they are not Objects. It is also worth noting that a primitive type's class is not the same as the class of its wrapper class: int.class != Integer.class
upvote count: 6
type: Answer
answers question: http://stackoverflow.com/q/25426781
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39793347
has text: I can use Java8 features. I'll give it a try, the above example was after a dozen other attempt but I'd assigned the method reference to a variable before using it... and the type was not in agreement. I'll try what you recommend.
type: Comment
comment on: http://stackoverflow.com/a/25474006
score: 0
type: AnswerComment

http://stackoverflow.com/a/25483232
type: Answer
has comment: http://stackoverflow.com/comment/39890885
score: 0
has body: You are using css like selectors in JSOUP. the way you use it, it searches for an element tag called groups_list, which is of course not found. Instead you need to look for a table with id groups_list. This would do it I think: doc.select("table#groups_list") Put this in the outer loop and you should at least get the td elements printed out. Since in html documents, the id should be unique, you can do also: doc.select("#groups_list") or doc.select("table[id=groups_list]") finally, if you don't want to use the css select engine of JSOUP, you may use the JSOUP methods for directly accessing elements by id: doc.getElementById("groups_list");
answers question: http://stackoverflow.com/q/25483061
has comment: http://stackoverflow.com/comment/39843758
has comment: http://stackoverflow.com/comment/39771839
has comment: http://stackoverflow.com/comment/39844408
has comment: http://stackoverflow.com/comment/39891110
has comment: http://stackoverflow.com/comment/39772882
has comment: http://stackoverflow.com/comment/39771906
has comment: http://stackoverflow.com/comment/39771511
has comment: http://stackoverflow.com/comment/39771719
has comment: http://stackoverflow.com/comment/39772361
has comment: http://stackoverflow.com/comment/39772489

emulation
tags question: http://stackoverflow.com/q/25436156
tag name: emulation
type: Tag

http://stackoverflow.com/comment/39611429
has text: @MadProgrammer That was my bad, I don't know why I had two constructor ends. I think I must have forgotten to take one out when I edited my code.
comment on: http://stackoverflow.com/q/25396091
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39749994
score: 0
type: AnswerComment
has text: @Nabin:- Hope that helps! :)
comment on: http://stackoverflow.com/a/25471291
type: Comment

http://stackoverflow.com/comment/39739222
comment on: http://stackoverflow.com/q/25465542
type: QuestionComment
has text: It should be relative to the top level of the jar file, not an absolute pathname. Also, I am not sure you want ir need the "file:" prefix.
type: Comment
score: 0

nullpointerexception
tags question: http://stackoverflow.com/q/25526734
tags question: http://stackoverflow.com/q/25483014
tags question: http://stackoverflow.com/q/25447060
tags question: http://stackoverflow.com/q/25459014
tags question: http://stackoverflow.com/q/25456108
tags question: http://stackoverflow.com/q/25409963
tags question: http://stackoverflow.com/q/25405087
tags question: http://stackoverflow.com/q/25429930
tags question: http://stackoverflow.com/q/25456924
tags question: http://stackoverflow.com/q/25475306
tags question: http://stackoverflow.com/q/25392946
tags question: http://stackoverflow.com/q/25532169
tags question: http://stackoverflow.com/q/25441289
tags question: http://stackoverflow.com/q/25449313
tags question: http://stackoverflow.com/q/25434353
tags question: http://stackoverflow.com/q/25398945
type: Tag
tags question: http://stackoverflow.com/q/25480862
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/25468681
tags question: http://stackoverflow.com/q/25470536
tags question: http://stackoverflow.com/q/25483310
tags question: http://stackoverflow.com/q/25398651
tags question: http://stackoverflow.com/q/25502507
tags question: http://stackoverflow.com/q/25424493
tags question: http://stackoverflow.com/q/25449800
tags question: http://stackoverflow.com/q/25410591
tags question: http://stackoverflow.com/q/25524696
tags question: http://stackoverflow.com/q/25426778
tags question: http://stackoverflow.com/q/25518395

http://stackoverflow.com/a/25547819
has comment: http://stackoverflow.com/comment/39890757
score: 3
has body: Simply: // Create the list ArrayList&lt;String&gt; myList = new ArrayList&lt;String&gt;(); // Add some items to it myList.add("one"); myList.add("two"); myList.add("three"); // Reverse it by using Collections utilities. Collections.reverse(myList); Log.i("DEBUG", myList.get(0)); // Should print 'three'
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/25547722
has comment: http://stackoverflow.com/comment/39890818
downvote count: 0

http://stackoverflow.com/comment/39617082
comment on: http://stackoverflow.com/q/25400055
score: 1
type: QuestionComment
has text: convert to binary number from `000` to `111` do a loop.
type: Comment

http://stackoverflow.com/comment/39868227
score: 0
comment on: http://stackoverflow.com/q/25533928
has text: @JohnR - no unfortunately, they don't implement a common interface.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25449748
tagged with: maven-plugin
has title: Working with plugin ClassLoader and project ClassLoader
favorite count: 0
type: Question
answer count: 0
type: UnansweredQuestion
tagged with: maven
has body: So I am developing one maven plugin where I need to modify the classloaders in order to work correctly. The problem is that I am not sure that I am modifying the correct classloader. What I'm doing is the following: @Mojo(name = "aggregate", requiresDependencyResolution = ResolutionScope.TEST) public class AcceptanceTestMojo extends AbstractMojo { private static final String SYSTEM_CLASSLOADER_FIELD_NAME = "scl"; @Parameter private String property; @Component public PluginDescriptor pluginDescriptor; @Component public MavenProject mavenProject; @Override public void execute() throws MojoExecutionException, MojoFailureException { ClassLoader newClassLoader = null; List&lt;String&gt; runtimeClassPathElements; try { runtimeClassPathElements = mavenProject.getTestClasspathElements(); } catch (DependencyResolutionRequiredException e) { throw new MojoFailureException(MojoFailureMessages.UNRESOLVED_DEPENDENCIES_MESSAGE); } ClassRealm realm = pluginDescriptor.getClassRealm(); ClassRealm modifiedRealm= new ClassRealm( realm.getWorld(), realm.getId(), realm.getParentClassLoader()); try { for (String element : runtimeClassPathElements) { File elementFile = new File(element); modifiedRealm.addURL(elementFile.toURI().toURL()); } } catch (MalformedURLException e) { throw new MojoFailureException(MojoFailureMessages.UNRESOLVED_CLASSES_MESSAGE); } pluginDescriptor.setClassRealm(modifiedRealm); So I am getting the ClassRealm and I'am making slight changes to the UCP(removing some jars) and after that I set the newly created ClassRealm to the project descriptor. I am also changing the ContextClassLoader and the SystemClassLoader as the project I am executing my plugin on are using them for some interactions. These two are working fine- they are changed and the plugin is working fine with them. The problem is the plugin classloader. Because for some reason when executing my plugin on one project it is looking in the plugin ClassRealm and searching for the needed jars from there. But t…
downvote count: 0
score: 1
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/39704631
type: Comment
comment on: http://stackoverflow.com/a/25447133
type: AnswerComment
has text: +1: this is probably the shortest answer using standard API.
score: 1

http://stackoverflow.com/q/25392675
score: 0
has body: I'm using Google's Data APIs Java library to access contacts and when using the getContactPhotoLink() method I can only get low resolution (96x96) photos. Is there anyway I can get bigger resolution photos? On my Android phone the photos showing up are definitely not 96x96 pixels... Thanks
has answer: http://stackoverflow.com/a/25396288
tagged with: java
answer count: 1
type: Question
has title: Google contacts API returns low resolution photos
tagged with: gdata
tagged with: contacts
type: UnansweredQuestion
tagged with: google-contacts-api
tagged with: gdata-api

http://stackoverflow.com/a/25541389
answers question: http://stackoverflow.com/q/25540751
has body: Very simple example is this. String workingDir = System.getProperty("user.dir"); System.out.println("Current working directory : " + workingDir); File file = new File(workingDir+"/WebContent/Files/login.txt"); PrintWriter printWriter = new PrintWriter(new BufferedWriter(new FileWriter(file,true))); printWriter.println(workingDir); printWriter.println("Good thing"); printWriter.close(); hope it helps.
type: Answer
score: 0

http://stackoverflow.com/a/25547356
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25544377
upvote count: 1
type: Answer
has body: You don't specify how the table prodAtt should be joined with the table attrdef, so any filtering you try to achieve by joining another table is without effect. You have to tell your DB on which columns you wish to join the two tables, then you can add your WHERE-clause to filter the results. Looking at the tables, you should join them on the column attID: SELECT a.attID , a.attName FROM ATTRDEF a INNER JOIN PRODATT p ON a.ATTID = p.ATTID WHERE p.prodID IN (10, 11);
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25544377
has comment: http://stackoverflow.com/comment/39891411

http://stackoverflow.com/comment/39864972
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25533622
has text: The code you posted only asks once for each time the function is called. If you want to know why it's called more than once, you'll have to show how it's called.

http://stackoverflow.com/comment/63666844
type: QuestionComment
comment on: http://stackoverflow.com/q/25447590
type: Comment
has text: This solved the same problem occurring for me. http://stackoverflow.com/a/38113729/4955513
score: 0

http://stackoverflow.com/comment/39670438
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25426971
has text: Clustering algorithm: 1. Convert (latitude, longitude) to normalized (x,y,z), 2. Average all the (x,y,z), 3. Convert back to (latitude, longitude)

http://stackoverflow.com/comment/39632761
type: AnswerComment
score: 0
has text: Sorry, for late response, I was afk. Yes, if (<yearBirth is not null and not empty>) that's the way I would go too. However, now when I reminded on how to use null & isEmpty, I think I got an idea on how to to implement validation another way. Is it possible again with @NamedQuery ? It might be a long code. What do you think ?
comment on: http://stackoverflow.com/a/25407182
type: Comment

http://stackoverflow.com/a/25416215
has body: It appears that the best solution is to create a package in your project that has the same package as the package-private class and either expose TheProtectedClass.class as a Class&lt;?&gt; or simply add a simple method that checks if your Object is instanceof TheProtectedClass. This does not require reflection, it is fast and relatively safe (compilation will break if the package-private class changes name).
type: Answer
score: -1
answers question: http://stackoverflow.com/q/25407260
accepted answer of: http://stackoverflow.com/q/25407260
type: AcceptedAnswer
downvote count: 2
upvote count: 1

proxy
tags question: http://stackoverflow.com/q/25487092
tags question: http://stackoverflow.com/q/25445875
tags question: http://stackoverflow.com/q/25489113
tags question: http://stackoverflow.com/q/25445090
type: Tag
tag name: proxy
tags question: http://stackoverflow.com/q/25528965
tags question: http://stackoverflow.com/q/25414660

http://stackoverflow.com/comment/39847197
type: Comment
has text: @Gops this is just a very simple example. I might be wrong, but your code does not appear to be thread safe. I would like to see the entire code to provide a better solution. For example, you could avoid the final variables if you made a new class that implements Runnable where you could pass your variables in the constructor.
type: AnswerComment
comment on: http://stackoverflow.com/a/25509639
score: 1

http://stackoverflow.com/q/25506240
type: Question
has answer: http://stackoverflow.com/a/25506432
has comment: http://stackoverflow.com/comment/39814944
tagged with: java.util.scanner
duplicate of: http://stackoverflow.com/q/14962082
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8203981
upvote count: 1
has body: If I close one scanner object and make a new one and try to read some more input, I'm getting the NoSuchElementException exception. My code works fine but it gives me a warning if I don't close the scanner. However, if I close it to get rid of the warning, I also close System.in... How do I avoid this? Also, are there any consequences of not closing the scanner? EDIT: Here's my code: This is the NameAddressExists() method: public void NameAddressExists() { System.out.println("Enter name"); Scanner sc = new Scanner(System.in); String n = sc.next(); System.out.println("Enter address"); String a = sc.next(); int flag = 0; for(int i = 0; i &lt; count; i++) { if(array[i].name .equals(n) &amp;&amp; array[i].address .equals(a)) { System.out.println("True"); flag = 1; } } if(flag != 1) { new Agency(n, a); } sc.close(); } This is the PanNumberExists() method: public boolean PanNumberExists() { Scanner s = new Scanner(System.in); String n = ""; System.out.println("Enter the 5 digits"); try { n = s.nextLine(); }catch(Exception e) { System.out.println(e); }finally { s.close(); } if(n .equals(this.PAN.subSequence(4,9))) { return true; } else { return false; } } These methods are called from the following main() method: public static void main(String args[]) { Agency obj1 = new Agency("XYZ", "ABCD"); Agency obj2 = new Agency("XYZ", "ABCDEFG", "+91083226852521", "ab 1234567", "abcd12345ab"); // Agency obj3 = new Agency("XYZ", "TSRK", "36", "ab 1234567", "abcd12345ab"); obj1.NameAddressExists(); System.out.println(obj2.PanNumberExists()); } As you can see, I first call the NameAddressExists() method, in which I open, use and close a Scanner named 'sc'. This works fine and gives me the correct output. Next, I call the PanNumberExists() method, in which I open another Scanner named 's' and try to use it to get some input from the user. This is where I receive the NoSuchElementException exception. If I leave the Scanner 'sc' open in my NameAddressExists() method, then I don't get this…
has comment: http://stackoverflow.com/comment/39814832
has comment: http://stackoverflow.com/comment/39814922
tagged with: nosuchelementexception
score: 1
tagged with: java
answer count: 1
tagged with: system.in
downvote count: 0
has comment: http://stackoverflow.com/comment/39814836
linked to: http://stackoverflow.com/q/14962082
has title: How to close a scanner without closing the underlying System.in?
favorite count: 0

http://stackoverflow.com/comment/39672709
score: 0
type: QuestionComment
type: Comment
has text: @HotLicks: worth pointing out that reflection can also allow you to violate string immutability.
comment on: http://stackoverflow.com/q/25429815

http://stackoverflow.com/comment/39749565
has text: It's a simple CRUD. I've edited the question to include de code
score: 0
comment on: http://stackoverflow.com/q/25401435
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25454402
tagged with: java
tagged with: plugins
tagged with: jface
type: AnsweredQuestion
has body: I am currently working on a GUI for a database plugin feature using JFace (cannot use any other method due to threading issues), and am tasked with making the GUI look as similar to the database fields as possible. I need to place an asterisk inside of the text field as shown below: I'm attempting to use the FieldDecorator method to do this, but this places the asterisk outside of the text field. Is there any way to get it to draw inside of the text field instead?
score: 0
accepted answer: http://stackoverflow.com/a/25459559
tagged with: swt
answer count: 1
has answer: http://stackoverflow.com/a/25459559
has title: JFace: Place Field Decoration inside a field?
type: Question

http://stackoverflow.com/comment/39811975
comment on: http://stackoverflow.com/a/25499526
type: AnswerComment
has text: The entity will at least be written twice to an `OutputStream`. First at the `ByteArrayOutputStream` then at the original one. This is necessary because the original Stream does not provide a method to read it's content. I don't think there is a high impact but this depends on the size of your entities. I'd suggest to just log how long it takes.
score: 1
type: Comment

http://stackoverflow.com/comment/39783023
has text: @Kaly If that's the case, what the point of all those conditions that check if something is `instanceOf TreeItem`? You already know they are TreeItems.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25488921
type: AnswerComment

http://stackoverflow.com/q/25490546
has title: Tween Engine or Scene2d Actions?
downvote count: 0
score: 1
upvote count: 1
tagged with: scene2d
tagged with: java
answer count: 1
tagged with: tween
favorite count: 0
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/25492588
accepted answer: http://stackoverflow.com/a/25492588
tagged with: animation
has body: I'm currently getting used to using libGDX. I've been using Tween Engine for animations and such, but there is also an Actions class. My question is simple: Which one is better: Tween, or Scene2D Actions? With that, I'd also like it if someone could offer an explanation on their differences and flexibility. Could it also be a good idea to use both at the same time for specific needs?
type: AnsweredQuestion

http://stackoverflow.com/comment/39677817
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25430320
score: 0
has text: I think your question has an answer here: [How to generate an Eclipse formatter configuration from a checkstyle configuration?](http://stackoverflow.com/q/984778/1005481)

http://stackoverflow.com/comment/39830726
has text: I haven't loaded librxtxSerial.so yet. I have two libraries for RXTXComm. RXTXcomm and RXTXcomm-2.2pre2. I initially used RXTXcomm-2.2pre2 but was not successful when sending bytes to the device I'm working with. I wanted to try RXTXcomm instead. Linux offered several .so files when I used. see http://stackoverflow.com/questions/11380526/rxtx-on-ubuntu-12-04-netbeans. After I changed libraries, the .so file used didn't change. That lead me to my question.
comment on: http://stackoverflow.com/q/25514486
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/39875694
type: QuestionComment
comment on: http://stackoverflow.com/q/25539222
has text: It's a bug in base 2 floating point representation.
score: 0
type: Comment

http://stackoverflow.com/a/25914461
score: 11
has body: The reason why you have to do it in Play is a framework design choice, and it is a very good one. In Play, the mechanism relies on Scala implicits, which are a very powerful feature leveraged to make the mechanism highly pluggable , in the sense that at the moment you call: Json.toJson(Location(4.5, 5.3)) The compiler will look for an implicit in scope matching the required type. The Scala language specification describes the algorithm to resolve implicits, and such algorithm is designed in a way that you can "import" an implicit in a limited scope. Thanks to this feature, in different part of your program you can make visible a different implementation of your Reads / Writes or any typeclass . object MyImplicits { object ImplicitJson1{ implicit val write:Write[Location] = "write to json all fields" } object ImplicitJson2{ implicit val write:Write[Location] = "skip field a" } } object MyBusinessCode{ def f1(location:Location){ import MyImplicits.ImplicitJson1._ Json.toJson(location) } def f2(location:Location){ import MyImplicits.ImplicitJson2._ Json.toJson(location) } def dynamicChoice(location:Location){ implicit val write = { if(location.isEurope) MyImplicits.ImplicitJson1.write else MyImplicits.ImplicitJson2.write } Json.toJson(location) } } Instead, in Spring this is typically done through introspection and reflection. You might need to use annotations to help Spring determining how to build your Json from your data model. The consequence is that you cannot change the way it is done, and therefore you have less flexibility. Since you might not need more flexibility, many Scala libraries/framework provides you functions to generate default implementation of the typeclass you need. That extra line of code implicit val fmt = Json.format[Location] is the price that you have to pay because Play json serialization relies on implicit.
upvote count: 11
has comment: http://stackoverflow.com/comment/40748182
has comment: http://stackoverflow.com/comment/40749019
answers question: http://stackoverflow.com/q/25432588
has comment: http://stackoverflow.com/comment/40779424
has comment: http://stackoverflow.com/comment/40751559
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25432588
has comment: http://stackoverflow.com/comment/40781269
type: Answer

http://stackoverflow.com/comment/39866674
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25534100
has text: I would use just one JFrame and either have the entry fields for all the data present on the one GUI view (one JPanel), or use CardLayout to swap JPanel views after each section of data entry has been complete. This is a lot less jarring than throwing bunches of windows at the user.
score: 0

http://stackoverflow.com/q/25403262
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/25403473
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/39622814
has body: I am getting out of memory error while reading large CSV file in java. How can I deal with this problem. I increased the heap size, I also tried using BufferedReader, but still the same problem persist. Here is my code public class CsvParser { public static void main(String[] args) { try { FileReader fr = new FileReader((args.length &gt; 0) ? args[0] : "data.csv"); Map&lt;String, List&lt;String&gt;&gt; values = parseCsv(fr, " ", true); System.out.println(values); } catch (IOException e) { e.printStackTrace(); } } public static Map&lt;String, List&lt;String&gt;&gt; parseCsv(Reader reader, String separator, boolean hasHeader) throws IOException { Map&lt;String, List&lt;String&gt;&gt; values = new LinkedHashMap&lt;String, List&lt;String&gt;&gt;(); List&lt;String&gt; columnNames = new LinkedList&lt;String&gt;(); BufferedReader br = null; br = new BufferedReader(reader); String line; int numLines = 0; while ((line = br.readLine()) != null) { if (StringUtils.isNotBlank(line)) { if (!line.startsWith("#")) { String[] tokens = line.split(separator); if (tokens != null) { for (int i = 0; i &lt; tokens.length; ++i) { if (numLines == 0) { columnNames.add(hasHeader ? tokens[i] : ("row_" + i)); } else { List&lt;String&gt; column = values.get(columnNames.get(i)); if (column == null) { column = new LinkedList&lt;String&gt;(); } column.add(tokens[i]); values.put(columnNames.get(i), column); } } } ++numLines; } } } return values; } }
has comment: http://stackoverflow.com/comment/39622684
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25404800
has comment: http://stackoverflow.com/comment/39622904
has comment: http://stackoverflow.com/comment/39623940
has title: Out of memory error, while reading large CSV file (millions of lines) in java
type: UnansweredQuestion
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/25405260
answer count: 6
has answer: http://stackoverflow.com/a/25405079
has answer: http://stackoverflow.com/a/26953407
has comment: http://stackoverflow.com/comment/39623229
has answer: http://stackoverflow.com/a/25403923

http://stackoverflow.com/comment/107450390
comment on: http://stackoverflow.com/a/36943851
score: 0
type: Comment
has text: What about the performance cost of calling remove after every once of these requests?
type: AnswerComment

http://stackoverflow.com/a/31542678
score: 0
has body: this post is little old but I wanna share that I found just and I guess it is related to this post, there is no config combination exists between Jdk 1.6 + Eclipse luna + Oracle Service pack(12c) for Eclipse! You will have to upgrade or downgrade at least one of them...
type: Answer
answers question: http://stackoverflow.com/q/25519781

csvjdbc
tags question: http://stackoverflow.com/q/25423265
type: Tag
tag name: csvjdbc

http://stackoverflow.com/a/25516372
has comment: http://stackoverflow.com/comment/39836955
type: Answer
has comment: http://stackoverflow.com/comment/39914043
has comment: http://stackoverflow.com/comment/40165483
upvote count: 0
answers question: http://stackoverflow.com/q/25513711
has body: Use MiGLayout. That's the only layout I ever use these days. IMHO, it supersedes everything else that it's out there and is very intuitive and self-documenting.
downvote count: 2
has comment: http://stackoverflow.com/comment/39913186
score: -2

http://stackoverflow.com/comment/39841525
comment on: http://stackoverflow.com/a/25519923
has text: you can use xpath but read about the different xpath vs css it is recommended
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25547247
has comment: http://stackoverflow.com/comment/39921103
type: Answer
has comment: http://stackoverflow.com/comment/39920850
accepted answer of: http://stackoverflow.com/q/25546879
score: 0
has body: you can sublcass the button, and do you custom draw on there?! import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.widget.Button; public class CustomDraw extends Button { public CustomDraw(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomDraw(Context context, AttributeSet attrs) { super(context, attrs); } public CustomDraw(Context context) { super(context); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); //your custom draw here } } you must set that button in your layout then, as well... &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="de.trialar.linedrawer.MainActivity" &gt; &lt;com.example.yourpackage.CustomDraw android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="180dp" android:text="Button" /&gt;
answers question: http://stackoverflow.com/q/25546879
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39890549
has comment: http://stackoverflow.com/comment/39920901
has comment: http://stackoverflow.com/comment/39890611
has comment: http://stackoverflow.com/comment/39891051

http://stackoverflow.com/comment/39684590
comment on: http://stackoverflow.com/a/25421753
score: 0
has text: This doesn't answer the question being asked.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39733523
comment on: http://stackoverflow.com/q/25462493
has text: Do you have to write your own method or can you use build in solution? Also can we see your attempts to solve this problem?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25460818
tagged with: java
has title: Parse href out of html document and evaluating by xpath returns null pointer exception
has answer: http://stackoverflow.com/a/25460947
type: Question
has answer: http://stackoverflow.com/a/25460887
accepted answer: http://stackoverflow.com/a/25460947
tagged with: http://stackoverflow.com/tag/html
tagged with: parsing
possible better answer: http://stackoverflow.com/a/25460887
tagged with: xpath
type: AnsweredQuestion
score: 0
answer count: 2
has body: I am going to parse URLs in specific location of one website. For this purpose I wrote a simple program in Java. But this program returns null pointer exception. It seems that getNameItem("href") returns null. I am suspicious about wrong way of using getNameItem to extract URLs inside "href" tag. DocumentBuilder b = DocumentBuilderFactory.newInstance().newDocumentBuilder(); org.w3c.dom.Document doc = b.parse(new FileInputStream("clean.html")); //Evaluate XPath against Document itself javax.xml.xpath.XPath xPath = XPathFactory.newInstance().newXPath(); NodeList nodes = (NodeList)xPath.evaluate(".//*[@class='r_news_box']", doc.getDocumentElement(), XPathConstants.NODESET); for (int i = 0; i &lt; nodes.getLength(); ++i) { Element e = (Element) nodes.item(i); System.out.println(e.getAttributes().getNamedItem("href").getTextContent()); } P.S: here is one of the nodes that should be selected by this xpath: &lt;div class="r_news_box"&gt; &lt;a class="picLink" target="_blank" href="/fa/news/427583/test"&gt; &lt;img class="r_news_img" width="50" height="65" src="/files/fa/news/1393/5/29/411217_553.jpg" alt="test"/&gt; &lt;/a&gt;

http://stackoverflow.com/comment/39846500
type: QuestionComment
has text: Sounds like yet another type inference bug. Be sure to include detailed information on the *compiler* you get this error from since Eclipse uses its own.
score: 6
comment on: http://stackoverflow.com/q/25523375
type: Comment

http://stackoverflow.com/q/25476826
has title: Generic Number Tweening (Help me do one strange trick..)
has body: I am trying to make as generic as possible method for tweening between various types of values. So, given a start and end value thats, say, either an Int,Float or Double as well as the number of steps (int), it will return values evenly distributed along those steps in the same type. However, I am starting to suspect; a) My knowledge of generics is terrible. b) This might not be possible :( So, just to be clear, one example; SpiffyTween&lt;Double&gt; meep = new SpiffyTween&lt;Double&gt;(1d,10d, 100); while (meep.hasNext()){ Log.info("value="+meep.next()); } Would return 0.0,0.1,0.2..etc upto 9.9 But SpiffyTween could also work with other number types without needing separate code for each. Heres the code I have right now; class SpiffyTween&lt;T extends Number&gt; implements SpiffyGenericTween&lt;T&gt; { static Logger Log = Logger.getLogger("SpiffyTween &lt;Number&gt;"); private T start; private T end; int totalsteps=0; int CurrentStep = 0; ArrayList&lt;T&gt; steps = new ArrayList&lt;T&gt;(); public SpiffyTween(T start,T end, int steps) { this.start = start; this.end = end; this.totalsteps = steps; precalculate(); } private void precalculate() { //calc step difference double dif = ((end.doubleValue() -start.doubleValue())/totalsteps); Log.info("dif="+dif); int i=0; while(i&lt;totalsteps){ T stepvalue = (T)((Number)(start.doubleValue() +(dif*i))); steps.add(stepvalue); Log.info("add step="+stepvalue); i++; } } public T next(){ T currentVal = steps.get(CurrentStep); CurrentStep++; return currentVal; } @Override public boolean hasNext() { if (CurrentStep&lt;totalsteps){ return true; } return false; } } This works...ish. While the numbers come out aproximately right occasionally theres values like; 9.600000000000001 or 2.4000000000000004 I am assuming thats to do with the unchecked type conversion here; T stepvalue = (T)((Number)(start.doubleValue() +(dif*i))); But I cant work out how to do it better. Whatever the solution (if theres one), my longterm plan is to try to m…
accepted answer: http://stackoverflow.com/a/25477051
has comment: http://stackoverflow.com/comment/39760443
has comment: http://stackoverflow.com/comment/39760235
type: AnsweredQuestion
score: 0
tagged with: numbers
tagged with: java
answer count: 1
tagged with: generics
tagged with: tween
has comment: http://stackoverflow.com/comment/39761670
has answer: http://stackoverflow.com/a/25477051
type: Question

call
tags question: http://stackoverflow.com/q/25406674
tag name: call
type: Tag

http://stackoverflow.com/comment/39885515
comment on: http://stackoverflow.com/q/25544107
score: 0
type: QuestionComment
type: Comment
has text: and to answer your second question, usually it's Q&A, you answer one question and get one answer :) and to be honest i'm not sure if the snippet above covers other relevant details about your application, it might help letting us now how you are loading the properties etc. are you using any 3rd party libraries? or is it plain Java?

http://stackoverflow.com/comment/39639005
score: 0
comment on: http://stackoverflow.com/q/25411373
has text: In addition to reading the answers on http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java, consider input validation for your program, like ending your else-if chain with `else { System.err.println("Invalid operator"); return -1; }`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/43910948
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/82813616
score: 2
downvote count: 2
answers question: http://stackoverflow.com/q/25451806
has body: To actually answer the question: to reduce dependencies. If there would be no distinction between e.g. SOURCE and RUNTIME, the "user" of the classes would have to provide all the dependencies the annotations come from. So only because that annotation is used by the IDE (SOURCE), the jar would have to be provided during runtime - which is unnecessary. If you try to get annotations from a class, where no jar is provided that actually provides the annotation, you will get a class not found exception.

http://stackoverflow.com/q/25501039
has title: I want my JLayeredPane to catch all events
has comment: http://stackoverflow.com/comment/39806120
has comment: http://stackoverflow.com/comment/39814207
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39811679
has comment: http://stackoverflow.com/comment/39811719
tagged with: java
linked to: http://stackoverflow.com/q/8715807
has comment: http://stackoverflow.com/comment/39807217
has comment: http://stackoverflow.com/comment/39808964
score: 2
has comment: http://stackoverflow.com/comment/39808793
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39813011
has comment: http://stackoverflow.com/comment/39813150
has answer: http://stackoverflow.com/a/25506042
accepted answer: http://stackoverflow.com/a/25506042
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/39811597
has body: I have a JFrame and I want to set it disabled on some loading processes. For that purpose I've created the DisablingLayeredPane class: public class DisablingLayeredPane extends JPanel { @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f)); g2d.setColor(Color.BLACK); // With 0.2f alpha it looks like light gray g2d.fillRect(0, 0, getWidth(), getHeight()); g2d.dispose(); } } On the loading process start, I call frame.getLayeredPane().add(darkeningPane, JLayeredPane.MODAL_LAYER); But the problem is, this darkening pane does not catch any events, I still can press buttons on my frame. I've also tried AWTEventListener to consume all of events for this frame, but there is another issue: sometimes I need to show modal dialog for some confirmation, and events for modal dialog are consumed too (I can't press any button). Of course, I can use some tricks like using transparent window above my frame instead darkening pane, or use a lot of if-else statements at AWTEventListener, but I'm looking for a some beautiful solution, if any. Thanks in advance. UPD: I've also tried to add Mouse and Key Listeners to layered panel, but there is a new issue: if use JDialog instead JFrame, the KeyListener of layered panel would not catch ESC key pressing and dialog would dispose. UPD2: I've tried frame.setGlassPane(darkeningPane) instead setting as layer, but there is no effect.
has comment: http://stackoverflow.com/comment/39813227
linked to: http://stackoverflow.com/q/25504664
tagged with: swing
has comment: http://stackoverflow.com/comment/39809633

http://stackoverflow.com/q/25535969
tagged with: performance
tagged with: java
answer count: 1
tagged with: load-time-weaving
type: Question
tagged with: jpa
has body: I am unable to find any benchmark or large scale test that shows the performance gain of static weaving versus dynamic weaving. Does somebody has any experience with this ?
accepted answer: http://stackoverflow.com/a/25538170
has answer: http://stackoverflow.com/a/25538170
tagged with: compile-time-weaving
has title: JPA - Performance impact of weaving
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/25482151
has comment: http://stackoverflow.com/comment/100263929
downvote count: 0
score: 7
tagged with: android
upvote count: 7
tagged with: java
has title: IllegalMonitorStateException while unlocking ReentrantLock on Android
has comment: http://stackoverflow.com/comment/100263913
has comment: http://stackoverflow.com/comment/100263999
tagged with: reentrantlock
tagged with: synchronization
favorite count: 0
type: Question
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/100240536
has body: I'm using ReentrantLock with its recommended practise (lock, then actual code in try-block, then unlock in finally, see code example below). Sometimes (very very rare) I'm having java.lang.IllegalMonitorStateException exception during unlock. Why it happens? Maybe its somehow related to Android's implementation of Java VM. Error: java.lang.IllegalMonitorStateException java.lang.IllegalMonitorStateException at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(ReentrantLock.java:126) at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1232) at java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:430) at com.example.dummy.backend.model.Model.unlock(Model.java:283) at com.example.dummy.backend.engine.Engine.removeOldInstances(Engine.java:712) at com.example.dummy.backend.engine.Engine$ProcessOnResumeWorkInBackground.doInBackground(Engine.java:836) at com.example.dummy.backend.engine.Engine$ProcessOnResumeWorkInBackground.doInBackground(Engine.java:790) at android.os.AsyncTask$2.call(AsyncTask.java:185) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) at java.lang.Thread.run(Thread.java:1019) Code example (slightly simplified): myLock.lock(); try { LinkedList&lt;MyClass&gt; myClassInstances = model.getMyClassInstances(); Iterator&lt;MyClass&gt; iterator = myClassInstances.iterator(); while (iterator.hasNext()) { MyClass myClassInstance = iterator.next(); boolean toBeRemoved = true; // simple condition here if (toBeRemoved) { logger.info("Removing old myClassInstance " + myClassInstance.getTimestamp()); iterator.remove(); Cache.removeMyClassByCodeAndTimestamp(myClassInstance); } } } finally { myLock.unlock(); }
has comment: http://stackoverflow.com/comment/100252024

http://stackoverflow.com/a/25403098
type: Answer
accepted answer of: http://stackoverflow.com/q/25402654
has comment: http://stackoverflow.com/comment/39693151
score: 0
type: AcceptedAnswer
has body: I would say that if you are going to do unit testing of you own functionality it won't really matter if Android supports it or not, you just run the unit tests regardless of the Android SDK. However if you intent to use jUnit to work alongside Android, there is no way at the moment to do it that I'm aware of.
has comment: http://stackoverflow.com/comment/39699811
answers question: http://stackoverflow.com/q/25402654
has comment: http://stackoverflow.com/comment/39805433

http://stackoverflow.com/q/25410788
score: 1
tagged with: java
downvote count: 0
answer count: 1
has title: Using methods in fragments
upvote count: 1
has comment: http://stackoverflow.com/comment/39637715
favorite count: 0
accepted answer: http://stackoverflow.com/a/25411025
type: Question
has answer: http://stackoverflow.com/a/25411025
tagged with: android
has body: Having a hard time with fragments. I have a MainActivity that switches to a fragment with a flip-card animation pushing a button. fragment.xml: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;Button android:id="@+id/coin2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:text="@string/coin_button" android:onClick="flipcoin2" /&gt; &lt;/LinearLayout&gt; fragment class: public class CardBackFragment extends Fragment { public CardBackFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_coindice, container, false); } public void flipcoin2(View view){ //no code } } The CardBackFragment class is actually in the MainActivity.java file, not a separate file. The app starts, the flipcard animation works, I see the button in the fragment, I can switch back to the main Activity. But when I click on the coin2 button the app crashes with following exception java.lang.IllegalStateException: Could not find a method flipcoin2(View) in the activity class com.example.myapp.MainActivity for OnClick handler on view class android.widget.Button with id 'coin2' I put intentionally no code in the method to see if there was something wrong into the method, but it's not the case. What's wrong?
linked to: http://stackoverflow.com/q/6091194
type: AnsweredQuestion
tagged with: android-fragments

http://stackoverflow.com/a/25593289
downvote count: 0
has comment: http://stackoverflow.com/comment/40083456
has comment: http://stackoverflow.com/comment/40092675
has comment: http://stackoverflow.com/comment/40084101
type: Answer
has comment: http://stackoverflow.com/comment/40091304
answers question: http://stackoverflow.com/q/25415037
score: 3
upvote count: 3
has body: Use two TreeSets. Each set takes their respected comparator, and the add() method adds the provided value to each set. poll1() would acquire the first() value in the first set, and remove the value from both sets. Similarly for poll2(). add(), poll1() and poll2() will have &Omicron;(log n). An example implementation follows (the real thing probably needs more error checking and additional methods): class Priority2Queue &lt;E&gt; { private TreeSet&lt;E&gt; q1; private TreeSet&lt;E&gt; q2; public Priority2Queue (Comparator&lt;E&gt; c1, Comparator&lt;E&gt; c2) { q1 = new TreeSet&lt;E&gt;(c1); q2 = new TreeSet&lt;E&gt;(c2); } public void add (E e) { q1.add(e); q2.add(e); } private E pollx (TreeSet&lt;E&gt; a, TreeSet&lt;E&gt; b) { E top = a.first(); a.remove(top); b.remove(top); return top; } public E poll1 () { return pollx(q1, q2); } public E poll2 () { return pollx(q2, q1); } }

http://stackoverflow.com/comment/39674899
type: AnswerComment
has text: @JanZyka, I did what you suggested and it broke just as you described. I even replaced the application.properties file and added a spring.config.name=myotherproperties. The other properties file sets the server port, so I knew it was being picked up. But as soon as I move spring.profiles and spring.profiles.active into the other properties file, it quits working.
comment on: http://stackoverflow.com/a/25428644
type: Comment
score: 0

http://stackoverflow.com/comment/39783737
has text: @MathiasMüller OP wants to transform `<Daily>` into ` Daily `. He needs to detect the current node name, and use it in an `<xsl:element>` tag.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25487390

http://stackoverflow.com/comment/39762058
comment on: http://stackoverflow.com/a/25477884
has text: oops that's right. let me update!
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39683594
type: Comment
comment on: http://stackoverflow.com/a/25434921
score: 0
has text: No thats fine, i have the same parameter for all my other methods and they work. It only doesn't work for my upload function :(
type: AnswerComment

http://stackoverflow.com/comment/39740242
has text: If you mean from "MainActivity"? so yes
comment on: http://stackoverflow.com/q/25466085
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/25472726
has comment: http://stackoverflow.com/comment/39752573
downvote count: 0
has comment: http://stackoverflow.com/comment/39752652
has body: Do not print statements like this: System.out.println("Enter the number of test cases"); Solutions are checked automatically and any extra output will be treated as wrong answer. Your program doesn't work for input separated by spaces. Try using Scanner to read input. For example: Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int i = 1; i &lt;= T; i++) { int m = in.nextInt(); int n = in.nextInt(); ...
upvote count: 2
has comment: http://stackoverflow.com/comment/39762584
type: Answer
answers question: http://stackoverflow.com/q/25472625
has comment: http://stackoverflow.com/comment/39764814
has comment: http://stackoverflow.com/comment/39752682
has comment: http://stackoverflow.com/comment/39762762
score: 2

http://stackoverflow.com/a/25420264
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25420227
has body: this is reserved java keyword which points current instance, you can not use this as variable, so this = this.next; is syntactical error.
type: Answer

http://stackoverflow.com/comment/39837974
type: Comment
comment on: http://stackoverflow.com/a/25518441
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60049/discussion-between-rod-algonquin-and-9-dollars-99-cents).
score: 0
type: AnswerComment

http://stackoverflow.com/a/25449823
type: Answer
has body: Using for loops to remove elements is really not recommended. Consider having two consecutive strings, both of which contain "yago". It will remove the first one, increment i and skip the second string (since it now has the index of the first string). Try a while loop where you increment only if you don't remove the element (or, if you hate branching, reverse the for loop from greater to smaller). As for your first example, right now it removes all those that do contain "yago". If you put a ! before the condition it should work properly.
score: 0
answers question: http://stackoverflow.com/q/25449543

http://stackoverflow.com/q/25512559
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25512704
tagged with: java
has answer: http://stackoverflow.com/a/25512704
has body: Add a second Toast notification that combines these two lines into one line (make sure you leave the first two lines intact!). For this second Toast, chain the show() method to the makeText() method, and use whatever String message you want. What's wrong with this? Toast allDoneToast = Toast.makeText(this, "All done!", Toast.LENGTH_LONG); allDoneToast.show();
type: Question
has answer: http://stackoverflow.com/a/25512637
tagged with: android
has title: Chainging methods
possible better answer: http://stackoverflow.com/a/25512637
type: AnsweredQuestion

http://stackoverflow.com/q/25440651
downvote count: 0
tagged with: java
has body: I want to use sonarqube plugin in eclipse. I've linked it with sonar server and it seems to be ok. The problem occurs during analysis. Output says that Access to the secured property 'sonar.scm.user.secured' is not possible in preview mode. The SonarQube plugin which requires this property must be deactivated in preview mode.. I tried to set property sonar.scm.user.secured to values false, disabled, hudson via Window-&gt;Preferences-&gt;SonarQube-&gt;Preview Analysis Properties but to be honest I don't know what kind of value should I set. This is the whole output returned by sonar in eclipse: Retrieve remote issues of project proj-gui... Start SonarQube analysis on proj-gui... INFO: SonarQube Server 4.2 08:07:02.474 INFO - Incremental mode 08:07:02.476 INFO - Load batch settings 08:07:02.802 INFO - User cache: C:\Users\user\.sonar\cache 08:07:02.810 INFO - Install plugins 08:07:02.875 INFO - Exclude plugins: devcockpit, jira, pdfreport, views, report, buildstability, scmactivity, buildbreaker 08:07:05.422 INFO - Create JDBC datasource for jdbc:h2:C:\Users\user\proj-workspace-kepler-git2\.metadata\.plugins\org.eclipse.core.resources\.projects\proj-gui\org.sonar.ide.eclipse.core\.sonartmp\preview1408687623081-0 08:07:06.669 INFO - Initializing Hibernate 08:07:08.174 INFO - Load project settings 08:07:08.330 INFO - Apply project exclusions 08:07:08.487 INFO - ------------- Scan proj-gui 08:07:08.489 INFO - Load module settings 08:07:09.164 INFO - Language is forced to java 08:07:09.172 INFO - Loading technical debt model... 08:07:09.422 INFO - Loading technical debt model done: 251 ms 08:07:09.430 INFO - Configure Maven plugins 08:07:09.650 INFO - Compare to previous analysis (2014-08-22) 08:07:09.660 INFO - Compare over 30 days (2014-07-23, analysis of 2014-08-04 09:08:17.0) 08:07:09.669 INFO - Compare to previous version (2014-08-22) 08:07:09.780 INFO - Base dir: C:\project\proj-gui 08:07:09.780 INFO - Working dir: C:\Users\user\proj-workspace-kepler-git2\.metadata\…
answer count: 1
favorite count: 0
type: Question
score: 3
has answer: http://stackoverflow.com/a/27366051
accepted answer: http://stackoverflow.com/a/27366051
tagged with: sonarqube
type: AnsweredQuestion
upvote count: 3
has title: Unable to run sonarqube plugin in eclipse

http://stackoverflow.com/comment/39630366
comment on: http://stackoverflow.com/a/25406487
score: 0
type: AnswerComment
has text: Post your xml as well as your code for the ImageButton please
type: Comment

http://stackoverflow.com/q/25524628
downvote count: 0
has comment: http://stackoverflow.com/comment/39848879
tagged with: jsp
has comment: http://stackoverflow.com/comment/39848785
upvote count: 1
favorite count: 0
tagged with: security
has comment: http://stackoverflow.com/comment/39848857
has body: In our application we are getting Poor Error Handling: Unhandled Exception I dont want to display the sqlException error codes with the error message. Attack Response: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: text/html;charset=UTF-8 Date: Tue, 24 Jun 2014 14:21:13 GMT Content-Length: 39032 ...TRUNCATED...ation. &lt;br&gt; &lt;br&gt; Exception Message: 20315 - **ORA-20315**: sa_check.save_customer: Unable to save order customer information.ORA-01403: no data found ORA-06512: at "OA.SA_CHECK", line 968 ORA-06512: at line 1 &lt;br&gt; &lt;br&gt; Error: &amp;nb...TRUNCATED... Please help how i can handle it . ORA-20315 ORA-06512 These types of Error number should not be displayed. Thanks.
tagged with: oracle-database
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39857395
has comment: http://stackoverflow.com/comment/39850279
answer count: 0
has title: Poor Error Handling: Unhandled Exception vulnerablity
type: UnansweredQuestion

http
tags question: http://stackoverflow.com/q/25445654
tags question: http://stackoverflow.com/q/25522139
tags question: http://stackoverflow.com/q/25448734
tags question: http://stackoverflow.com/q/25465487
tags question: http://stackoverflow.com/q/25492863
tags question: http://stackoverflow.com/q/25483610
tags question: http://stackoverflow.com/q/25397722
type: Tag
tags question: http://stackoverflow.com/q/25492071
tags question: http://stackoverflow.com/q/25480229
tags question: http://stackoverflow.com/q/25390203
tags question: http://stackoverflow.com/q/25517824
tags question: http://stackoverflow.com/q/25547711
tags question: http://stackoverflow.com/q/25491428
tags question: http://stackoverflow.com/q/25516285
tags question: http://stackoverflow.com/q/25465370
tags question: http://stackoverflow.com/q/25425551
tags question: http://stackoverflow.com/q/25426676
tags question: http://stackoverflow.com/q/25529012
tags question: http://stackoverflow.com/q/25540646
tag name: http
tags question: http://stackoverflow.com/q/25402726
tags question: http://stackoverflow.com/q/25525477
tags question: http://stackoverflow.com/q/25511592
tags question: http://stackoverflow.com/q/25495773

http://stackoverflow.com/q/25451671
type: AnsweredQuestion
score: 0
has title: Using Baas Parse for Android application but duplicate Table User
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39743822
answer count: 1
type: Question
tagged with: parse-platform
has answer: http://stackoverflow.com/a/25455528
accepted answer: http://stackoverflow.com/a/25455528
has body: I 'm trying to use the Baas Parse for my Android application. I've followed the quickstart guide with success, so i'have successfully registered a TestObject into my Parse database. Now, I try to adapt Parse to my needs and to register a User into Parse database with that code: Parse.initialize(this, "NkThBbZ4gcXQf3s59UGTozpCjKQbECVP5SmuXCkY", "n7a65t3o8fZNAXTOygWIg2L9Kui316yepfgoSdhf"); ParseObject userParse = new ParseObject("User"); userParse.put("username", user.getPseudonyme()); userParse.put("password", user.getPassword()); userParse.saveInBackground(); But it doesn't insert my user into the User table, instead it creates a new table and insert my User in that new User table. The first User table is a default table created by parse as far as i understand but i don't understand why is it impossible to use it. The result is that i have 2 Users tables. Thank you very much for your answers if anyone had the same problem. Sebastien
has comment: http://stackoverflow.com/comment/39714420

http://stackoverflow.com/comment/39633275
has text: Refrain from asking questions when you've not attempted to solve it yourself. The community here seems to get aggravated with questions that look like homework.
type: QuestionComment
comment on: http://stackoverflow.com/q/25408290
score: 0
type: Comment

http://stackoverflow.com/q/25416909
has answer: http://stackoverflow.com/a/25417023
accepted answer: http://stackoverflow.com/a/25417023
downvote count: 0
has comment: http://stackoverflow.com/comment/39649170
upvote count: 1
has comment: http://stackoverflow.com/comment/39649220
tagged with: php
favorite count: 0
type: Question
has title: uploading file to server saves file with invalid characters
type: AnsweredQuestion
has body: I am uploading a file to a php server from my java application and it uploads everything fine but I have noticed if it has a character such as ' in it then the in the file it will be \' not ' for example if I upload the file with the following code in java: public static void main(String[] args) { FILE tmpFile = new FILE(EncryptionUtil.EncryptAndZip("tes't file.txt").getAbsoluteFile().toString()); postData ( UPLOAD_URL + "?filename=" + URLEncoder.encode(file.getFileName() + ".zip", "utf-8"), tmpFile.getFileName() + ".zip", tmpFile.getFileLoader().readAllBytes() // FILE.getFileLoader().readAllBytes() is just a wrapper and reads all bytes from a file to byte[] ); } private static final String CrLf = "\r\n"; public static void postData(String url, String filename, byte[] byteData) throws IOException { URLConnection conn = null; InputStream is = null; OutputStream os = null; try { URL obj = new URL(url); System.out.println("url:" + obj); conn = obj.openConnection(); conn.setDoOutput(true); String message1 = ""; message1 += "-----------------------------4664151417711" + CrLf; message1 += "Content-Disposition: form-data; name=\"uploadedfile\"; filename=\"" + filename + "\"" + CrLf; message1 += "Content-Type: application/octet-stream" + CrLf; message1 += CrLf; String message2 = ""; message2 += CrLf + "-----------------------------4664151417711--" + CrLf; conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=---------------------------4664151417711"); conn.setRequestProperty("Content-Length", String.valueOf((message1 .length() + message2.length() + byteData.length))); os = conn.getOutputStream(); os.write(message1.getBytes()); int index = 0; int size = 1024; do { if ((index + size) &gt; byteData.length) { size = byteData.length - index; } os.write(byteData, index, size); index += size; } while (index &lt; byteData.length); os.write(message2.getBytes()); os.flush(); is = conn.getInputStream(); char buff = 512; int len; byte[] data = new byte[buff]; do { len …
tagged with: java
has comment: http://stackoverflow.com/comment/39649077
has comment: http://stackoverflow.com/comment/39649196
tagged with: file-upload
has comment: http://stackoverflow.com/comment/39649275
answer count: 2
has answer: http://stackoverflow.com/a/25417059
possible better answer: http://stackoverflow.com/a/25417059
score: 1

http://stackoverflow.com/q/25417666
score: 3
tagged with: guava
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25418475
tagged with: unit-testing
has title: Writing test case for Loading Cache guava
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: multithreading
has body: I am trying to test the asynchronous loading of cache over my database. I am using Google guava loading cache, which in turn uses Cache loader refreshing the given key asynchronously (as explained in https://code.google.com/p/guava-libraries/wiki/CachesExplained) I was trying the following steps to test The refresh duration : 1sec Make a call to cache, key is absent. Call to the mock DB is made Thread.sleep(2000L) Make another call for same key. Since the key is present and refresh period is over, the stale value should be returned and async refresh should be kicked off Thread.sleep(2000L) Make another call for the same key. Since I am mocking the dao, I expect it to be called atleast twice. However, when I am trying to verify the mock, it fails saying that mock was just called once. How do I ensure the dao is called twice? I am mocking the Thread Factory, while creating Executor which is being called for creating a new thread, as expected. Why is the second call to dao never made? Am I missing anything here? I am using new FixedThread Pool executor and decorating it as listening decorator. What is the right way to test such refreshing caches? Any help is much appreciated.
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/93926573
tagged with: spring

http://stackoverflow.com/comment/39730639
type: QuestionComment
comment on: http://stackoverflow.com/q/25460886
score: 0
has text: Can you put some code snippets showing what you have achieved so far? Thanks
type: Comment

http://stackoverflow.com/q/25405373
has comment: http://stackoverflow.com/comment/39637031
tagged with: spring-el
accepted answer: http://stackoverflow.com/a/25411391
has title: Spring security 3.2 - @PostAuthorize expressions to evaluate principal against the method's returned object
tagged with: java
tagged with: spring
has answer: http://stackoverflow.com/a/64601619
upvote count: 2
type: AnsweredQuestion
tagged with: spring-4
answer count: 2
has answer: http://stackoverflow.com/a/25411391
score: 1
has comment: http://stackoverflow.com/comment/77636210
downvote count: 1
has comment: http://stackoverflow.com/comment/39638246
possible better answer: http://stackoverflow.com/a/64601619
tagged with: spring-security
favorite count: 0
type: Question
has body: I use spring security to secure and evaluate expression in @PostAuthorize and @PreAuthorize annotations to authorize the service methods. I have a requirement that need to check if the returned object has the same userid who has logged in the system and is invoking this method. // this allows the ids of other users too @PostAuthorize("#returnObject!=null?returnObject.userId==principal.account.acid:true") public AudioClip findAudioClip(int clipId) { ..... AudioClip clip = dao.findById(clipId); // may also be null return clip; } AudioClip.java @Component public class AudioClip implements java.io.Serializable { private java.math.BigDecimal id; private java.lang.Integer userId; ..... } The fetched object from the database contains the userId who created this db object. So, only he is eligible to access that component. How to compare the returnObject.userId with the userid who has logged-in to the system?

http://stackoverflow.com/a/25500657
answers question: http://stackoverflow.com/q/25500489
downvote count: 0
has body: StringTokenizer has a constructor which takes 3 arguments which the third is a boolean that controls if the delimiters are to be returned as tokens or not. You should set it to true. new StringTokenizer(yourString, yourDelimiters, true); Now the delimiters are returned too, and it is easy to tell if an empty string exists by checking if two consecutive tokens are of delimiters. You can extend the tokenizer or write a wrapper class of your own for reuse purposes.
upvote count: 3
score: 3
type: Answer

http://stackoverflow.com/comment/39847755
comment on: http://stackoverflow.com/a/25524082
type: Comment
has text: Why it is not a valid SQL , am adding the native query in XML and called it from the DAO. and according to the parameter the parameters are define by q.setParameter("startDate", startDate);
score: 0
type: AnswerComment

http://stackoverflow.com/q/25548594
tagged with: collections
has title: Is there a Comparator<List<T>> or Comparator<Collection<T>>?
favorite count: 0
accepted answer: http://stackoverflow.com/a/25551471
has comment: http://stackoverflow.com/comment/39895058
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25549154
tagged with: guava
has answer: http://stackoverflow.com/a/25551471
tagged with: java
possible better answer: http://stackoverflow.com/a/25549154
has comment: http://stackoverflow.com/comment/39892268
has body: I am searching for a class that implements one of the following java.util.Comparator&lt;int[]&gt; java.util.Comparator&lt;List&lt;T&gt;&gt; java.util.Comparator&lt;Collection&lt;T&gt;&gt; Why is there no such class in the Java Standard Library / Apache Common / Google Guava ?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/39896178
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39892079
downvote count: 0
has comment: http://stackoverflow.com/comment/39892247
tagged with: apache-commons-collection

http://stackoverflow.com/q/25397596
answer count: 1
tagged with: timestamp
has title: jackson timestamp mapping bug?
accepted answer: http://stackoverflow.com/a/25403920
type: Question
has answer: http://stackoverflow.com/a/25403920
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I get the data from the mobile client as the json file. But, if only the time stamp, it can not normally receive data. In the end, truncated 3-digit number. So the date is completely wrong. This is my source. json file { "startPhotoAddress": "Great Ocean Road, Hordern Vale", "createTimeStamp": "1356998400", "startPhotoTimeStamp": "1356998430" } In the controller @RequestMapping(value = "/moment", method = RequestMethod.POST, headers = "Accept=application/json") public @ResponseBody JsonNode setMomentJson(HttpServletRequest request, @RequestBody Moment moment){ In the model import java.sql.Timestamp; public class Moment{ private Timestamp createTimeStamp; public Timestamp getCreateTimeStamp() { return createTimeStamp; } public void setCreateTimeStamp(Timestamp createTimeStamp) { this.createTimeStamp = createTimeStamp; } } I get createTimeStamp : 1970-01-17 01:56:38.4 it use only 1356998 from 1356998400 of createTimeStamp. If it receive a string, not a problem. Please, what is the problem? Thanks in advance for your help.
type: AnsweredQuestion
score: 0
tagged with: jackson

http://stackoverflow.com/comment/39779029
has text: see this post in using replace() and replaceAll() methods of String http://stackoverflow.com/questions/22902229/i-want-to-replace-a-word-in-a-story
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25487146
type: Comment

http://stackoverflow.com/q/25407084
score: 0
answer count: 0
has body: I have got a mpg video file from a camera and I'd like to import this file to java application which should do some things on it and save new video file with apply all operation. What I want to do exactly: Below is a sample frame from my video. And after imported video, java app should add some content at the bottom of video(for each frame) like fps, date etc. I know that this information can be extracted by openCv, but it's not my problem. I don't know how to make such a content and add it to a video and render to external mpg file. I prepare a simple demonstration how should look the output video after render by my app.
tagged with: opencv
has title: Java: Render video with extra box on it.
type: Question
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39633596
has comment: http://stackoverflow.com/comment/39630538
tagged with: video
tagged with: video-processing

http://stackoverflow.com/a/25451627
type: Answer
answers question: http://stackoverflow.com/q/25451481
score: 0
has body: Each time one of your listener is call, you should call a method that will check the selection on each of the ComboBox and return the total price of these item selected.

http://stackoverflow.com/a/25421300
accepted answer of: http://stackoverflow.com/q/25421220
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25421220
has body: Here's a self-contained example on how to get an instance Field through reflection. public class Main { // the instance field String simple = "foo"; // some static main method public static void main(String[] args) throws Exception { // initializing the class as we're accessing an instance method new Main().reflect(); } public void reflect() { Class&lt;?&gt; c = this.getClass(); try { // using getDeclaredField for package-protected / private fields Field field = c.getDeclaredField("simple"); // printing out field's value for this instance System.out.println(field.get(this)); } // TODO handle better catch (IllegalAccessException iae) { iae.printStackTrace(); } catch (NoSuchFieldException n) { n.printStackTrace(); } } } Output foo

http://stackoverflow.com/comment/39789264
has text: @Frakcool Actually I can delete them, what I need is just find the intersection between strings.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25491183

http://stackoverflow.com/comment/39673030
has text: Yeah, this makes senses.
type: AnswerComment
comment on: http://stackoverflow.com/a/25429921
score: 0
type: Comment

http://stackoverflow.com/comment/39704356
comment on: http://stackoverflow.com/a/25446816
has text: +1 specially for last 2 paragraphs. However I'd prefer `JFrame.DO_NOTHING_ON_CLOSE` and process all pending stuff (such as log-out, logger stuff, resource liberation, ...) adding a `WindowAdapter` to the frame and overriding `windowClosing()` method, and finally do the `frame.dispose()` call
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25530978
has body: If you are not already using working sets in Eclipse, they provide a good way to organize your projects. The organization is single-level, rather than hierarchical, but you can group projects and then quicly select in the project explorer view settings whether you want the working sets to be shown or not. A potentially useful detail is that a project may be contained in multiple working sets, so that you can have multiple grouping criteria at the same time. In your case, you could define a working set for each phase of your build, prefixing its name with a letter or number that would ensure its presentation in a specific order. Or you could define a working set for each set of projects with the same dependencies. Alternatively, you might be able to just rename your projects appropriately. In many cases the project name itself is mostly cosmetic, although it is often used as a default in generated files. In my opinion, however, the easiest way to "tell which classes can be used" is to just configure your project build paths correctly and let the editor do the rest. For me it is more natural not to use a class because it is not proposed for auto-completion or because any such use results in a compiler error, rather than explicitly checking the dependencies each and every time...
score: 2
upvote count: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25530811

http://stackoverflow.com/comment/39799852
comment on: http://stackoverflow.com/a/25498099
score: 1
type: Comment
type: AnswerComment
has text: What is stopping us from doing builder.objectToSet(foo).objectToSet(bar) ?

http://stackoverflow.com/a/25475075
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/25474912
type: AcceptedAnswer
downvote count: 0
score: 6
has body: What you might be missing is a comment saying something like /* your code here */ as instructions for what to do when subclassing. public class LoggerDecorator implements Logger { Logger logger; public LoggerDecorator(Logger logger) { this.logger = logger; } @Override public void log(String msg) { /** YOUR CODE HERE WHEN SUBCLASSING **/ /** * delegate to the base logger passed into the constructor to * perform existing logging operations. */ logger.log(msg); } } Each time you call a decorator constructor, you pass in an existing logger. This logger is assigned to a private variable and is used in the overridden log method. For each decoration, you add more functionality to the logger.log calls. For example, when you instantiate your HTMLLogger, you're adding in a system.out message. As an exercise, create another concrete logger called XMLLogger, like so: public class XMLLogger extends LoggerDecorator { public XMLLogger(Logger logger) { super(logger); } @Override public void log(String msg) { logger.log(msg); System.out.println("<?xml version="1.0"?><message>XML Logger" + msg); //Generate the xml file } } and then add it to your test runner: public LoggerTest() { BasicLogger logger = new BasicLogger(); Logger htmlLogger = new HTMLLogger(new BasicLogger()); Logger xmlAndHtmlLogger = new XMLLogger(new HTMLLogger()); logger.log("Basic Logger log"); htmlLogger.log("HTML Logging"); xmlAndHtmlLogger.log("I am Both HTML and XML logging"); } Output: BasicLogger: Basic Logger log BasicLogger: HTML Logging HTML LoggerHTML Logging BasicLogger: I am Both HTML and XML logging HTML LoggerI am Both HTML and XML logging <?xml version="1.0"?><message>XML LoggerI am Both HTML and XML logging In the above output, I inserted a space simply to show you the output resulting from the xmlAndHtmlLogger.log method call. The decorator pattern works by extending a base class, adding additional code to the overridden method, and then delegating back to the original. So for each new decorator su…
answers question: http://stackoverflow.com/q/25474912

android-manifest
tags question: http://stackoverflow.com/q/25439216
type: Tag
tag name: android-manifest
tags question: http://stackoverflow.com/q/25471660

http://stackoverflow.com/comment/39795491
has text: hey, nevermind! Replace the code with you `ShortBuffer` code and it's working like magic! Now I have same values as Matlab. Cheers!
type: Comment
comment on: http://stackoverflow.com/a/25490914
type: AnswerComment
score: 0

http://stackoverflow.com/a/25519488
has comment: http://stackoverflow.com/comment/39839716
has comment: http://stackoverflow.com/comment/39839780
upvote count: 4
has comment: http://stackoverflow.com/comment/39839772
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25519336
type: Answer
score: 4
has body: Short answer no, it is not thread safe and all calls to tableChanged should be made from within the context of the Event Dispatching Thread. If you need to update a TableModel, either disconnect it from the table and apply it in a single step (setModel) within the confines of the EDT or sync the updates to the model back to the EDT through the use of a SwingWorker or EventQueue.invokeLater General rule of thumb with Swing, assume nothing is thread safe and guard for it. I imagine tableChanged() to just put a new Event into the Event queue, so that the Event-Dispatcher-Thread will update the JTable at some point in the future, but is this adding thread safe? Not all events get scheduled on the Event Queue, many are simply processed by a for-next loop within the component, looping through the registered listeners directly, as is the case for TableModel's fire event methods... For example, from the AbstractTableModel... public void fireTableChanged(TableModelEvent e) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i&gt;=0; i-=2) { if (listeners[i]==TableModelListener.class) { ((TableModelListener)listeners[i+1]).tableChanged(e); } } } This means that the fireTableChanged method will be executed within the context of the thread that called it, and will notifiy its listeners from within the same thread. This means that if you were to call TableModel.setValueAt from a different thread, it would call fireTableCellUpdated, which would call fireTableChanged and would eventually call tableChanged within the context of that thread... As a side note, you should not be calling JTable#tableChanged directly, it's public as a side effect (inner classes weren't around when JTable was created ;)), you should be making modifications to the table's model and allowing the model to trigger the event notifications. Up…
has comment: http://stackoverflow.com/comment/39839557
answers question: http://stackoverflow.com/q/25519336
has comment: http://stackoverflow.com/comment/39839917
has comment: http://stackoverflow.com/comment/39839620
has comment: http://stackoverflow.com/comment/39847196
has comment: http://stackoverflow.com/comment/39840005
type: AcceptedAnswer

http://stackoverflow.com/q/25535330
score: 0
has comment: http://stackoverflow.com/comment/39869430
answer count: 0
tagged with: jscrollpane
tagged with: java
has comment: http://stackoverflow.com/comment/39868563
has body: ok so heres my question.. i need to create a software that fits for 1280x800 resoultion and our programming team has 1366x768 screens. So we decided it wud be cool to develop the UI like the Windows 8 start screen or the Nokia Lumia Home Screen. Thus we want to put a panel inside a scrollpane. I found this piece of code from a site it completes our requirement. But problem is that we can not implement this in Netbeans. As the question says I need sum visual help on how to fix this in Netbeans. We are capable of hard coding it but I dont think it wud be preferred by the team. package test; import java.awt.*; import javax.swing.*; public class NewClass extends JFrame { public NewClass() throws HeadlessException { final JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createLineBorder(Color.red)); panel.setPreferredSize(new Dimension(800, 600)); panel.setBackground(Color.black); final JScrollPane scroll = new JScrollPane(panel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); add(scroll, BorderLayout.CENTER); setSize(300, 300); setVisible(true); } public static void main(final String[] args) throws Exception { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new NewClass().setVisible(true); } }); } } here's a screenshot of the image
has comment: http://stackoverflow.com/comment/39869128
tagged with: swing
has comment: http://stackoverflow.com/comment/39868293
type: Question
has title: Insert JPanel Into JScrollPane to create sliding UI in netbeans
has comment: http://stackoverflow.com/comment/39868234
has comment: http://stackoverflow.com/comment/39868357
has comment: http://stackoverflow.com/comment/39869054
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39868651
has comment: http://stackoverflow.com/comment/39869099
tagged with: jpanel
has comment: http://stackoverflow.com/comment/39868421
has comment: http://stackoverflow.com/comment/39870043
linked to: http://stackoverflow.com/q/2561480
tagged with: netbeans

http://stackoverflow.com/q/25406320
upvote count: 1
score: 1
favorite count: 0
has title: Showing Key-Value attribute of a File added using java.nio.file.attribute.UserDefinedFileAttributeView
type: Question
type: UnansweredQuestion
has body: I want to show Key-Value attribute of a CSV file which is added using java.nio.file.attribute. UserDefinedFileAttributeView interface of java. I can add attribute to CSV file and can read it successfully but I am not able to show this in the "Property Details Dialog" i.e Test.csv=>Right Click=>Properties=>Details=> (Test.csv in my case). Please help me..
answer count: 0
tagged with: java
downvote count: 0

http://stackoverflow.com/q/25457460
type: Question
has comment: http://stackoverflow.com/comment/39724349
accepted answer: http://stackoverflow.com/a/25457535
has answer: http://stackoverflow.com/a/25457535
possible better answer: http://stackoverflow.com/a/25457576
has comment: http://stackoverflow.com/comment/39724282
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25457576
has comment: http://stackoverflow.com/comment/39724503
answer count: 2
upvote count: 2
score: 2
tagged with: java
has body: I have a method which takes in 4 floats and modifies the value. Now I would like to set the floats of the parent class to the value that the method took in. Some code: public void influence(float x, float y, float w, float h){ x += 5; y += 5; w += 5; h += 5; } Now that would be called from the parent class like this: float x = 5, y = 5, w = 5, h = 5; influence(x, y, w, h); I would like to set the floats in the parent to the modified method. I know I could return a float[] and then manually set the floats of the parent class to that array but is there a better way to do this? I could also use a class like Rect but that would be like an array.
downvote count: 0
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/39724347
tagged with: methods
tagged with: variables
has title: Java variable setting through method
favorite count: 0

http://stackoverflow.com/comment/39661099
type: QuestionComment
comment on: http://stackoverflow.com/q/25423743
score: 1
has text: don't trust yourself? it is simple, don't use i or j.
type: Comment

http://stackoverflow.com/q/25458376
has comment: http://stackoverflow.com/comment/39726205
tagged with: alpha
type: Question
has comment: http://stackoverflow.com/comment/39726140
accepted answer: http://stackoverflow.com/a/25458445
answer count: 1
has answer: http://stackoverflow.com/a/25458445
has body: In java, I want to make a fully transparent RGBA, and I do that by using public static int getTransparentRGB() { int r = 0; int g = 0; int b = 0; int a = 0; int new_pixel = (a &lt;&lt; 24) | (r &lt;&lt; 16) | (g &lt;&lt; 8) | b; return new_pixel; } Color color = new Color(getTransparentRGB()); System.out.println(color.getAlpha()); // -&gt; 255 ?! I purposely keep all rgba values 0. However after I create the Color object with the rgba value as the constructor, if I call .getAlpha(), I get 255 even though I made the rgb value with a 0 alpha. If it returns 255, how could I tell the difference between a Color object that wasn't transparent, because that would also have a 255 alpha. I expect the color object to return a 0 alpha based on the function above. Does anyone know whats going on? Thanks
has title: How to detect if a RGB is fully transparent?
tagged with: colors
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/25441683
has comment: http://stackoverflow.com/comment/39694401
answer count: 0
tagged with: java
has body: I can not understand why IJ show my root disk D: transparently? It is hidden or something?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39705112
upvote count: 2
type: UnansweredQuestion
tagged with: intellij-idea
downvote count: 0
tagged with: hidden-files
tagged with: jetbrains-ide
has title: Why Intellij IDEA show my disk D: transparently?
has comment: http://stackoverflow.com/comment/39694445
score: 2

http://stackoverflow.com/comment/39842044
type: QuestionComment
has text: I think you miss the point. There is not any matter which language is better (it's subjective after all to a large degree). This comment adds nothing to the fact that C# made a clearer choice in this specific issue and java did not (or could not).
comment on: http://stackoverflow.com/q/25520385
score: 1
type: Comment

http://stackoverflow.com/comment/39753802
comment on: http://stackoverflow.com/q/25473192
score: 0
type: Comment
type: QuestionComment
has text: I'd try cleaning and rebuilding the project. Looks like you might be using some old version of the class.

http://stackoverflow.com/q/25525421
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25526104
score: 0
has body: I am trying to test the auto complete feature in a search wizard wherein after sending search query, I have to click on the top menu item which would appear as auto complete just like it happens in Google search. Below is the html structure that appears when I type Text in search bar: Text A Text B I need to click the first menu item in auto complete which is Text A here in this case. Below is what I have tried in java: destinationInput.sendKeys(city); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } WebDriverWait wait = new WebDriverWait(driver, 5); wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("ul.ui-autocomplete"))); List <WebElement> listItems = driver.findElements(By.className("partition_item")); listItems.get(0).click(); But nothing seems to happen. I am getting IndexOutOfBoundException at listItems.get(0) which i guess is because its unable to get the anchor tags inside ul element. I also had gone through this answer but am unable to incorporate it in java. Please guide.
answer count: 1
tagged with: selenium
has comment: http://stackoverflow.com/comment/39850092
has title: Clicking autocomplete menu item using Selenium
type: Question
tagged with: automation
has comment: http://stackoverflow.com/comment/39849952
tagged with: autocomplete
has comment: http://stackoverflow.com/comment/39851002
tagged with: java
has comment: http://stackoverflow.com/comment/39851191
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/12515747
accepted answer: http://stackoverflow.com/a/25526104

http://stackoverflow.com/comment/39652899
has text: It depends, either DOM or SAX would be preferred as it will provide you with the raw information you need and the ability to filter the content as required...
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25419012

http://stackoverflow.com/comment/39800498
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25498139
has text: I removed `generator ` tag it worked fine. Here I am taking `vehicleno` from UI, its not `autoincriment`.

http://stackoverflow.com/a/25522049
score: 1
has comment: http://stackoverflow.com/comment/39845923
type: Answer
has body: /* An Alternative Solution: See if this helps::::Sample Code of java,javascript,jsp for search parameters. Search Parameter POJO will have search parameters + Pagenumber + RecordCounton the page + sortColumn in it */ public class SearchParameters implements Serializable{ /** * */ private static final long serialVersionUID = 4847934022647742263L; private Integer pageNumber; private String sortColumn; private Integer recordCount; private String sortOrder; private Long gdsProductId; // some search parameter private Integer ruleId; // some search parameter //getter and setters } /* your java controller method, which accepts the SearchParameter Object */ @RequestMapping(value = "/search", method = RequestMethod.POST) @ResponseBody public Map&lt;String, GDS&gt; search(SearchParameters parameters) throws Exception { // Print Parameter logger.info("read :=" + parameters); // your logic to be written here } /* Your Javascript will have the below function. $("#searchPaginationform").serialize() will send the data for all the hidden elements of searchPaginationform in the below jsp. form searchPaginationform will have hidden fields for the pagenumer,rows and other elements */ $.post('search.form', $("#searchPaginationform").serialize(), function (response) { } /* Your Jsp -- see the hiddenfield name is matching the SearchParameter instance variable -*/ &lt;form:form id="searchPaginationform"&gt; &lt;input type="hidden" name="gdsProductId" id="gdsProductId" &gt; &lt;input type="hidden" name="pageNumber" id="pageNumber" value=1&gt; &lt;input type="hidden" name="sortColumn" id="sortColumn" value="metamap_id"&gt; &lt;input type="hidden" name="recordCount" id="recordCount" value=10&gt; &lt;input type="hidden" name="sortOrder" id="sortOrder" value="desc"&gt; &lt;input type="hidden" name="ruleId" id="ruleId"&gt; &lt;/form:form&gt;
has comment: http://stackoverflow.com/comment/39846334
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39845319
answers question: http://stackoverflow.com/q/25521784

http://stackoverflow.com/comment/39791214
type: Comment
has text: I'm really sorry sir. I'm a newbie. What is the meaning of the "expected value" stated on the comment below the public static void main? Thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25493241

sockets
tags question: http://stackoverflow.com/q/25545825
tags question: http://stackoverflow.com/q/25488370
tags question: http://stackoverflow.com/q/25541053
tags question: http://stackoverflow.com/q/25475837
tags question: http://stackoverflow.com/q/25430238
tags question: http://stackoverflow.com/q/25532151
tags question: http://stackoverflow.com/q/25448154
tags question: http://stackoverflow.com/q/25480915
tags question: http://stackoverflow.com/q/25416605
tags question: http://stackoverflow.com/q/25500501
tags question: http://stackoverflow.com/q/25395095
tags question: http://stackoverflow.com/q/25512243
tags question: http://stackoverflow.com/q/25550815
tags question: http://stackoverflow.com/q/25522724
tags question: http://stackoverflow.com/q/25503547
tags question: http://stackoverflow.com/q/25522340
tags question: http://stackoverflow.com/q/25456452
tags question: http://stackoverflow.com/q/25426064
tags question: http://stackoverflow.com/q/25531640
tags question: http://stackoverflow.com/q/25527212
tags question: http://stackoverflow.com/q/25478695
tag name: sockets
tags question: http://stackoverflow.com/q/25442098
tags question: http://stackoverflow.com/q/25503000
tags question: http://stackoverflow.com/q/25489145
tags question: http://stackoverflow.com/q/25523450
tags question: http://stackoverflow.com/q/25437906
tags question: http://stackoverflow.com/q/25492178
tags question: http://stackoverflow.com/q/25431436
tags question: http://stackoverflow.com/q/25491682
tags question: http://stackoverflow.com/q/25465334
tags question: http://stackoverflow.com/q/25543149
tags question: http://stackoverflow.com/q/25446287
tags question: http://stackoverflow.com/q/25511886
tags question: http://stackoverflow.com/q/25490451
tags question: http://stackoverflow.com/q/25411509
tags question: http://stackoverflow.com/q/25447177
tags question: http://stackoverflow.com/q/25544849
tags question: http://stackoverflow.com/q/25455253
tags question: http://stackoverflow.com/q/25464336
tags question: http://stackoverflow.com/q/25402162
tags question: http://stackoverflow.com/q/25474479
tags question: http://stackoverflow.com/q/25503404
type: Tag
tags question: http://stackoverflow.com/q/25528634
tags question: http://stackoverflow.com/q/25419941
tags question: http://stackoverflow.com/q/25505725
tags question: http://stackoverflow.com/q/25522774

http://stackoverflow.com/q/25469006
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39745703
type: Question
has comment: http://stackoverflow.com/comment/39745751
has comment: http://stackoverflow.com/comment/39745603
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39745591
has body: I had a question about scripts and running programs. Would you be able to run a script against a running Java program to get data values from the running java program? Essential I use a java program that monitors electronics equipment and once a week we record data values on some of the devices. There are 8 devices we do this with and each device has 64 data points we record and I am looking to see if there is a way that you can run a script to collect this data with out disrupting the program in any way? Appreciate any advice or insights. Thank you.
has comment: http://stackoverflow.com/comment/39745991
upvote count: 1
downvote count: 1
favorite count: 0
has title: running scripts against running program
linked to: http://stackoverflow.com/q/975271
score: 0
has comment: http://stackoverflow.com/comment/39745570

http://stackoverflow.com/comment/39738437
type: QuestionComment
has text: What are the search criteria? Of the ordering is on `price` then you will always have to do a `O(n)` search to find an article by some different criteria.
score: 0
comment on: http://stackoverflow.com/q/25465005
type: Comment

http://stackoverflow.com/q/25396662
has title: Why does my while loop needs this line of code to run?
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25396695
possible better answer: http://stackoverflow.com/a/25397291
has answer: http://stackoverflow.com/a/25396695
tagged with: file
type: AnsweredQuestion
score: 0
tagged with: while-loop
tagged with: java
tagged with: io
has answer: http://stackoverflow.com/a/25397291
has body: I just completed an application which prompts the user for a text File input IO but I have something to clarify as the final part, While loop I actually managed to refer it to a tutorial on google. In this loop, there is a if-else statement and for the else part I don't understand why is it necessary. Here's my code: import java.io.*; import java.util.*; class FileReadingExercise2 { public static void main(String[] args) { Scanner userInput = new Scanner(System.in); Scanner fileInput = null; do { try { System.out.println("Please enter the name of a file or type QUIT to finish"); String a = userInput.nextLine(); if (a.equals("QUIT")) { // if user inputs QUIT then stop application System.exit(0); } fileInput = new Scanner(new File(a)); // the file contains text and integers } catch (FileNotFoundException e) { System.out.println("Error - File not found"); } } while (fileInput == null); int sum = 0; while (fileInput.hasNext()) // continues loop as long as there is a next token { if (fileInput.hasNextInt()) // if there is an int on the next token { sum += fileInput.nextInt(); // then adds the int to the sum } else { fileInput.next(); // else go to the next token } } System.out.println(sum); fileInput.close(); } } As you can see, as long as the fileInput Scanner has a next token to look up to then operate the if else statement. If fileInput has a next Int then adds it up to the sum variable. So from what I think is that this will be sufficient. Once fileInput has no more token to read, it shall get out of the while loop isn't it? Why does it has still go onto the next token? I'm confused. Please advise thanks! ;)

http://stackoverflow.com/comment/39692491
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25440653
type: AnswerComment
has text: but must be monospaced font used for

http://stackoverflow.com/q/25458060
linked to: http://stackoverflow.com/q/8696094
score: -3
has comment: http://stackoverflow.com/comment/39725517
has comment: http://stackoverflow.com/comment/39725478
has title: Calling methods
has comment: http://stackoverflow.com/comment/39725495
has comment: http://stackoverflow.com/comment/39725521
has comment: http://stackoverflow.com/comment/39725474
tagged with: function
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39725894
has comment: http://stackoverflow.com/comment/39725470
downvote count: 3
answer count: 1
tagged with: methods
has answer: http://stackoverflow.com/a/25458133
has body: I have a project in mind however there are a few basics I need to master before I can proceed. Here's the issue I'm trying to call a function from main in java but I can't get it to compile. I have read the feedback and I went with using a switch to call each function. I always get "error can't find symbol". I've made a few changes here and there trying to get it to run. Once again I feel like I'm lacking something very fundamental and it's preventing me from getting this to work. Any ideas import java.util.*; import java.lang.*; import java.io.*; class Practice { static void wagecalc() { Scanner input = new Scanner(System.in); System.out.println("Input pay per hour:"); int a = input.nextInt(); int b; System.out.println("Input hours worked:"); b = input.nextInt(); int c; System.out.println("Input days worked:"); c = input.nextInt(); int gross = a * b * c; System.out.println("Your gross pay is:" + gross); // Determining tax rate// if (gross &lt; 10000) { int taxrate = gross * 10 / 100; System.out.println("Your tax rate is 10%:/n"); int total = gross - taxrate; System.out.println("Your net pay is:" + total + "/n"); } else if (gross &gt; 10000 || gross &lt;= 30000) { int taxrate = gross * 15 / 100; System.out.println("Your tax rate is 15%:/n"); int total = gross - taxrate; System.out.println("Your net pay is:" + total + "/n"); } else if (gross &gt;= 30000 || gross &lt;= 70000) { int taxrate = gross * 20 / 100; System.out.println("Your tax rate is 20%:/n"); int total = gross - taxrate; System.out.println("Your net pay is:" + total + "/n"); } else if (gross &gt; 70000) { int taxrate = gross * 25 / 100; System.out.println("Your tax rate is 25%:/n"); int total = gross - taxrate; System.out.println("Your net pay is:" + total + "/n"); } } static void autocalc() { Scanner input = new Scanner(System.in); // Declaring the variables as an integer// int auto; int loan; int interest; int mnydwn; int pymnt; int year; int month = 12; int tap; int term = year * month; int spec; Syste…
has comment: http://stackoverflow.com/comment/39725771
favorite count: 0
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/39739308
comment on: http://stackoverflow.com/q/25465590
type: QuestionComment
has text: Without more details it is hard for us to tell you if this is a good approach. How are you going to use this? Why do you need to check the color? Can't you check the color using a hash instead?
score: 1
type: Comment

http://stackoverflow.com/comment/39656906
type: Comment
type: QuestionComment
has text: The SAXParser is an XML parser. I would try an HTML parser like Jsoup (http://jsoup.org/) that has the same parsing behaviour as common browsers.
score: 0
comment on: http://stackoverflow.com/q/25421409

http://stackoverflow.com/q/25496911
has comment: http://stackoverflow.com/comment/39798098
has comment: http://stackoverflow.com/comment/39798501
has comment: http://stackoverflow.com/comment/39798285
has comment: http://stackoverflow.com/comment/39797923
tagged with: swing
has answer: http://stackoverflow.com/a/25497151
has comment: http://stackoverflow.com/comment/39798406
has comment: http://stackoverflow.com/comment/39797808
has comment: http://stackoverflow.com/comment/39798412
has comment: http://stackoverflow.com/comment/39797882
has comment: http://stackoverflow.com/comment/39797862
has comment: http://stackoverflow.com/comment/39798557
has comment: http://stackoverflow.com/comment/39797974
has comment: http://stackoverflow.com/comment/39797838
has comment: http://stackoverflow.com/comment/39798003
type: Question
has comment: http://stackoverflow.com/comment/39798223
has comment: http://stackoverflow.com/comment/39797802
has comment: http://stackoverflow.com/comment/39797938
has comment: http://stackoverflow.com/comment/39798420
has comment: http://stackoverflow.com/comment/39798114
linked to: http://stackoverflow.com/q/25419808
has comment: http://stackoverflow.com/comment/39798092
has comment: http://stackoverflow.com/comment/39797893
has comment: http://stackoverflow.com/comment/39798258
has comment: http://stackoverflow.com/comment/39798439
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39797872
has comment: http://stackoverflow.com/comment/39798077
has comment: http://stackoverflow.com/comment/39798293
tagged with: jpanel
has body: I am using a JPanel to draw my game onto, using a fixed game loop, and double buffering; however I get a glitch somewhere on the screen. The glitch is a screen tearing visual artifact that stretches across X axis, and is about 20 pixels tall. I have recreated the problem in 1 class, as shown below. To recreate the problem, you can run the code and move the square around with the arrow keys, when the square moves over the place where the visual tearing occurs, you should see the effect. (The location of the visual tearing seems to be random) I recreated a single frame of what the image tearing looks like, however when running, it shows a flickering effect. package main; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.util.HashSet; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class Panel { public static void main(String[] args) { new Panel(); } public Panel() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Game!"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public interface View { public BufferedImage switchBuffers(); public int getWidth(); public int getHeight(); } public enum KeyState { UP, DOWN, LE…
tagged with: paintcomponent
has title: JPanel Drawing Glitch
has comment: http://stackoverflow.com/comment/39798516
has comment: http://stackoverflow.com/comment/39797831
has comment: http://stackoverflow.com/comment/39798274
has comment: http://stackoverflow.com/comment/39797929
favorite count: 0
has comment: http://stackoverflow.com/comment/39798554
has comment: http://stackoverflow.com/comment/39797803
has answer: http://stackoverflow.com/a/25497693
has comment: http://stackoverflow.com/comment/39797843
has comment: http://stackoverflow.com/comment/39798454
has comment: http://stackoverflow.com/comment/39798614
has comment: http://stackoverflow.com/comment/39798203
answer count: 2
has comment: http://stackoverflow.com/comment/39798356
has comment: http://stackoverflow.com/comment/39798138
downvote count: 0
has comment: http://stackoverflow.com/comment/39797972
has comment: http://stackoverflow.com/comment/39798059
has comment: http://stackoverflow.com/comment/39797942
has comment: http://stackoverflow.com/comment/39797824
has comment: http://stackoverflow.com/comment/39797992
has comment: http://stackoverflow.com/comment/39797899
upvote count: 1
has comment: http://stackoverflow.com/comment/39798012
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39797849
has comment: http://stackoverflow.com/comment/39798354
has comment: http://stackoverflow.com/comment/39798783

http://stackoverflow.com/comment/39662878
has text: @mk2301 mongodb is nosql and stores bson (binary json) documents and I also use the json stuff for other things too so jackson annotations are there anyway. The mongo driver provides a method to transform json to a dbobject which can then be inserted.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25424345

http://stackoverflow.com/a/25426000
has comment: http://stackoverflow.com/comment/39784934
has comment: http://stackoverflow.com/comment/39769599
has comment: http://stackoverflow.com/comment/39673291
score: 2
has body: I would consider using the following regex to delete all the comments and then use a simple regex to find all getMessage() calls. REGEX: ~/(?:/.?$|*.?*/)~ String regex = "(?ms)/(?:/.*?$|\*.*?\*/)" DEMO Please note the s flag, making the . match newline characters, too. You can use a character with a complemented group instead of the . So that would be something like [\w\W] instead of the second .
downvote count: 0
answers question: http://stackoverflow.com/q/25425755
type: Answer
has comment: http://stackoverflow.com/comment/39673011
upvote count: 2

http://stackoverflow.com/a/25391008
accepted answer of: http://stackoverflow.com/q/25390807
has comment: http://stackoverflow.com/comment/39600430
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/39600542
answers question: http://stackoverflow.com/q/25390807
has body: The problem is that you've installed the 32bit edition of Java ad the files are located in Program File x86. Try reinstalling Java and making sure its the 64bit edition. If it was, it would simply be installed in Program Files.
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39600370

http://stackoverflow.com/comment/39985859
has text: Thank you for your answer ShaggyInjun. i was fix it. I think this problem is cache of netbeans and I solved by solution: after rebuild entities i copy jar file to new location and add to library of project.
type: AnswerComment
comment on: http://stackoverflow.com/a/25578898
score: 1
type: Comment

http://stackoverflow.com/q/25431922
has comment: http://stackoverflow.com/comment/39676793
upvote count: 0
answer count: 1
tagged with: javabeans
downvote count: 1
linked to: http://stackoverflow.com/q/16918959
has body: I had a spring project that was working fine. I updated the java platform i had on my machine ( through out the java update notif that comes auto ) after that update I had a blue screen while i was coding and now i can't deploy the solution on Tomcat since i keep having this error : Aug 21, 2014 5:25:21 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arepScreeningController' defined in file [E:\ORQR\css\code\IDE\webapps\AfDB-CSS\WEB-INF\classes\com\gcap\css\controller\ArepScreeningController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.gcap.css.controller.ArepScreeningController]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems: The import java.util.Arrays cannot be resolved Arrays cannot be resolved Arrays cannot be resolved at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abstract…
favorite count: 0
has comment: http://stackoverflow.com/comment/39676738
type: Question
accepted answer: http://stackoverflow.com/a/25432359
has answer: http://stackoverflow.com/a/25432359
tagged with: java
score: -1
tagged with: spring
has comment: http://stackoverflow.com/comment/39676665
tagged with: spring-mvc
type: AnsweredQuestion
has title: java.util.arrays cannot be resolved

http://stackoverflow.com/q/25413110
has title: Date in a format
tagged with: date
answer count: 4
type: AnsweredQuestion
tagged with: jodatime
has comment: http://stackoverflow.com/comment/39642135
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39642052
type: Question
has comment: http://stackoverflow.com/comment/39642019
has comment: http://stackoverflow.com/comment/39642173
has answer: http://stackoverflow.com/a/25413364
has answer: http://stackoverflow.com/a/25420614
has comment: http://stackoverflow.com/comment/39642112
has answer: http://stackoverflow.com/a/25413333
has comment: http://stackoverflow.com/comment/39642074
accepted answer: http://stackoverflow.com/a/25413333
has comment: http://stackoverflow.com/comment/39642111
has answer: http://stackoverflow.com/a/25413291
possible better answer: http://stackoverflow.com/a/25413291
tagged with: datetime
has body: I have this code DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'-'hh:mm") DateTime dateTime1 = new DateTime() println("dateTime1 : " + dateTime1) DateTime formattedDate = fmt.parseDateTime(dateTime1.toString()); println("formattedDate : " + formattedDate) DateTimeFormatter finalFormat = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm'-'hh:mm"); System.out.println("formatted date : " + finalFormat.print(formattedDate)); It prints out something like this : dateTime1 : 2014-08-20T15:34:17.256-04:00 formattedDate : 2014-08-20T16:00:17.256-04:00 formatted date : 2014-08-20T16:00-04:00 I want a date in exactly this format(since those are the requirements) 2014-08-20T15:34-04:00 The problem with formattedDate : 2014-08-20T16:00:17.256-04:00 formatted date : 2014-08-20T16:00-04:00 is for time difference it always prints out '16:00-04:00' How do I get that ? The date is retrieved from the database which will be converted in to DateTime object. When I try this : DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ") DateTime dateTime1 = new DateTime() println("dateTime1 : " + dateTime1) DateTime formattedDate = fmt.parseDateTime(dateTime1.toString()); println("formattedDate : " + formattedDate) DateTimeFormatter finalFormat = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm'-'hh:mm"); System.out.println("formatted date : " + finalFormat.print(formattedDate)); the output changes : dateTime1 : 2014-08-20T15:59:34.876-04:00 formattedDate : 2014-08-20T15:59:34.876-04:00 formatted date : 2014-08-20T15:59-03:59 It should be -04.00. But comes back as '-03:59', which is buggy. Any help is highly appreciated. Thanks

http://stackoverflow.com/comment/39758809
type: AnswerComment
comment on: http://stackoverflow.com/a/25476089
has text: I'm deleted that method but force closed again
type: Comment
score: 0

http://stackoverflow.com/q/25487659
score: 0
has answer: http://stackoverflow.com/a/25487783
has title: Issue with Hibernate and Spring Injection of autowired dependencies
answer count: 1
has body: I've just started using hibernate and spring and faced following exception: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.omid.hd.dao.impl.UserDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.OneToOne.orphanRemoval()Z at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationCon…
linked to: http://stackoverflow.com/q/4591684
tagged with: autowired
type: Question
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: spring
has comment: http://stackoverflow.com/comment/39780268

http://stackoverflow.com/q/25469241
type: Question
has comment: http://stackoverflow.com/comment/39748807
score: 0
has answer: http://stackoverflow.com/a/25470610
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39748624
has comment: http://stackoverflow.com/comment/39748598
answer count: 1
tagged with: encryption
has comment: http://stackoverflow.com/comment/39749810
has title: Socket and ObjectInputStream in Java - Android
has body: I have a problem with the Socket and ObjectInputStream using the Cipher class of Java. I use a client Android, that write an ObjectOutputStream on Socket, and a client Java that read this ObjectInputStream from the same Socket. This is the code client/server CLIENT [CODE] public static void functionRegistration(String usr, String pwd) throws UnknownHostException, IOException, InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException{ Socket socket = new Socket(SERVER_ADDRESS_STRING, PORT_NO); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream())); socket.setSoTimeout(DEFAULT_TIMEOUT); if(!socket.isConnected()){ System.out.println("[!] [Client] Connection problem!"); socket.close(); return; } //Diffie-Hellman BigInteger shared_key = DiffieHellmanExchangeClient(socket, br, bw); byte[] hash = ObjectHash.getByteHashCode(shared_key, SECURE_HASH_TYPE.SHA384); //Extract IV and cipherKey byte[] IV = new byte[16]; byte[] cipherKey = new byte[32]; int i, limit; for(i = 0; i &lt; IV.length; i++) IV[i] = hash[i]; limit = i; for(; i &lt; hash.length; i++) cipherKey[i - limit] = hash[i]; //Send username bw.write(usr); bw.write("\r\n"); bw.flush(); ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); //Hash password String passwordHash = new String(ObjectHash.getByteHashCode(pwd, SECURE_HASH_TYPE.SHA512)); //Cipher password String encryptedPasswordHash = new String(cipherMessage(passwordHash, cipherKey)); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); IvParameterSpec ivparameters = new IvParameterSpec(IV); cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(cipherKey, "AES"), ivparameters); oos.writeObject(new SealedObject(encryptedPasswordHash, cipher)); oos.flush(); if(br.readLine().compareTo("ACK") == 0) L…
has comment: http://stackoverflow.com/comment/39747668
tagged with: objectinputstream
has comment: http://stackoverflow.com/comment/39748367
has comment: http://stackoverflow.com/comment/39748439
tagged with: security
has comment: http://stackoverflow.com/comment/39747814
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39748702
has comment: http://stackoverflow.com/comment/39748502
has comment: http://stackoverflow.com/comment/39748789
has comment: http://stackoverflow.com/comment/39748812

http://stackoverflow.com/a/25443941
has comment: http://stackoverflow.com/comment/39699033
has body: I doubt what you published is valid code because Map or HashMap takes 2 parameter types i.e. Map&lt;K, V&gt;. If you are actually asking about the practice to set a static structure of its own type on the class level, then yes its OK. It's a convenient way to keep a global collection of a certain class. One sample usage is when you want to ensure == equality when object equals and to return the unique instance.
score: 0
answers question: http://stackoverflow.com/q/25443845
has comment: http://stackoverflow.com/comment/39762112
has comment: http://stackoverflow.com/comment/39698405
type: Answer

http://stackoverflow.com/comment/39701449
type: QuestionComment
score: 0
has text: @paul `export` sets environment variables on a per-shell basis. You *need* to be in the same shell that you've run `export` in.
type: Comment
comment on: http://stackoverflow.com/q/25445635

http://stackoverflow.com/comment/39683861
type: Comment
type: QuestionComment
has text: Guide you? Hell, I don't even know what you're error is.
comment on: http://stackoverflow.com/q/25435598
score: 0

http://stackoverflow.com/q/25447632
type: UnansweredQuestion
tagged with: camera
upvote count: 5
tagged with: android
has title: Does the getFocusDistances() camera API function actually work for Nexus 5? or any other device?
has answer: http://stackoverflow.com/a/25451333
tagged with: java
answer count: 1
downvote count: 0
tagged with: nexus-5
has body: I would like to determine the distance of an object from my Nexus 5 camera, preferably without using an object like a coin for scale. I figured the Camera.Parameters getFocusDistances function would work for this. I attempted to do this via something like the following in my takePicture() jpeg callback: Parameters params = camera.getParameters(); Float focusDistances[] = new float [3]; params.getFocusDistances( focusDistances ); I tried running this a few times with objects of different distances from the camera, though each time, focusDistances[FOCUS_DISTANCE_NEAR_INDEX], focusDistances[FOCUS_DISTANCE_OPTIMAL_INDEX], and focusDistances[FOCUS_DISTANCE_FAR_INDEX] all contained the value positive infinity. It's possible I'm doing something wrong, in which case please let me know if there is a specific way I'm which this will work on the Nexus 5. However the android API specifically states you can call getParameters() (and then getFocusDistances()) at any time to get the latest focus distances and therefore I think this should work. One thing I haven't tried yet is doing the above in an on auto focus handler, however I don't see why this should matter. I did some research to try and see what was going on, and I found several questions regarding this sort of behavior from getFocusDistances() and typically the answer, if there was one, was that the function is not supported by the android API and/or the hardware manufacturer. Now a lot of these discussions I found online were from several years ago, and dispite the questionable feelings it gives me about getFocusDistances, I've still seen this function suggested to be used for getting the focus distance so I figure it must work on SOME device for SOME android API version. Does anybody know if getFocusDistances() works for any particular version of android on the Nexus 5? If not, does anybody know ANY device it does work on? EDIT: Since posting, I have tried obtaining the focus distances in the onAutoFocus handler, as wel…
favorite count: 0
type: Question
score: 5

http://stackoverflow.com/comment/39879448
type: Comment
has text: I do have this variable set, but not sure whether it matters.
type: QuestionComment
comment on: http://stackoverflow.com/q/25541427
score: 0

http://stackoverflow.com/a/25521279
has comment: http://stackoverflow.com/comment/39842587
type: Answer
downvote count: 0
has body: You simply try like this: for(String s : yourStringList) { intList.add(Integer.valueOf(s)); } EDIT for (List&lt;String&gt; s : yourStringList) { List&lt;Integer&gt; x = new ArrayList&lt;Integer&gt;(); for (String str: s) { x.add(Integer.parseInt(str)); } intList.add(x); }
answers question: http://stackoverflow.com/q/25521207
upvote count: 3
score: 3

http://stackoverflow.com/q/25442323
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25442486
linked to: http://stackoverflow.com/q/47605
has answer: http://stackoverflow.com/a/25654883
has comment: http://stackoverflow.com/comment/39695603
has answer: http://stackoverflow.com/a/25442486
has comment: http://stackoverflow.com/comment/39695588
tagged with: java
linked to: http://stackoverflow.com/q/12825847
downvote count: 0
has comment: http://stackoverflow.com/comment/39696101
tagged with: concurrency
has body: This post says that a += b is the equivalent of a = new StringBuilder() .append(a) .append(b) .toString(); Let's say I have this code: public class MultiThreadingClass extends SomeThirdPartyClassThatExtendsObject{ public void beginmt(String st) throws IOException { //st is a thread number st = new File("c:\\somepath").getCanonicalPath()+"\\"+st; System.out.println(st); } } Assume that beginmt runs multiple times simultaneously (with thread numbers 1 to 15500) on a single instance of MultiThreading class. Could there be instances such that it could print the following i.e. some thread numbers are lost and some numbers are doubled? c:\somepath\2 c:\somepath\1 c:\somepath\1 c:\somepath\4 c:\somepath\5 c:\somepath\6 c:\somepath\7 c:\somepath\8 c:\somepath\8 c:\somepath\10 ... Edit: Will it be safe to say that the + operator won't get into some unsafe publication issue? I'm thinking the StringBuilder could be optimized into something that resembles an instance variable in which case it could be unsafely published. Edit 2: As far as the JLS, the abovementioned post, and a similar class file for the above code are checked, the StringBuilders to be used seem to have to get contained within different stackframes. However, I'd still like to check whether some form of aggressive optimization could cause the StringBuilders to be replaced by a centralized StringBuilder in some way. This sounds possible as it sounds logical for optimizers to optimize when it predicts that an object is just implemented in a non-constant way when in fact such object could be constant. Found stringopts.cpp but haven't found the time yet to fully check it. I'm hopefully looking for answers involving details of this source file. Edit 3: I'm still looking for answers that include code on aggressive inlining for mutable objects.
has comment: http://stackoverflow.com/comment/39695435
tagged with: jvm
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25586384
has comment: http://stackoverflow.com/comment/39695617
accepted answer: http://stackoverflow.com/a/25642962
has comment: http://stackoverflow.com/comment/39695519
has answer: http://stackoverflow.com/a/25442485
has answer: http://stackoverflow.com/a/25642962
has comment: http://stackoverflow.com/comment/39888453
tagged with: multithreading
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/25442501
has comment: http://stackoverflow.com/comment/40030567
has title: Thread safety of the plus operator for Strings, optimizations included
answer count: 6
has comment: http://stackoverflow.com/comment/39696263
tagged with: optimization

w3c
type: Tag
tag name: w3c
tags question: http://stackoverflow.com/q/25543588

http://stackoverflow.com/comment/39700064
has text: what about hibernate version
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25444185
type: Comment

http://stackoverflow.com/q/25416006
has body: I figured this would be a simple search on the web but I can't figure this out. Here is what I'm working with so far. Ignore the eventHandler, I know its empty. I want to limit the charField JTextField so that the user can only type one character. I figured this would be easy because of all the apps that limit the amount of numbers you can type when entering State or Zipcode. To be clear, I'm not looking to validate input, I'm looking to limit input. I want it to ignore keystrokes after one character has been entered. package Week6; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import java.io.*; public class Index extends JPanel{ private JLabel searchLabel; private JTextArea searchField; private JLabel charLabel; private JTextField charField; public Index(){ GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NORTH; setBackground(Color.WHITE); super.setLayout(gridbag); searchLabel = new JLabel("Enter text to be searched:"); searchField = new JTextArea("", 5, 20); JScrollPane scroll = new JScrollPane(searchField); searchField.setLineWrap(true); searchField.setWrapStyleWord(true); searchField.setOpaque(true); charLabel = new JLabel("Exter a character:"); charField = new JTextField("", 5); c.insets = new Insets(10, 10, 10, 10); c.gridx = 0; c.gridy = 0; add(searchLabel, c); c.gridx = 1; c.gridy = 0; add(scroll, c); c.gridx = 0; c.gridy = 1; add(charLabel, c); c.gridx = 1; c.gridy = 1; add(charField, c); CharHandler charhandler = new CharHandler(); charField.addActionListener(charhandler); } class CharHandler implements ActionListener{ public void actionPerformed(ActionEvent e){ } } }
linked to: http://stackoverflow.com/q/21572407
has answer: http://stackoverflow.com/a/25416046
type: AnsweredQuestion
score: 1
tagged with: validation
tagged with: java
duplicate of: http://stackoverflow.com/q/21572407
answer count: 1
linked to: http://stackoverflow.com/q/6146274
upvote count: 1
tagged with: jtextfield
favorite count: 0
type: Question
has title: Limit the amount of characters typed into a JTextField
downvote count: 0
tagged with: input
tagged with: swing
accepted answer: http://stackoverflow.com/a/25416046

http://stackoverflow.com/q/25541150
tagged with: playframework
type: UnansweredQuestion
has title: Playframework : How to share models between different projects?
tagged with: jpa
linked to: http://stackoverflow.com/q/6380728
downvote count: 0
has answer: http://stackoverflow.com/a/25623071
has comment: http://stackoverflow.com/comment/39886067
has comment: http://stackoverflow.com/comment/39968982
score: 3
has body: I want to share my Models with some other projects, they use the same models but not the same field mappings and constraints. I wonder if there is way to extract annotations from models and use xml configuration instead ? Or other way to achieve this ? NOTE : I'm using play 1.3.
linked to: http://stackoverflow.com/q/7442735
upvote count: 3
tagged with: java
tagged with: hibernate
answer count: 1
favorite count: 0
type: Question

http://stackoverflow.com/a/25598129
downvote count: 0
answers question: http://stackoverflow.com/q/25511761
upvote count: 5
type: Answer
score: 5
has body: your error is probably exactly what it says in your exception: a ConversionFailed Exception caused by someone/something trying to convert from ArrayList to a LinkedHashMap; but there is just no fitting converter for that (ConverterNotFoundException). where exactly this is happening is impossible to say since you only posted very little code. i can not find the String "myString" in your code, yet it is mentioned in the error. Is there a standard approach to dealing with this? spring data usually uses converters in its mapping process. to have more control over the mapping process some people prefer to implement and register a custom converter for their classes. you can read about converters here http://docs.spring.io/spring-data/data-mongo/docs/current/reference/html/mongo.core.html#mongo.custom-converters and here http://docs.spring.io/spring/docs/current/spring-framework-reference/html/validation.html#core-convert maybe this will already be enough for you to fix the error yourself. Edit: a short comment about this line: potentialCandidatesObj.setPotentialcandidates((DBObject)JSON.parse(valStr)); you are casting to DBObject before calling the setter, because the setter takes a DBObject. this is bad, you should create another setter for JSON and do the casting there, or you will end up doing that casting operation everywhere in your code; that's not very DRY. there is also something called DBRefs in spring data: The mapping framework doesn't have to store child objects embedded within the document. You can also store them separately and use a DBRef to refer to that document. When the object is loaded from MongoDB, those references will be eagerly resolved and you will get back a mapped object that looks the same as if it had been stored embedded within your master document. you might prefer this over a embedded DBObject.

http://stackoverflow.com/a/25394421
type: Answer
has comment: http://stackoverflow.com/comment/39607033
score: 0
has comment: http://stackoverflow.com/comment/39615337
answers question: http://stackoverflow.com/q/25390830
has body: Try Apache Santuario: Apache XML Security for Java: This library includes the standard JSR-105 (Java XML Digital Signature) API, a mature DOM-based implementation of both XML Signature and XML Encryption, as well as a more recent StAX-based (streaming) XML Signature and XML Encryption implementation. So it should be compatible with the Java SE implementation of digital signature, both have been derived from JSR-105. The standalone development implementation has been removed from the Oracle site, unfortunately.
has comment: http://stackoverflow.com/comment/39612393

http://stackoverflow.com/a/25500497
score: -1
has body: SQL Query string in rawQuery() should not be ; terminated. Check below link. http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#rawQuery(java.lang.String, java.lang.String[], android.os.CancellationSignal) Remove ; from your query string.
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/25500372
has comment: http://stackoverflow.com/comment/39803913
type: Answer

http://stackoverflow.com/comment/39805573
has text: You are right. And syntactically fetish :D but isn't "success" showing cleaner that you can put a custom string to target a custom result ?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25501285

http://stackoverflow.com/comment/39845614
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25522770
has text: @reporter Sometimes the query fails,at other times it works perfectly...
score: 0

http://stackoverflow.com/q/25448052
possible better answer: http://stackoverflow.com/a/27744759
has answer: http://stackoverflow.com/a/25461171
favorite count: 0
has comment: http://stackoverflow.com/comment/39705916
has answer: http://stackoverflow.com/a/27744759
type: Question
has comment: http://stackoverflow.com/comment/39712262
has comment: http://stackoverflow.com/comment/39711260
downvote count: 0
upvote count: 1
tagged with: tomcat7
tagged with: tomcat
has comment: http://stackoverflow.com/comment/39705788
has title: Why does Tomcat 7 server stop on Ubuntu?
has comment: http://stackoverflow.com/comment/39705910
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39705868
answer count: 3
accepted answer: http://stackoverflow.com/a/25461171
score: 1
has answer: http://stackoverflow.com/a/41028637
has comment: http://stackoverflow.com/comment/39705847
has body: I have a Digital ocean instance, on which Tomcat7 server is running. Sometimes it shuts itself down for reasons I don't know. That is, I launch it, work a bit with it, then do nothing with it for several days. Then I try to connect to it, but it's not available and I have to restart it (sudo service tomcat7 restart). I expect it to work (be available) 24/7, unless I shut it down manually. I don't see any stack traces of errors in the log files. What may be the reason for the server to shut down after a time of inactivity?
has comment: http://stackoverflow.com/comment/39705776

http://stackoverflow.com/comment/39811307
score: 0
type: Comment
type: QuestionComment
has text: @user3807304 Post complete stack trace
comment on: http://stackoverflow.com/q/25502454

http://stackoverflow.com/a/25507956
answers question: http://stackoverflow.com/q/25481782
has body: Unreachable instances should be removed by Garbage Collector and are certainly not a reason for OutOfMemoryError. This error happens when your application has too many objects, that are reachable from GC roots and thus GC cannot throw them away. More information can be found here: Plumbr encyclopaedia. In order to find root cause for memory leak or any memory exhaustion situation, it is usually much easier to use some specialised tool, such as Plumbr or Eclipse memory analyzer.
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25481782
downvote count: 0
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25549387
has comment: http://stackoverflow.com/comment/39894144
has body: There are a lof of topic already opened/answered for this question. Check these links using javascript in android webview Android Calling JavaScript functions in WebView Basic is binding your WebView injecting a javascript into the webpage, then you can call your java function in webpage with normal javascript.
answers question: http://stackoverflow.com/q/25549265
has comment: http://stackoverflow.com/comment/39894722
score: 0
type: Answer

http://stackoverflow.com/q/25426170
tagged with: jersey
has comment: http://stackoverflow.com/comment/40163929
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25767146
downvote count: 0
score: 3
upvote count: 3
has body: I'm using MOXy to unmarshall incoming JSON to my Jersey API. I have a POJO with three properties: databaseName, initialQuery, and runQueryAsUser. I have a client sending me a POST where the JSON has an additional property that I don't need, secureQuery. When the value of secureQuery is null, MOXy spits back a null object. When the value of secureQuery is the empty string, MOXy returns a valid object with the three properties set and secureQuery correctly ignored. The only annotation the POJO has is @XmlRootElement(name = "InitialQuery"). Is this a bug, or is there a setting somewhere I have to flip? Method Signature: public Response createSecuredQuery(final InitialQueryBean initialQuery) { Null InitialQuery object: { "databaseName":"MyDatabase", "initialQuery":"select 1", "runQueryAsUser":"bob", "secureQuery":null } Good InitialQuery object: { "databaseName":"MyDatabase", "initialQuery":"select 1", "runQueryAsUser":"bob", "secureQuery":"" }
tagged with: java
has comment: http://stackoverflow.com/comment/40163952
has comment: http://stackoverflow.com/comment/40158922
tagged with: moxy
has answer: http://stackoverflow.com/a/25715394
favorite count: 0
type: Question
has title: Unmarshalling JSON with unknown property with null value
has comment: http://stackoverflow.com/comment/40104004
has comment: http://stackoverflow.com/comment/91565341
answer count: 2

http://stackoverflow.com/comment/39860805
score: 0
comment on: http://stackoverflow.com/q/25450452
type: QuestionComment
has text: @AlexPoole Time is not stripped in `java.sql.Date`, that is up to the driver; if the Oracle driver isn't doing that, it is a bug in the driver.
type: Comment

http://stackoverflow.com/a/25510859
has comment: http://stackoverflow.com/comment/39823793
has comment: http://stackoverflow.com/comment/39823841
score: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39823911
has body: you have 3 loops here. about 300 operations each. thats O(n^3), for 300 its about 27000000 operations!
type: Answer
answers question: http://stackoverflow.com/q/25510808

http://stackoverflow.com/a/25426077
answers question: http://stackoverflow.com/q/25407226
downvote count: 0
upvote count: 1
has body: You're getting this error because the serialization occurs outside the persistence context. When a select is performed on the User entity, the query does not retrieve the field (or associated entities) accesstokens. Instead, the field is replaced with a proxy, which will be used to retrieve data from database when the property accesstokens is accessed. If you access the accesstokens property before committing your transaction, you will not have any issue because the session is still active. However, in your case, the session is not active when the User objects are being serialized. One possible solution would be to load the required data before serialization occurs.
type: Answer
score: 1

http://stackoverflow.com/a/62328658
type: Answer
answers question: http://stackoverflow.com/q/25431380
upvote count: 6
has body: Adding LoggingPreferences to "goog:loggingPrefs" properties with the Chrome Driver options can help to fetch the Browser console logs for all Log levels. ChromeOptions options = new ChromeOptions(); LoggingPreferences logPrefs = new LoggingPreferences(); logPrefs.enable(LogType.BROWSER, Level.ALL); options.setCapability("goog:loggingPrefs", logPrefs); WebDriver driver = new ChromeDriver(options);
score: 6
downvote count: 0

http://stackoverflow.com/comment/39758348
type: Comment
has text: @Makoto When you write _logger.debug_ or _logger.trace_, _log4j_ does it for you. I was referring to the case when you have **code** that you only want to execute while debugging. I am under the impression that this was the question.
comment on: http://stackoverflow.com/a/25463711
score: 0
type: AnswerComment

http://stackoverflow.com/q/25539285
score: 1
upvote count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25540042
answer count: 1
has comment: http://stackoverflow.com/comment/39876106
has comment: http://stackoverflow.com/comment/39876144
has comment: http://stackoverflow.com/comment/39876293
tagged with: maven-3
has comment: http://stackoverflow.com/comment/39876764
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39876934
has comment: http://stackoverflow.com/comment/39876455
has comment: http://stackoverflow.com/comment/39876071
has answer: http://stackoverflow.com/a/25540042
has body: I have a project with two packages. Let's call it Package1 and Package2. Package1 has a method that invokes a method in Package2. How do I set dependency in Maven? If I just run the test in Package 1 from pom.xml it just says "package Package2 does not exist" and "Cannot find symbol" how do I solve this issue? Project | -----------&gt; Package 1 | -----------&gt; Package 2
tagged with: maven
has comment: http://stackoverflow.com/comment/39877036
has comment: http://stackoverflow.com/comment/39876913
has title: Dependency on a different package inside a project - Maven
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39876733
downvote count: 0

http://stackoverflow.com/comment/39639567
has text: @Bass - Thanks for taking the sarcasm humorously ;). I think Durandal is right... a VM might be a better option for you. Do you have Windows 7 Ultimate? I think there's a VM for XP built into that.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25406646

http://stackoverflow.com/comment/39875159
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25519951
has text: Thanks again, M - your suggestion worked a treat, reduced LoC, and helped me better understand annotation based configuration style.

http://stackoverflow.com/q/25509194
tagged with: jackson
possible better answer: http://stackoverflow.com/a/25509731
score: 2
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/25509731
has body: I have a Pojo that contains one member displayPropsJsonwhich is a clientside json string. It is validated with a JSON schema before storing on the server. i.e. public class Item { Long id; //23 String name; //"itemsName" String displayPropsJson; // "{\"bold\" : true, \"htmlAllowed\" : true, \"icon\" :\"star.jpg\" }" } I'd like the serialized version of this to output the displayPropsJson as displayProps sub object for example: { "id" :23, "name: : "itemsName", "displayProps" : { "bold" : true, "htmlAllowed" : true, "icon" : "star.jpg" } } How can I do this with a Jackson serializer that outputs elements and the json string as json? The displayPropsJson will vary but is always valid json.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39901864
has answer: http://stackoverflow.com/a/25558092
favorite count: 0
type: Question
has title: How can I serialize a Java object that has one member which is a json string
upvote count: 2
has comment: http://stackoverflow.com/comment/39822767
downvote count: 0
accepted answer: http://stackoverflow.com/a/25558092

http://stackoverflow.com/q/25500946
type: UnansweredQuestion
tagged with: swt
score: 0
has comment: http://stackoverflow.com/comment/39804899
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39806773
has comment: http://stackoverflow.com/comment/39805415
type: Question
tagged with: e4
has title: SWT Text block actions outside of the TextField
has body: I have an SWT Text and I want it to have Focus until the User Enters something. Currently I´m using a FocusListener and check at focusLost Event, if the User has entered something. If not, I throw him back to the Text Field. I think this is the wrong way as I don´t want anything to happen which I have to reverse then (e.g. if the user focuses another Part, I have to give focus back to the part with the Text and so on) Does SWT provide me a way of blocking any other action but entering something into the SWT Text? Like a Listener that gets triggered before the action happens and in which I can prevent the action to happen? Like a VerifyListener for every event type?

http://stackoverflow.com/comment/39797264
type: QuestionComment
score: 0
has text: I believe that you would want to use a "modality worklist" to achieve this functionality, but I have no idea if DCM4Chee has an implementation of one for you.
type: Comment
comment on: http://stackoverflow.com/q/25494191

http://stackoverflow.com/comment/39771768
type: QuestionComment
comment on: http://stackoverflow.com/q/25443290
score: 0
type: Comment
has text: Do i need to set these before running jmap -dump (without -live option) or i can use one of these 2 options?

http://stackoverflow.com/a/25500407
has comment: http://stackoverflow.com/comment/39921028
has body: The field won't be formatted while it has focus, trying adding another component to the UI and tabbing focus to it. This means that while in "edit" mode, it will use the editor formatter, but will use the display formatter when it's not import java.awt.BorderLayout; import java.awt.GridLayout; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.text.NumberFormat; import java.util.Locale; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.NumberFormatter; public class TurkisliraFormatterDemo extends JPanel implements PropertyChangeListener { private double amount = 100000; private JFormattedTextField amountField; private NumberFormat amountDisplayFormat; private NumberFormat amountEditFormat; public TurkisliraFormatterDemo() { super(new BorderLayout()); setUpFormats(); amountField = new JFormattedTextField( new DefaultFormatterFactory( new NumberFormatter(amountDisplayFormat), new NumberFormatter(amountDisplayFormat), new NumberFormatter(amountEditFormat))); amountField.setValue(new Double(amount)); amountField.setColumns(10); amountField.addPropertyChangeListener("value", this); JPanel fieldPane = new JPanel(new GridLayout(0, 1)); fieldPane.add(amountField); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); add(fieldPane, BorderLayout.LINE_END); add(new JButton("Hello"), BorderLayout.SOUTH); } public void propertyChange(PropertyChangeEvent e) { Object source = e.getSource(); if (source == amountField) { amount = ((Number) amountField.getValue()).doubleValue(); System.out.println("amount = " + amount); // amountField.setValue(amount); } } private static void createAndShowGUI() { JFrame frame = new JFrame("FormatDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.…
type: Answer
answers question: http://stackoverflow.com/q/25500167
score: 4
has comment: http://stackoverflow.com/comment/39804040
has comment: http://stackoverflow.com/comment/39804480
accepted answer of: http://stackoverflow.com/q/25500167
has comment: http://stackoverflow.com/comment/39803843
has comment: http://stackoverflow.com/comment/39803857
has comment: http://stackoverflow.com/comment/39803943
has comment: http://stackoverflow.com/comment/39921296
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39920847
upvote count: 4
has comment: http://stackoverflow.com/comment/39804398

http://stackoverflow.com/comment/39769967
has text: From your code I can not see why you think this is happening on a remote machine. Looks like this is all local to me...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25480295
type: Comment

http://stackoverflow.com/q/25448425
has body: I've got the following scenario: An application is being functional-tested using selenium. One action performed on the interface results in sending an email to a particular address, which can be manually set to some value. It works fine. And now, I'd like my selenium tests to check for that email. How to achieve this without having to use real server? I mean this has to be a real server but it has to listen on localhost and start from java. I don't think tools like dumbster or greenmail fits in here, do they? From what I have read in the documentation they are not accessible outside the running application. Is there such tool? Thanks!
has answer: http://stackoverflow.com/a/25448812
score: 0
has title: Need a SMTP test server for integration tests (selenium)
tagged with: java
tagged with: email
has comment: http://stackoverflow.com/comment/39706735
tagged with: selenium
has comment: http://stackoverflow.com/comment/39717320
type: Question
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/comment/39709705
type: QuestionComment
comment on: http://stackoverflow.com/q/25449483
score: 0
has text: What's the point, seriously? Everybody has phones, computers, tablets. Why would you annoy people by disconnecting them when they connect using another of their browsers?
type: Comment

http://stackoverflow.com/comment/39743612
comment on: http://stackoverflow.com/a/25467278
score: 0
type: AnswerComment
has text: That's what I thought :). Did I answer your question?
type: Comment

http://stackoverflow.com/comment/39717803
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25453980
has text: @MikeStrobel Agreed. I concentrated my answer on visibility issues and completely ignored the rest. You should post that as an answer. I'd upvote it.

http://stackoverflow.com/q/25537634
tagged with: jquery
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25538098
has comment: http://stackoverflow.com/comment/39873128
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39873380
score: 1
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25538098
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39873226
has body: Can't understand why this code always prints in console "Error!". Here is my Spring controller @RequestMapping("/spinner") public class SpinnerController { @RequestMapping(method = RequestMethod.GET, produces = "application/json") public @ResponseBody String spinner() throws InterruptedException { Thread.sleep(10); return "answer"; } } And my JS script: function sendRequest() { $.ajax({ url: '/spinner', type: 'get', contentType: "application/json", success: function (resp) { alert("Yeah!"); console.log(resp); }, error: function (){ console.log("Error!"); } } ); } And JSP page: Press me! Greeting! Any ideas why I get an error? UPD Here is log for script's method error error: function (jqXHR, textStatus, errorThrown) { console.log(jqXHR); console.log(textStatus); console.log(errorThrown); } Console output: [object Object] send.js:14 parsererror send.js:15 SyntaxError: Unexpected token a UPD2 Fixed with adding this code: @RequestMapping(method = RequestMethod.GET, produces = "application/json") public @ResponseBody Answer spinner() throws InterruptedException { Thread.sleep(10); return new Answer("info"); } public class Answer { private String data; public Answer(String data) { this.data = data; } public Answer() { } public String getData() { return data; } public void setData(String data) { this.data = data; } }
has comment: http://stackoverflow.com/comment/39873560
favorite count: 0
type: Question
tagged with: ajax
has comment: http://stackoverflow.com/comment/39873417
has title: Ajax request doesn't work with Spring controller
tagged with: javascript

http://stackoverflow.com/comment/39712850
type: QuestionComment
comment on: http://stackoverflow.com/q/25437812
has text: This is the task: http://pastebin.com/iPF5A0d1
score: 0
type: Comment

http://stackoverflow.com/comment/39705460
score: 0
type: QuestionComment
has text: Full GC can also be triggered to satisfy allocation in PermGen. Since you've recently asked about PermGen problems, I assume that's the case.
comment on: http://stackoverflow.com/q/25443290
type: Comment

http://stackoverflow.com/comment/39716459
score: 0
comment on: http://stackoverflow.com/a/25453305
type: Comment
type: AnswerComment
has text: @user3880721 A "firm verification" of what? That you can't call methods on a type, outside of that type, that aren't exposed by that type? `g2` is a `HelloWorld`.

http://stackoverflow.com/comment/39679753
has text: @javalearner: By *"enable debugging"* I mean on the *server* side...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25432443
score: 0

http://stackoverflow.com/q/25491183
has comment: http://stackoverflow.com/comment/39796764
possible better answer: http://stackoverflow.com/a/25491238
has body: I would like to find same word in two string. startpoint = newresult.indexOf('\''); endpoint = newresult.lastIndexOf('\''); variables = newresult.substring(startpoint, endpoint); variables = variables.replace("\r\n", ","); variables = variables.replaceAll("'", "");` String variables: cons,john,$,alex,manag; String second: ins_manages(john,cons) As it is seen, both strings they have john and cons and I want to check if both have same char sequences or not but I don't know how it can be checked? Is there any way to check it directly? Solution: String [] newvar; newvar = variables.split(","); After that, I used a for loop and matched them one by one. BR
has comment: http://stackoverflow.com/comment/39796758
tagged with: string
tagged with: match
favorite count: 0
has answer: http://stackoverflow.com/a/25498849
type: Question
tagged with: indexof
has comment: http://stackoverflow.com/comment/39789264
has answer: http://stackoverflow.com/a/25491238
accepted answer: http://stackoverflow.com/a/25498849
upvote count: 2
has comment: http://stackoverflow.com/comment/39788525
type: AnsweredQuestion
score: 2
answer count: 2
tagged with: contains
has title: Find the same word in two different strings
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/18715688

http://stackoverflow.com/comment/39896304
comment on: http://stackoverflow.com/q/25550474
type: QuestionComment
has text: are there any static initializer blocks inside `CheckTreeTableSelectionListener`?
type: Comment
score: 1

http://stackoverflow.com/comment/39679466
type: QuestionComment
has text: Well then use your sorter to sort the data the way you want. Did you have a question?
type: Comment
comment on: http://stackoverflow.com/q/25431477
score: 0

http://stackoverflow.com/comment/39793234
score: 0
comment on: http://stackoverflow.com/q/25494322
has text: What should this be doing instead of generating an error? What is your goal here, and how did you try to fix it?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25534100
accepted answer: http://stackoverflow.com/a/25534207
favorite count: 0
type: Question
tagged with: event-dispatch-thread
has comment: http://stackoverflow.com/comment/39865814
tagged with: jframe
score: -2
has answer: http://stackoverflow.com/a/25534712
tagged with: swing
has body: I am working on a Java graphical interface (Swing , AWT) . The data entry in my application is supposed to be done via a JFrame. In fact I have 10 entities that necessitate 10 JFrames. I used a for loop but JFrames don't seem to wait until data entry. I used Thread.sleep() but in vain. Any help? Here is some of my code: for (int i=0; i &lt; VMnumber; i++) // VMnumber : number of virtual machines to instantiate { mips=0; frame=new VMcaracteristics(); // VMcaracteristics is a JFrame to enter VMs caracteristics frame.setVisible(true); while (!VMcaracteristicsFlag) // Current frame is still open { Thread.sleep(100); } // create a VM correspondent to the current frame vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared()); vmlist.add(vm); }
has comment: http://stackoverflow.com/comment/39865807
has answer: http://stackoverflow.com/a/25534207
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39866674
answer count: 2
tagged with: thread-sleep
possible better answer: http://stackoverflow.com/a/25534712
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/39865804
upvote count: 1
has title: Java GUI application

http://stackoverflow.com/q/25478376
favorite count: 0
type: Question
upvote count: 2
has title: Java anti fillRect (fill everything outside of said rectangle)
has body: In Java, there is the Graphics2D.fillRect(x, y, width, height) function. In my program, I am looking for something similar, yet completely opposite. I need to fill everything on the screen except this certain x, y, width, height, sort of like an anti-fillRect. Is there a built in function that I am overlooking, or can you point me in the right direction to create one? Not required, but it would be a nice bonus if it could work with other Java 2D shapes.
has comment: http://stackoverflow.com/comment/39763011
downvote count: 0
accepted answer: http://stackoverflow.com/a/25478513
has answer: http://stackoverflow.com/a/25478513
score: 2
type: AnsweredQuestion
tagged with: graphics2d
tagged with: java
has comment: http://stackoverflow.com/comment/39763016
answer count: 1

http://stackoverflow.com/comment/39837775
score: 0
comment on: http://stackoverflow.com/q/25518395
has text: These two lines: Intent dashboardIntent = new Intent(context, Dashboard.class); startActivity(dashboardIntent);
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25403291
type: Question
has title: How to get logs from current thread only in log4j
has body: I want to intercept logs from the specific thread in my application for the certain period of time. I'm using log4j. The code below does that, but I'm getting logs from others threads too. WriterAppender appender = new WriterAppender(new PatternLayout("%d{ISO8601} %p - %m%n"), consoleWriter); appender.setName("STR_APPENDER"); appender.setThreshold(org.apache.log4j.Level.INFO); Logger.getRootLogger().addAppender(appender); //Some Logic here (I'm using other classes and jars here and I want to get this logs as well) Logger.getRootLogger().removeAppender("STR_APPENDER"); I'm aware that Logger.getRootLogger() is not a good solution here, but I don't have any other idea.
score: 0
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/39622812
downvote count: 1
tagged with: logging
favorite count: 0
has answer: http://stackoverflow.com/a/25403478
tagged with: java
answer count: 1
tagged with: log4j

http://stackoverflow.com/a/25479489
score: 1
type: Answer
has body: Does it save memory? No, it uses more memory. Because now every instance of Example has an inaccessible field Object. And calling get on it replaces the current local value with a new value before returning the new reference. Meaning the old reference is irrelevant.
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25479468

http://stackoverflow.com/a/25483894
has body: Change the data types of donut and milk to double. So that it will return the double value instead of int. See this question for more details Integer division: How do you produce a double?
upvote count: 3
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/25483872
type: Answer

http://stackoverflow.com/a/75738217
has comment: http://stackoverflow.com/comment/133683917
has comment: http://stackoverflow.com/comment/133734557
has comment: http://stackoverflow.com/comment/133738217
has comment: http://stackoverflow.com/comment/133608608
type: Answer
has comment: http://stackoverflow.com/comment/133733792
answers question: http://stackoverflow.com/q/25407656
score: 0
has comment: http://stackoverflow.com/comment/133740499
has body: There are cases where java does not inline static final constants. And the reflection behavior is different between Java versions (such as getting modifiers field will fail in modern Java), however there's something that stayed consistent between Java versions - sun.misc.Unsafe. You can use it to modify value of any field and bypass all of access modifiers. public static void setStaticObjectUnsafe(final Field field, Object value) { final Object staticFieldBase = theUnsafe.staticFieldBase(field); final long staticFieldOffset = theUnsafe.staticFieldOffset(field); theUnsafe.putObject(staticFieldBase, staticFieldOffset, value); } For primitives it's the same except you need to replace value parameter and putObject with it's alternative for primitive type: public static void setStaticIntegerUnsafe(final Field field, int value) { final Object staticFieldBase = theUnsafe.staticFieldBase(field); final long staticFieldOffset = theUnsafe.staticFieldOffset(field); theUnsafe.putInt(staticFieldBase, staticFieldOffset, value); } To get unsafe instance see this solution. If you are using Eclipse IDE you will need to tweak compiler settings in preferences: Java -> Compiler -> Errors/Warnings -> Set "Forbidden reference (access rules)" to Ignore
has comment: http://stackoverflow.com/comment/133738176
has comment: http://stackoverflow.com/comment/133739583
has comment: http://stackoverflow.com/comment/133686911
has comment: http://stackoverflow.com/comment/133646853
has comment: http://stackoverflow.com/comment/133647812
has comment: http://stackoverflow.com/comment/133738789
has comment: http://stackoverflow.com/comment/133738880

http://stackoverflow.com/comment/39756499
comment on: http://stackoverflow.com/q/25474075
score: 0
has text: There is no "assets" dir, but there is also none in the jar that works.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25490311
tagged with: swing
accepted answer: http://stackoverflow.com/a/25490497
has title: System running services in combobox
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25490497
has comment: http://stackoverflow.com/comment/39785242
tagged with: java
answer count: 1
upvote count: 1
score: 1
tagged with: combobox
favorite count: 0
type: Question
has body: To see running services i do this: try { Process p = Runtime.getRuntime().exec("net start"); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String text; while ((text=in.readLine())!=null){ System.out.println(text); } in.close(); } catch (IOException ex) { Logger.getLogger(GestionProcesos.class.getName()).log(Level.SEVERE, null, ex); } Now using GUI designer from NetBeans I want to place each resulting line as an element of an comboBox, how do i do the comboBox.setModel to display a list of the running services?
downvote count: 0

http://stackoverflow.com/a/25422718
has comment: http://stackoverflow.com/comment/42849030
downvote count: 0
score: 40
upvote count: 40
answers question: http://stackoverflow.com/q/25422255
has comment: http://stackoverflow.com/comment/112292219
type: Answer
has comment: http://stackoverflow.com/comment/89199373
has body: Your original method can return ResponseEntity (doesn't change your method behavior): @RequestMapping(value = VIDEO_DATA_PATH, method = RequestMethod.GET) public ResponseEntity getData(@PathVariable(ID_PARAMETER) long id, HttpServletResponse res) { ... } and return the following: return new ResponseEntity(HttpStatus.NOT_FOUND);
has comment: http://stackoverflow.com/comment/102344350

http://stackoverflow.com/comment/39867098
score: 0
comment on: http://stackoverflow.com/q/25517486
type: Comment
type: QuestionComment
has text: @inner_class7...ok lemme try API 17...I also believe its because of shareAction provider..

http://stackoverflow.com/comment/39884612
type: AnswerComment
comment on: http://stackoverflow.com/a/25543075
type: Comment
has text: well you said you don't want to use mocks...? Mocking is good for unit tests and can be a time saver, that's why I mentioned Mockito which does that for you. Technically when you use an in-memory DB it's not a unit test unless you're testing your DB layer. Interfaces and factories are very handy not only for unit tests. BUT as I mentioned using a real DB for small integration test can save your bottom in many cases.
score: 0

http://stackoverflow.com/a/25395638
score: 4
has body: You can get the current working directory as File cwd = new File("./"); If you then need to make this into an absolute path there is cwd.getAbsolutePath(); You can create a new directory there with File newDir = new File(cwd, "newDirectory"); newDir.mkdir(); But my code is somewhere else: /home/root/...../project/class.java The current working directory is (usually) the directory where you start Java from. This is completely unrelated to where the jar files are, and this in turn is completely unrelated to where the source code is. You need to set the current working directory properly when you start the Java program (not the compiler). If you start from a shell, cd to where you need it to be. If you start from an IDE, there should be a setting.
has comment: http://stackoverflow.com/comment/39609467
type: Answer
has comment: http://stackoverflow.com/comment/39609459
upvote count: 4
answers question: http://stackoverflow.com/q/25395625
has comment: http://stackoverflow.com/comment/39609371
downvote count: 0

http://stackoverflow.com/q/25426272
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25426318
tagged with: jsp
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: excel
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/25426628
has title: writing data to csv file
has body: I want to color the first row of csv file as first row contains header and i want to show it separately for user convenience.
linked to: http://stackoverflow.com/q/1755509
tagged with: javascript
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25426340
has comment: http://stackoverflow.com/comment/39665569

http://stackoverflow.com/comment/39781427
comment on: http://stackoverflow.com/a/25488353
type: Comment
type: AnswerComment
has text: I'd check the API docs for the version of the SDK you are using. Though I will add that double-encoding params is just a maintenance nightmare. I'm not in love with my answer.
score: 0

http://stackoverflow.com/comment/39598918
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25389891
score: 1
has text: You are printing the array references. IF You want to print thw content of the arrays use Arrays.toString()

http://stackoverflow.com/comment/62321586
comment on: http://stackoverflow.com/a/36836497
type: AnswerComment
has text: I originally tried to do as you said,but it would only receive the first callback. `I/chromium: [INFO:CONSOLE(268)] "First success", source: file:///android_asset/www/build/js/app.bundle.js (268) W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection D/CordovaInterfaceImpl: Sending activity result to plugin W/CordovaPlugin: Attempted to send a second callback for ID: Bluetooth435896053 Result was: "Third success"`
score: 0
type: Comment

http://stackoverflow.com/comment/50195540
comment on: http://stackoverflow.com/a/25505166
score: 2
has text: THANK YOU VERY MUCH. You solved me a big issue. I wish I could invite you to coffee. Around London?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39638840
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25409099
has text: here's my problem: class HT_plane_FD_T in C:\Program Files\Java\jdk1.6.0_01\bin use package "jahuwaldt" and use class Plot3D in the same classpath whene i put >>package jahuwaldt.plot; in HT_plane_FD_T class i have error >> cannot find symbol Plot3D
type: Comment

http://stackoverflow.com/q/25425893
has answer: http://stackoverflow.com/a/25449510
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/25426818
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39666633
has body: I have an application built upon Spring Boot. There is simple controller with a method which creates new Thread and starts it. However a runnable executes unix command (nc) (used ProcessBuilder for that). Thus when I'm runnning it on the windows I get exceptions from started thread. Indeed it can not run unix program. Now I would like to write a test for this controller, but I'm wondering is it possible and reasonable. I was thinking about changing behaviour of runnable task just for testing, although I don't know how can it be done. Thanks for any help and other ideas/solutions for this case. Controller: @Controller public class TaskController { ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(task-%d").build(); @RequestMapping(value = "/startTask") public @ResponseBody ResponseEntity&lt;String&gt; startTask() { Runnable runnable= new Task(); threadFactory.newThread(runnable).start(); return new ResponseEntity&lt;String&gt;("Task started", HttpStatus.ACCEPTED); } } Task: public class Task implements Runnable { @Override public void run() { // start unix process } } Application class: @ComponentScan @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } Integration Test: @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration @IntegrationTest("server.port=0") @DirtiesContext public class ApplicationTest { @Value("${local.server.port}") private int port; @Test public void shouldStartTask() throws Exception { // when ResponseEntity&lt;String&gt; entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port + "/startTask", String.class); // then assertThat(entity.getStatusCode()).isSameAs(HttpStatus.ACCEPTED); } }
has title: how to test method that starts new thread which may fail due to operating system
type: Question
tagged with: testing
answer count: 2

http://stackoverflow.com/q/25521715
has answer: http://stackoverflow.com/a/25521959
has title: URLConnection in java
type: AnsweredQuestion
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25521935
possible better answer: http://stackoverflow.com/a/25521825
accepted answer: http://stackoverflow.com/a/25521935
tagged with: java
has answer: http://stackoverflow.com/a/25521825
has body: I have a ArrayList containing list of websites in this format:- google.com facebook.com youtube.com yahoo.com wikipedia.org t.co And I have to read html text from all the links. But some links are creating problem like (t.co) and other are working fine. Code:- try { String line="t.co"; String[] Add_words = line.split("[//:.]"); if (Add_words[0].contains("http")) { } else if (Add_words[0].contains("www")) line = "http://" + line; else if (!Add_words[0].contains("http") &amp;&amp; !Add_words[0].contains("www")) line = "http://www." + line; URL url = new URL(line); URLConnection urlConnection = url.openConnection(); HttpURLConnection connection = null; if(urlConnection instanceof HttpURLConnection) { connection = (HttpURLConnection) urlConnection; } else { System.out.println("Please enter an HTTP URL."); return; } BufferedReader in = new BufferedReader( new InputStreamReader(connection.getInputStream())); String urlString = ""; String current; while((current = in.readLine()) != null) { urlString += current+"\n"; } System.out.println(urlString); }catch(IOException e) { e.printStackTrace(); } And I'm getting the error with the last link `t.co` error:- java.io.FileNotFoundException: http://www.t.co at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1834) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439) at com.test.code.Main.main(Main.java:109) What i need is, I have list of link in above format and my code should access all the link, whatever the link format will be.
type: Question

http://stackoverflow.com/a/25438911
answers question: http://stackoverflow.com/q/25438897
type: Answer
upvote count: 2
downvote count: 0
has body: bulletHolder is an ArrayList that contains arrays of Bullet, so to get to x member of Bullet you have to add an array index : bulletHolder.get(i)[index].x
score: 2

http://stackoverflow.com/comment/39769052
score: 0
has text: Thanks very much. Yeah, It worked after I add this line, "curSum += 1;", and also checked ur codes, it's easier! Thanks very much!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25468165

http://stackoverflow.com/comment/39996426
has text: When I customed Alfresco thanks to graphical user interface, good-practice is also create an AMP or copying the alfresco.war is enough ?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25501560

http://stackoverflow.com/q/25400129
answer count: 2
has body: I'm currently implementing an algorithm that constructs a matrix-pattern based on mathematical formulas. To achieve this I use deeply nested for-loops and alot of if-conditions in it. The problem is, that I cannot split the loop into multiple method without providing a lot of parameters. And for now the code looks like an undesired spaghetti-code. Here is a small pseudo-example: int steps = 10; void evaluate( int numOuterArea , int numInnerArea , int[] solution , int[] factor , int[] indices ) { int counterA = 0; int counterB = 0; for( int outerAreaIter = 0 ; outerAreaIter &lt; numOuterArea ; outerAreaIter++ ) { for( int curOuterAreaIter = 0 ; curOuterAreaIter &lt; steps ; curOuterAreaIter++ ) { for( int innerAreaIter = 0 ; innerAreaIter &lt; numInnerArea ; innerAreaIter++ ) { for( int curInnerAreaIter = 0 ; curInnerAreaIter &lt; curOuterAreaIter ; curInnerAreaIter++ ) { if( curInnerAreaIter == curOuterAreaIter ) { // do something with solution, factor or indices } else if( /* some other fancy condition */) { } ... } } } } // similar nested loops follow here } If I would write classes/methods for each loop or part of a loop, I have to provide all parameters from evaluate() (which can be even more as shown in the example) and also all previous iterators and possible variables. Is there a way/common practice/any hints or advice to rewrite such code in a better way?
tagged with: refactoring
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/25400349
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25400888
has comment: http://stackoverflow.com/comment/39618163
has comment: http://stackoverflow.com/comment/39617537
type: UnansweredQuestion
has title: Java: Refactor nested loops
score: 4
upvote count: 4

http://stackoverflow.com/comment/39670049
has text: Thanks. If my input contains thousands of comma separated strings, would this be an optimal solution? Yes, I tried to construct my regex dynamically but it didnt work for all cases. I checked this stackoverflow article: http://stackoverflow.com/questions/17892284/split-only-after-comma-3-times-appear-in-java
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25428573

http://stackoverflow.com/a/25534165
downvote count: 0
has body: When you say str[j], you are subscripting it, so str[j] is a char. And contains() method cannot be applied on char. What you want to do is probably this : String str = "StackOverflow"; boolean isOPresent = str.contains('O'); System.out.println(isOPresent); // will print true
answers question: http://stackoverflow.com/q/25533978
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/39866017

http://stackoverflow.com/comment/39650866
type: Comment
type: QuestionComment
score: 0
has text: @jewelsea I have H.264 ACC video stream. Will it work for this also?
comment on: http://stackoverflow.com/q/25405139

http://stackoverflow.com/q/25526611
favorite count: 0
accepted answer: http://stackoverflow.com/a/25527852
type: Question
has answer: http://stackoverflow.com/a/25527852
tagged with: google-app-engine
upvote count: 8
tagged with: geopoints
possible better answer: http://stackoverflow.com/a/43687707
score: 8
tagged with: search
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39853083
has answer: http://stackoverflow.com/a/43687707
answer count: 2
has body: I'm trying to create a geopoint in my app engine application but when I try to deserialize it I got this annoying message: Uncaught exception from servlet org.codehaus.jackson.JsonParseException: Unexpected end-of-input: expected close marker for OBJECT (from [Source: java.io.StringReader@1a21658; line: 1, column: 0]). This is my JSON code: { "id": 31, "name": "pepe", "mail": "p@p.com", "password": 123, "age":10, "birthday": "01-06-1991", "desc" : " bla bla", "gp": { "latitude": 64.124596, "longitude": -147.8632 } } and this is the declaration of geopoint and my custom deserialize method: GeoPoint gp; public GeoPoint getGp() { return gp; } @JsonDeserialize(using = CustomGeoPintDeserializer.class) public void setGp(GeoPoint gp) { this.gp = gp; } public class CustomGeoPintDeserializer extends JsonDeserializer&lt;GeoPoint&gt; { @Override public GeoPoint deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { System.out.println("ENTRA"); ObjectMapper mapper = new ObjectMapper(); JsonNode actualObj = mapper.readValue(jsonParser.getText(), JsonNode.class); double latitude = actualObj.get("latitude").getDoubleValue(); double longitude = actualObj.get("longitude").getDoubleValue(); return new GeoPoint(latitude,longitude); } }
tagged with: java
has title: Unexpected end-of-input: expected close marker for OBJECT
downvote count: 0
tagged with: jackson

http://stackoverflow.com/a/25524082
upvote count: 1
score: 1
type: AcceptedAnswer
has body: Your SQL query is GET_Objects_REPORT (which is not valid SQL), there is no startDate parameter. You need to use em.createNamedQuery("GET_Objects_REPORT")
has comment: http://stackoverflow.com/comment/39850063
accepted answer of: http://stackoverflow.com/q/25523722
type: Answer
has comment: http://stackoverflow.com/comment/39847755
answers question: http://stackoverflow.com/q/25523722
downvote count: 0

http://stackoverflow.com/q/25412063
has body: What's the correct way of configuring PropertySourcesPlaceholderConfigurer in a Spring-Boot app? I have a property file with: software.version=${project.version} I read the property and don't want Spring to complain about unresolvable ${project.version} because it will later be replaced by Maven. So in my @Configurarion I have: @Configuration @PropertySource("classpath:build.properties") @ComponentScan @EnableAutoConfiguration public class Application { private String softwareVersion; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreUnresolvablePlaceholders(true); return configurer; } @Value("${software.version}") public void setSoftwareVersion(String softwareVersion) { this.softwareVersion = softwareVersion; } } But Spring-Boot seems to ignore setIgnoreUnresolvablePlaceholders(true) and I get the exception: [2014-08-20 13:54:31.888] boot - 3756 ERROR [main] --- SpringApplication: Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'application': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.app.Application.setSoftwareVersion(java.lang.String); nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'project.version' in string value "${project.version}" at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.do…
has comment: http://stackoverflow.com/comment/39640354
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39640097
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/39640211
answer count: 1
has title: Configure bean in Spring-Boot
tagged with: maven
has comment: http://stackoverflow.com/comment/39642316
favorite count: 0
type: Question
tagged with: spring-boot
upvote count: 5
has comment: http://stackoverflow.com/comment/39640534
tagged with: java
has comment: http://stackoverflow.com/comment/39642402
has comment: http://stackoverflow.com/comment/39640270
tagged with: spring
has comment: http://stackoverflow.com/comment/39640318
has answer: http://stackoverflow.com/a/25413795
accepted answer: http://stackoverflow.com/a/25413795

http://stackoverflow.com/q/25507649
type: Question
has comment: http://stackoverflow.com/comment/39817742
accepted answer: http://stackoverflow.com/a/25507891
has title: Java: Can I import an action listener that disables a swing component?
tagged with: swing
type: AnsweredQuestion
score: 0
has body: I have a JButton on an extension of a JForm called MyForm. The button executes quite lengthy code. Amongst this code is 'MyForm.this.setEnabled(false)' to disable the form whilst the button method executes. (And subsequently, 'MyForm.this.setEnabled(true)'.) (I do this because it is the only solution I have found for ensuring that any mouse-clicks during the button's execution are ignored. Otherwise, I've found they queue up and execute immediately afterwards). Can I export this button's code to some other file, for importing into a variety of other forms? EDIT: Code: JButton myButton = new JButton("Button Text"); myButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ MyForm.this.setEnabled(false); ... MyForm.this.setEnabled(true); } });
has comment: http://stackoverflow.com/comment/39817591
has answer: http://stackoverflow.com/a/25507891
has comment: http://stackoverflow.com/comment/39817794
tagged with: java
answer count: 1

http://stackoverflow.com/comment/39783668
score: 0
type: AnswerComment
type: Comment
has text: There are more than one though. This is just an example from the whole big picture. They will all serve the same purpose and do the same thing, just with different features. I'll look into this though! Thanks.
comment on: http://stackoverflow.com/a/25489319

http://stackoverflow.com/a/25457535
has body: Java does not have a way to pass a reference to a primitive. However, in your situation it would probably be better to avoid it anyway: it appears that the four variables are related to each other. When several variables are related, they should be instance variables of a single object. Your object probably looks like a rectangular box that has the origin of (x, y), height h, and width w. Make a class for it, and let the method change that class, or return a new instance: class Rect { private final float x, y, w, h; public float getX() { return x; } public float getY() { return y; } public float getW() { return w; } public float getH() { return h; } public Rect(float x, float y, float w, float h) { this.x = x; this.y = y; this.w = w; this.h = h; } } Then you can write a method returning a new Rect public Rect influence(Rect inputRect) { ... } or make Rect mutable, and let influence modify its values.
upvote count: 2
score: 2
downvote count: 0
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25457460
answers question: http://stackoverflow.com/q/25457460

http://stackoverflow.com/comment/39877569
has text: I am just talking about general object oriented design of classes
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25540019

http://stackoverflow.com/q/25491097
has answer: http://stackoverflow.com/a/25491226
favorite count: 0
type: Question
has body: I am trying to create an input that will Verify the input is an Integer, and that it is positive. Right now i have this. How should i check if the integer is positive EDIT: Also i need it to keep asking until you enter a positive integer /** * pre: none * post: returns a positive integer as entered by the user */ public static int getInput(){ int a; Scanner scan = new Scanner(System.in); System.out.println("Enter Desired Quantity."); while (!scan.hasNextInt()){ //Checks if input is Integer System.out.println("Enter A Positive Integer"); scan.next(); } a = scan.nextInt(); //Assigns entered integer to a return a; //replace with correct code }
has answer: http://stackoverflow.com/a/25491139
has comment: http://stackoverflow.com/comment/39788709
score: -2
accepted answer: http://stackoverflow.com/a/25491226
tagged with: java
has answer: http://stackoverflow.com/a/25491566
linked to: http://stackoverflow.com/q/23021130
has comment: http://stackoverflow.com/comment/39786757
possible better answer: http://stackoverflow.com/a/25491139
type: AnsweredQuestion
downvote count: 4
answer count: 3
upvote count: 2
has comment: http://stackoverflow.com/comment/39786635
has title: How to verify that input is a positive integer in Java

http://stackoverflow.com/a/40835275
has comment: http://stackoverflow.com/comment/69123865
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25482558
has body: the problem on this : Callback> callback Please create one more DAO on your daogenerator called DataPost then on your callback, change it to Callback callback. then inside the DataPost Model add ToMany. @ToMany @JoinEntity(entity = Post.class, sourceProperty = "id", targetProperty = "id") public List&lt;Post&gt; yourPropertyNamefromJSON; //--&gt; to make the name it has to be the same as the JSON response for example : JSON RESPONSE { "success": true, "data": [ { "name": "blah", "description": "blah" }] } public List&lt;Post&gt; data; //--&gt; name have to be data if your mind ask this question : Why it needs 1 more class??? ANSWER: because your JSON start with "{" (Curly Bracket) that is not an array but it start with OBJECT. This should solved your problem!! GOOD LUCK!

http://stackoverflow.com/comment/39743823
comment on: http://stackoverflow.com/a/25467718
type: Comment
score: 0
type: AnswerComment
has text: Right, it's just strange to start thinking in objects after I have been using imperative programming for a whole year, and here, most of the things that I had to code in C are already done here, and as I've been taught to implement algorithms in the most efficient way, I feel that in Java is more difficult to know how fast my program will run if I don't have years of experience. And about what you asked, i was saying it is faster opposed to first making a copy of the object and then storing it

http://stackoverflow.com/q/25447569
type: Question
tagged with: jakarta-ee
has title: Same callable statement variable for two different procedure call in the same method
has comment: http://stackoverflow.com/comment/39705132
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39704779
tagged with: java
tagged with: jdbc
has answer: http://stackoverflow.com/a/25447890
score: 0
answer count: 1
has body: I want to know whether we can call two procedures in same method. Whether it will cause any statement leakage issue like maximum cursors exceeded. ? How to overcome this ? For Example find the below code : cstmt = conn.prepareCall("{call prc_gen_los_schedule_rds(?, ?, ?, ?,?,?)}"); cstmt.setString(1, strOrgCode); cstmt.setString(2, strApplNo); cstmt.setString(3, "D"); cstmt.setString(4, "Y"); cstmt.registerOutParameter(5, 2005); cstmt.registerOutParameter(6, 12); cstmt.execute(); aayuxml = cstmt.getString(5); strUrl = cstmt.getString(6); logger.error("Result is=&gt;" + strOut); logger.error("aayuxml is=&gt;" + aayuxml); if (StringUtils.hasText(aayuxml)) { logger.error("CALLING getAmortEMI===&gt;"); amort = aayu.getAmortXML(aayuxml, strUrl); logger.error("INSTALLMENT====&gt;" + amort); if (StringUtils.hasText(amort)) { cstmt = conn.prepareCall("{call PRC_INS_LOS_SCHEDULE_RDS(?, ?, ?,?)}"); cstmt.setString(1, strOrgCode); cstmt.setString(2, strApplNo); cstmt.setString(3, amort); cstmt.registerOutParameter(4, 12); cstmt.execute(); strOut = cstmt.getString(4); logger.error("strOut=&gt;" + strOut); } else { strOut = "ERROR: webservice return blank xml"; }

http://stackoverflow.com/comment/39678693
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25431477
score: 0
has text: I am using a table sorter @HotLicks

lotus-domino
tags question: http://stackoverflow.com/q/25479687
tags question: http://stackoverflow.com/q/25497762
type: Tag
tags question: http://stackoverflow.com/q/25449155
tags question: http://stackoverflow.com/q/25536165
tag name: lotus-domino
tags question: http://stackoverflow.com/q/25401827
tags question: http://stackoverflow.com/q/25543025

http://stackoverflow.com/comment/39812565
comment on: http://stackoverflow.com/q/25502222
type: Comment
score: 0
type: QuestionComment
has text: No, it isn't.I think I should tell more details. Wait a min.

http://stackoverflow.com/comment/62079750
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25531096
has text: Here is a relevant threda on Oracle forums : https://community.oracle.com/thread/3826309?start=0&tstart=0 Apparently it is intentional and not considered a bug...

http://stackoverflow.com/comment/39714839
has text: Is `data.txt` something you generate at runtime or an asset you include with your app? (Side question I know, but sometimes the solution is better data management)
comment on: http://stackoverflow.com/q/25452535
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25399977
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25399735
has body: The instance of that Object is returned by each of the methods called,the next subsequent method uses that returned instance to operate further. This is internally done by returning this . Example: Object methodFirst(Object ob1) { ob1.doSomeOperations(); return this; } Object methodSecond(Object ob1) { ob1.doSomeOtherOperations(); return this; } the above methods can be called like : Object newObject = oldObject.methodFirst().methodSecond(); A more comprehensive and deep explanation can be found here

http://stackoverflow.com/comment/39625301
has text: Perhaps that was a little unclarity from my side, I didn't try to import them into the new Workspace, just the old one. See, if it was doable, I'd rather not make a new Workspace, as all my setting and shortcuts and preferences would be gone...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25404420
score: 0

http://stackoverflow.com/comment/39684213
type: AnswerComment
has text: @peksak: if your question is about android, add the android tag to your question.
comment on: http://stackoverflow.com/a/25435564
type: Comment
score: 0

http://stackoverflow.com/q/25515724
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/39850993
has comment: http://stackoverflow.com/comment/39833465
has comment: http://stackoverflow.com/comment/39833569
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/39833434
has title: Text Adventure quits after first choice?
upvote count: 0
tagged with: java
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/39833299
favorite count: 0
has answer: http://stackoverflow.com/a/25515941
type: Question
has comment: http://stackoverflow.com/comment/39833329
has body: I am trying to make a simple text adventure game. The game runs, but after you type in the first option it just exits the program like you are done. Here is my code: import java.util.Scanner; public class Adventure { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String c1, c2, c3, c4, c5, c6, c7; System.out.println("What shop do you need to go to? the 'Armor Shop' or the 'Weapon Shop'?"); c1 = keyboard.next(); System.out.println(); if(c1 == "Armor Shop") { System.out.println("Do you need 'Light' or 'Heavy' armor?"); c2 = keyboard.next(); if(c2 == "Light") { System.out.println("Do you want 'Hide' or 'Leather'?"); c4 = keyboard.next(); if(c4 == "Hide") { System.out.println("Here is your hide armor"); } else if(c4 == "Leather") { System.out.println("Here is your leather armor"); } else if(c2 == "Heavy") { System.out.println("Do you want 'Chain' or 'Iron'?"); c5 = keyboard.next(); if(c5 == "Chain") { System.out.println("Here is your chain armor"); } else if(c5 == "Iron") { System.out.println("Here is your iron armor"); } } } else if(c1 == "Weapon Shop") { System.out.println("Do you need a 'Sword' or a 'Bow'?"); c3 = keyboard.next(); if(c3 == "Sword") { System.out.println("Do you want a 'Longsword' or a 'Shortsword'?"); c6 = keyboard.next(); if(c6 == "Longsword") { System.out.println("Here is your longsword"); } else if(c6 == "Shortsword") { System.out.println("Here is your shortsword"); } } else if(c3 == "Bow") { System.out.println("Do you want 'Oak' or 'Elven'?"); c7 = keyboard.next(); if(c7 == "Oak") { System.out.println("Here is your oak bow"); } else if(c7 == "Elven") { System.out.println("Here is your elven bow"); } } } } } } I am new to coding and still learning so any help would be much appreciated. I tried to look everywhere for an answer but could not find one.

http://stackoverflow.com/comment/39675346
type: AnswerComment
comment on: http://stackoverflow.com/a/25431144
score: 0
has text: thanks a lot, but I'm still a little bit confused. Where should I put that ContentValues. Sorry, I'm newbie at this thing.
type: Comment

http://stackoverflow.com/a/25500086
type: Answer
has comment: http://stackoverflow.com/comment/39803397
answers question: http://stackoverflow.com/q/25499874
score: 0
has body: You would have to implement equals() and hascode() as follows: class User{ private int id; private String name; // Setter and getter methods public boolean equals(Object object) { boolean result = false; if (object == null || object.getClass() != getClass()) { result = false; } else { User user = (User) object; if (this.id==user.id) { result = true; } } return result; } public int hashCode(Object o){ return id; } } Now you can simply check for object equality as follows: List&lt;User&gt; users=new Arraylist&lt;&gt;(); User user1=new User(); user1.setId(1); user1.setName("ABC"); users.add(user1); User user2=new User(); user2.setId(2); user2.setName("MNO"); users.add(user2); if(users.contains(user2)) // this would check for a presence of user2 in the list //... Note: equality is got through class User id field. You can choose any field or implement any other logic to it.

http://stackoverflow.com/a/25439206
answers question: http://stackoverflow.com/q/25439091
type: Answer
has body: I am not aware of any such libraries except for some unsafe based serialization framework like kryo; but I doubt if you would need it at all. From all my experience, this wouldn't be a bottleneck of your system. For normal serialization and messaging purpose, you would always serialize your matrix into a byte buffer and that's where the unsafe access could occur. Even with the copy from Java memory into unsafe memory, you could safely achieve very high message throughput and very low latency, talking about easily into gigabyte throughput and microsecond delay. For computational purpose, it sounds very unlikely you have a constantly changing large matrix and you would feed it freshly into the C++ computational layer every time. Such big matrix is usually correlation or sparse based and updating the matrix itself takes probably much longer time than feeding it to C++ side. The only use might be when you are trying to achieve a system with ~1 microseconds delay from end to end; but if that's your purpose, you probably shouldn't start with Java or even C++ anyway.
score: 0

http://stackoverflow.com/comment/39888901
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25536437
has text: hello StriplingWarrior thank you for your input, in your opinion is the logic correct? and is there another way to make the scanner advance past .hasNextDouble. The reason behind the logic is that I read it is better to write code that does not throw errors than to rely on catching them.
score: 0

http://stackoverflow.com/comment/39797196
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25486231
has text: CT images are typically 16-bit greyscale, you will also need to account for Rescale slope/intercept when considering the window/level, all of this will lead to an output of 8-bits for display. For more info see [DICOM Part 3.3](http://medical.nema.org/medical/dicom/2014a/output/pdf/part03.pdf), section "C.8.2.1 CT Image Module".

http://stackoverflow.com/comment/39645062
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25414687
has text: This assumes Java 8, which is slick. So if you have the option, go for this.
score: 2

http://stackoverflow.com/comment/39710849
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25449042
score: 0
has text: If you are working on 1.2.5, than maybe all of my answer may not apply to you since I am using 2.3. You should edit to state this at the beginning of your post.

http://stackoverflow.com/q/25515213
has body: My application is to use nanoHTTPD as an alternative to pressing buttons and keying in text on an Android UI for automation and regression test I currently have a main UI thread and a customized nanoHTTPD running in a different thread. Consider each HTTP request will be serviced very quickly in the UI thread. I think my model could be simplified if I could force nanoHTTPD to NOT start a new thread for each incoming request. I would not mind the blocking I/O model at all for my use cases. I see there is a pluggable strategy for threading. Can the below be modified such that only one web request is active at a time (blocking model)? public static class DefaultAsyncRunner implements AsyncRunner { private long requestCount; @Override public void exec(Runnable code) { ++requestCount; Thread t = new Thread(code); t.setDaemon(true); t.setName("NanoHttpd Request Processor (#" + requestCount + ")"); t.start(); } } I could probably also do more elaborate message queues but "dumbing-down" to nanoHTTPD in one thread seems simplest.
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
downvote count: 0
upvote count: 1
favorite count: 0
has title: nanoHTTPD - How to run as a single background thread in Android?
tagged with: nanohttpd
score: 1
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/41153265
type: Question

http://stackoverflow.com/comment/39875657
score: 0
type: Comment
has text: TransportSlab is a third class I omitted to save space.
type: QuestionComment
comment on: http://stackoverflow.com/q/25539229

http://stackoverflow.com/q/25469495
has answer: http://stackoverflow.com/a/25469807
type: Question
has answer: http://stackoverflow.com/a/25469520
has title: New Object creation best practice (for this situation)
answer count: 2
score: 5
type: UnansweredQuestion
downvote count: 0
favorite count: 0
tagged with: object
has body: I have a basic question regarding some code I'm studying from a book. I am new to the Java language so I want to know the best practice here. Reference the following: https://www.refheap.com/89409 This is just a snippet of the class. There is a line of code in there: Vector2f earth = earthMat.mul(new Vector2f()); I rewrote as the following and all worked just fine: Vector2f earth = new Vector2f(); earth = earthMat.mul(earth); Is the first statement a more optimized approach at doing this? Being new to Java, I'm just trying to understand if one is really better than the other. Systematically, (at least in my mind), the two statements are easier to digest right now. I like to specifically make calls against the object name.
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/39746492

http://stackoverflow.com/a/25524645
has comment: http://stackoverflow.com/comment/39883731
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25521046
has comment: http://stackoverflow.com/comment/39879277
has comment: http://stackoverflow.com/comment/39884711
type: Answer
has body: Reusing the Runnables makes no sense as the problem is not the cost of creating or freeing the runnable instances. These come almost for free in Java. What you want to do is to limit the number of pending jobs which is easy to achieve: just provide a limit to the queue you are passing to the executor service. That’s as easy as passing an int value (the limit) to the LinkedBlockingQueue’s constructor. Note that you can also use an ArrayBlockingQueue then as a LinkedBlockingQueue does not provide an advantage for bounded queue usage. When you have provided a limit to the queue, the executor will reject queuing up new jobs. The only thing left to do is to provide an appropriate RejectedExecutionHandler to the executor. E.g. CallerRunsPolicy would be sufficient to avoid that the caller creates more new jobs while the threads are all busy and the queue is full. After execution, the Runnables are subject to garbage collection.

http://stackoverflow.com/q/25535112
has comment: http://stackoverflow.com/comment/39880132
linked to: http://stackoverflow.com/q/6410839
tagged with: java
has comment: http://stackoverflow.com/comment/39880098
linked to: http://stackoverflow.com/q/16740332
has title: how to highlight the text of a jtable cell?
upvote count: 4
has answer: http://stackoverflow.com/a/25535672
tagged with: jtable
answer count: 2
has body: I have a table containing some data. When i search a text in the textField, the look of the table, changes and the textFields disappears. I dont know why, I dont know If I'm doing it right here's my whole code.. package test; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.EventQueue; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; import javax.swing.text.BadLocationException; import javax.swing.JTextField; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.JScrollPane; import javax.swing.RowFilter; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class test3 extends JFrame { private JPanel contentPane; private JTable table; private TableModel tableModel; private JTextField textField; private String textForSearch; private TableRowSorter&lt;TableModel&gt; sorter; /** * Launch the application. */ public static void main(String[] args) { /** * Create the frame. */ public test3() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 346); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(63, 52, 305, 191); contentPane.add(scrollPane); String columns [] = { "First Name", "Last Name", "Middle Name" }; String data[][] = new String [3][3]; data [0][0] = "denise"; data [0][1] = "alyson"; data [0][2] = "berania"; data [1][0] = "denden"; data [1][1] = "pelesco"; data [1][2] = "pogi"; data [2][0] = "ryan"; data [2][1] = "ewan"; data [2][2] = "santos"; tableModel = new DefaultTableModel(data, columns); table = new JTable(tableModel); scrollPane.setViewportView(table); sorter = new TableRowSorter&lt;TableMo…
type: UnansweredQuestion
downvote count: 0
tagged with: swing
has answer: http://stackoverflow.com/a/25535610
score: 4
linked to: http://stackoverflow.com/q/16814512
favorite count: 0
type: Question

http://stackoverflow.com/q/25414310
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39646673
answer count: 2
downvote count: 0
has body: Does anyone know how to change the values ​​in TableView? I develop with SceneBuilder, so I am afraid, that any tutorial without SceneBuilder can't help me. I tried to put code into the initialize method, which worked in program without SceneBuilder. I also tried to set a method "setOnEditCommit " in SceneBuilder, but the method didn't start even after clicking on a row in the TableColumn. Edit: I tried this in the method initialize: @Override public void initialize(URL url, ResourceBundle rb) { ... //initialize TableViewu javafx.util.Callback<TableColumn, TableCell> cellFactory = new javafx.util.Callback<TableColumn, TableCell>() { @Override public TableCell call(TableColumn p) { return new EditingCell(); } }; vesniceTableColumn.setCellValueFactory(new PropertyValueFactory<Cil, String>("vesnice")); souradniceTableColumn.setCellValueFactory(new PropertyValueFactory<Cil, String>("souradnice")); pocetTableColumn.setEditable(true); pocetTableColumn.setCellValueFactory(new PropertyValueFactory<Cil, Integer>("pocet")); pocetTableColumn.setCellFactory(cellFactory); pocetTableColumn.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<Cil, Integer>>() { @Override public void handle(TableColumn.CellEditEvent<Cil, Integer> t) { ((Cil) t.getTableView().getItems().get(t.getTablePosition().getRow())).setPocet(t.getNewValue()); } }); tableView.setItems(cilVesnice); } or @Override public void initialize(URL url, ResourceBundle rb) { ... //initialize TableViewu vesniceTableColumn.setCellValueFactory(new PropertyValueFactory<Cil, String>("vesnice")); souradniceTableColumn.setCellValueFactory(new PropertyValueFactory<Cil, String>("souradnice")); pocetTableColumn.setEditable(true); pocetTableColumn.setCellValueFactory(new PropertyValueFactory<Cil, Integer>("pocet")); pocetTableColumn.setCellFactory(TextFieldTableCell.<Cil, Integer>forTableColumn(new IntegerStringConverter())); pocetTableColumn.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<Cil, Integer>>() { @Overri…
tagged with: tablecolumn
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39645456
type: Question
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/25433377
score: 1
possible better answer: http://stackoverflow.com/a/25414397
has answer: http://stackoverflow.com/a/25433377
has comment: http://stackoverflow.com/comment/39644553
has answer: http://stackoverflow.com/a/25414397
has title: Editing TableView in JavaFX
tagged with: tableview

http://stackoverflow.com/a/25435106
has comment: http://stackoverflow.com/comment/39686834
has body: @Jarrod Roberson is right. You should use: Process p = Runtime.getRuntime().exec("reg add HKCU\\Software\\Microsoft\\Windows /v mykey /t REG_SZ /d " + "key_value");
has comment: http://stackoverflow.com/comment/39686918
has comment: http://stackoverflow.com/comment/39686040
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25434401
has comment: http://stackoverflow.com/comment/39685373
has comment: http://stackoverflow.com/comment/39686417
upvote count: 1
answers question: http://stackoverflow.com/q/25434401
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/39685892

http://stackoverflow.com/a/25435521
type: Answer
answers question: http://stackoverflow.com/q/25435312
score: 0
has comment: http://stackoverflow.com/comment/39684546
has comment: http://stackoverflow.com/comment/39686403
has comment: http://stackoverflow.com/comment/39684064
has body: Take a look at This code: if ((category_name1).equals(temp_category_name) ) { category_name1=""; ///HERE IS YOUR PROBLEM!!! } .... .... temp_category_name=category_name1; ///PROBLEM ABOVE MESSES THIS UP. Setting category_name1 to empty string when its equal to the last category, and then setting the last category for the next iteration to category_name1 which is now empty string, ensures that if the category occurs more than twice, the name is going to get printed again. Instead of setting category_name1 to empty string you could use an if-statement to print it as an empty string but leave the real value in the variable. There are other problems with this code, but this is the main one. Also, someone on here will inevitably tell you "Don't use scriptlets, use JSTL." As for the record count. The way you're doing it, you would have to display the record count at the end of the category, not the beginning.

http://stackoverflow.com/a/25473303
type: Answer
answers question: http://stackoverflow.com/q/25473302
has body: The reason for this behavior is that the color components (Red, Green and Blue) are represented with a different number of bits in 16-bit color mode. The 16 bits are distributed among the color components as follows: Red is represented with 5 bits Green is represented with 6 bits Blue is represented with 5 bits This means that a 16 bit color has 25 = 32 different shades of red and blue, but 26 = 64 shades of green. (Green receives the additional bit, because the sensitivity of the human eye is greater for shades of green than for shades of red or blue) Now, when a standard 24 bit RGB color is converted to a 16 bit color, sampling errors will occur. In a 24 bit color, each color component has 8 bits. These are converted to the corresponding component for the 16 bit color by taking the highest-order bits of the color component. In the example screenshot, one can see the lines that are painted with an alpha value of 7. The RGB representation of this color is (7,7,7). The binary representation of this color is (00000111b,00000111b,00000111b). When taking the highest-order bits for each color component, the results are 5 bits for Red : 00000111b -> 00000b 6 bits for Green: 00000111b -> 000001b 5 bits for Blue: 00000111b -> 00000b The green component is thus the only component with a non-zero value. The green component of the actual color that is then displayed on the screen can be imagined as the 6-bit green component, left-shifted by 2 bits: 000001b &lt;&lt; 2 = 00000100b This is confirmed by examining the corresponding pixels in the screenshot, which are stored as 0x000C00, or 24 bit RGB values (0,12,0): A dark shade of green.
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25473302
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/39765056

http://stackoverflow.com/q/25511402
has answer: http://stackoverflow.com/a/25511430
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/62054362
score: 4
downvote count: 1
favorite count: 0
has body: I'm getting the below error when trying to run a shell script from java in Eclipse. I just created a text file on my local and wanted to see if it will run. new ProcessBuilder("C:/Users/myDir/Desktop/ss1.sh").start();
possible better answer: http://stackoverflow.com/a/62054362
type: AnsweredQuestion
has title: java.io.IOException: Cannot run program ": CreateProcess error=193, %1 is not a valid Win32 application
accepted answer: http://stackoverflow.com/a/25511430
upvote count: 5
tagged with: java
tagged with: shell

http://stackoverflow.com/a/25424718
answers question: http://stackoverflow.com/q/25422155
type: Answer
accepted answer of: http://stackoverflow.com/q/25422155
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
has body: As logCat never ends, you might try to force an end when InputStream.available() == 0. I did this using wrapping the original InputStream in an ImpatientInputStream. As at the very first start available might be 0 because of the non-blocking nature, you might add a flag whether something read already. BufferedReader bufferedReader = new BufferedReader( new InputStreamReader( new ImpatientInputStream(process.getInputStream()) )); public class ImpatientInputStream extends InputStream { private final InputStream in; private boolean eof; public ImpatientInputStream(InputStream in) { this.in = in; } @Override public int read() throws IOException { if (eof) { return -1; } if (available() == 0) { eof = true; return -1; } return in.read(); } }

http://stackoverflow.com/comment/39710426
type: Comment
type: QuestionComment
score: 0
has text: @hoomi still the same result..."there is a problem parsing the package"
comment on: http://stackoverflow.com/q/25449642

http://stackoverflow.com/a/25477155
answers question: http://stackoverflow.com/q/25466481
has body: If you want to transmit array String between two activities you can use the following code (in you initial activity): Intent intent = new Intent(); in.putExtra("loot", treasure); Meanwhile, in your activity where you want to process the array: Intent intent = getIntent(); String treasure[] = intent.getStringArrayExtra("loot");
type: Answer
has comment: http://stackoverflow.com/comment/39767952
score: 0
has comment: http://stackoverflow.com/comment/39761504

http://stackoverflow.com/q/25393783
has title: Optimize oracle query with IN clause
type: Question
score: 2
upvote count: 2
tagged with: sql
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39605993
accepted answer: http://stackoverflow.com/a/25393859
has comment: http://stackoverflow.com/comment/39605941
favorite count: 0
has answer: http://stackoverflow.com/a/25393859
type: AnsweredQuestion
tagged with: query-optimization
tagged with: oracle-database
has body: I have two queries where I am using in parameter and I am populating the PreparedStatement using setLong and setString operations. Query 1 SELECT A, B FROM TABLE1 WHERE A in (SELECT A FROM TABLE2 WHERE C in (?,?,?) ) Query 2 SELECT A, B FROM TABLE1 WHERE A in (?,?) I am being told that it creates a unique query for each possible set size and pollutes Oracle's SQL cache. Also, oracle could choose different execution plans for each query here as size is not fixed. What optimizations could be applied to make it better? Would it be fine if I create in-clause list of size 50 and populate remaining ones using dummy/redundant variables? If I am not wrong, select-statement in the in-clause will be difficult to optimize unless it is extracted out and used again as a list of statements.

http://stackoverflow.com/comment/89165280
has text: @Misael Neto were you able to do this? If yes how?
comment on: http://stackoverflow.com/q/25476733
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39655580
type: Comment
has text: Use this in second formater 'EEE MMM d HH:mm:ss z yyyy'
type: QuestionComment
comment on: http://stackoverflow.com/q/25420244
score: 0

http://stackoverflow.com/comment/40482853
type: Comment
comment on: http://stackoverflow.com/a/25545698
type: AnswerComment
score: 0
has text: Hey Florent, So can i say that flaw is in public boolean hasNext() { return cursor != size; }

http://stackoverflow.com/comment/39764880
comment on: http://stackoverflow.com/a/25479335
type: Comment
score: 0
type: AnswerComment
has text: The problem is that every time it should play different sound file not the same one. At first you have the editor where you tell the program which drum sounds it should play and also you set the duration

http://stackoverflow.com/comment/39648711
type: Comment
type: QuestionComment
has text: Don't use `==` for `String` comparison.
comment on: http://stackoverflow.com/q/25416718
score: 3

http://stackoverflow.com/a/25510133
score: 19
accepted answer of: http://stackoverflow.com/q/25510096
type: AcceptedAnswer
has body: This has nothing to do with BigInteger, this is happening because your calculate() method is calling itself. Once you've gotten your call stack deep enough, you run out of memory and the JVM throws the StackOverflowError. You don't have any sort of termination condition in your calculate() method. Each time you enter the while loop, you kick off another call. In fact, it seems like you are trying to solve this both iteratively and recursively at the same time. You shouldn't need both a while loop and a recursive call in your code. It looks to me like if you just take out the call to calculate() your program will work just fine: public static void calculate(BigInteger s, BigInteger t) { while (i &lt; 4000000) { System.out.printf("%d\t%d\n", p, i); temp = p; p = p.add(q); q = temp; i++; // calculate(p, q); // you don't need this } }
downvote count: 1
answers question: http://stackoverflow.com/q/25510096
upvote count: 20
type: Answer

http://stackoverflow.com/a/37346182
has body: Java implicitly provides a default constructor only if you have not provided one explicitly. It is the duty of the constructor of the subclass to call the constructor of the super class. Therefore you have to explicitly add a statement in the subclass constructor using super keyword to call the super class constructor. That is the error in your second constructor of class Son. Had there been no constructor provided by you in both the class the implicit default constructor of the class Son would have also called the constructor of class Papa at the time of initialization of the objects of class Son.
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25403932
type: Answer

http://stackoverflow.com/q/25460137
accepted answer: http://stackoverflow.com/a/42766069
has comment: http://stackoverflow.com/comment/39729563
type: AnsweredQuestion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/39729856
has answer: http://stackoverflow.com/a/25462609
tagged with: sql
tagged with: java
tagged with: h2
has body: Good day to you all I am trying to import specified tables from access db to store it in a H2 embedded db to be used locally and update changes back to server (access) whenever connection is possible. But as code below shows i am stuck at inserting dynamically data to the newly created H2 database. I am getting this error org.h2.jdbc.JdbcSQLException: Column "1" not found; SQL statement: INSERT INTO Users ( ID_USER, Nt_id, Name, Level, Psw_Admin ) VALUES ( 1 ,***** ,******* ,ALL ,***** ) [42122-181] As you see i have used preparedstatement, and used quotes (because the columns newly created are VARCHAR all) yet none of the above solved the issue here is my code of inserting: while (rs.next()){ String object=""; String item=""; for (int i=1;i&lt;=columncount;i++){ object=rs.getObject(i)+""; if (i==1){ item="`"+item+object; }else if (i==columncount){ item=item+"` ,`"+object+"`"; } else{ item=item+"` ,`"+object; } System.out.println(object); } PreparedStatement pst3=conn2.prepareStatement("INSERT INTO Users "+" ( "+columnnamepst3+" ) VALUES ( "+item+" )"); pst3.executeUpdate(); pst3.close(); System.out.println("Done...next row"); } rs.close(); rs is the result set from access db conn2 is the connection to H2 EDIT1: corrected the code quoted Thanks in advance
has answer: http://stackoverflow.com/a/42766069
has comment: http://stackoverflow.com/comment/39729620
type: Question
possible better answer: http://stackoverflow.com/a/25462609
has comment: http://stackoverflow.com/comment/39729721
has comment: http://stackoverflow.com/comment/39729436
has title: Java H2 dynamically inserting data

http://stackoverflow.com/q/25462299
has title: Java switch statement get to default on enum
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39733148
has comment: http://stackoverflow.com/comment/39749207
downvote count: 1
accepted answer: http://stackoverflow.com/a/25569350
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25569350
has comment: http://stackoverflow.com/comment/39749278
has comment: http://stackoverflow.com/comment/39733195
tagged with: android
upvote count: 1
type: AnsweredQuestion
score: 0
tagged with: enums
has body: I have a Java (for Android) code similar to this one: enum MyEnum { A, B, C } String f(MyEnum e) { if (e == null) { return null; } switch(e) { case A: return "AA"; case B: return "BB"; case C: return "CC"; default: throw new IllegalStateException("invalid enum"); } } and I got the exception in the default clause thrown once! Can somebody explain if this is theoretically possible and how? For example in C++ you can have an enum variable which value is non of the declared enum values, but I guess in Java you cannot do that, correct me if I am wrong.

http://stackoverflow.com/a/25457624
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25457423
score: 1
has body: Variables defined inside a class are called fields. To access them, you use the getfield or getstatic instructions, depending on whether the field is static or not. Public static fields are the closest Java has to global variables.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25457423

http://stackoverflow.com/q/25499551
has answer: http://stackoverflow.com/a/47566637
type: UnansweredQuestion
has title: How to check if a field is blank and how to read the entered text?
has answer: http://stackoverflow.com/a/25499871
has body: How to check whether a text field is blank i.e. no input is given if given how to store that text into a variable?
tagged with: selenium-webdriver
answer count: 4
has answer: http://stackoverflow.com/a/25499980
tagged with: java
has answer: http://stackoverflow.com/a/25499872
score: 7
downvote count: 1
favorite count: 0
upvote count: 8
type: Question
has comment: http://stackoverflow.com/comment/39802270

http://stackoverflow.com/q/25519376
upvote count: 4
answer count: 2
linked to: http://stackoverflow.com/q/469695
has comment: http://stackoverflow.com/comment/39839468
tagged with: java
tagged with: email
downvote count: 0
has comment: http://stackoverflow.com/comment/39839438
favorite count: 0
has comment: http://stackoverflow.com/comment/39839715
type: Question
has title: How can I get base64 for a file?
tagged with: file-io
type: UnansweredQuestion
tagged with: mime-types
has answer: http://stackoverflow.com/a/25519581
tagged with: base64
has comment: http://stackoverflow.com/comment/39839486
score: 4
has comment: http://stackoverflow.com/comment/39839666
has body: I have tried using the below code which generates a base64 for the file and returns as string. I was able to get if the file size is small. StringBuffer output = new StringBuffer(); Process p; try { p = Runtime.getRuntime().exec(command); p.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = reader.readLine())!= null) { output.append(line + "\n"); } } catch (Exception e) { e.printStackTrace(); } return output.toString(); If there is any other way to get the base64 of the file.The command I am passing is base64 filename. please let me know
has comment: http://stackoverflow.com/comment/39839388
has comment: http://stackoverflow.com/comment/39839659
linked to: http://stackoverflow.com/q/5908574
has answer: http://stackoverflow.com/a/25519668
has comment: http://stackoverflow.com/comment/39839402
has comment: http://stackoverflow.com/comment/39839525

http://stackoverflow.com/q/25486471
tagged with: android
tagged with: java
tagged with: io
has title: FileWriter always recreated and reclosed() is it safer?
has comment: http://stackoverflow.com/comment/39777628
has comment: http://stackoverflow.com/comment/39835626
has comment: http://stackoverflow.com/comment/39778530
tagged with: url-rewriting
has comment: http://stackoverflow.com/comment/39783066
has body: I know either in Android or Java desktop We could write something into the file using this code below: private void writeNow(){ FileWriter fWriter = new FileWriter(SDTool.getCurrentApplicationPath() + "/error.log", true); fWriter.write( dateFormat.format(date) + " :: " + n + "\n"); fWriter.flush(); fWriter.close(); } but if every time I want to write i need to execute that method. And the FileWriter object is always recreated, flushed and reclosed. The more I used it, the bigger memory leak. Is there a safer method of doing this?
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/39777538
type: Question
has comment: http://stackoverflow.com/comment/39777719
has comment: http://stackoverflow.com/comment/39778034

http://stackoverflow.com/a/25526986
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39953181
answers question: http://stackoverflow.com/q/25523525
type: Answer
accepted answer of: http://stackoverflow.com/q/25523525
score: 1
has body: Something like this should do it: def arr = [] def al = [] for (i in 1..3) { arr = [] arr[0] = 1 //some value arr[1] = 2 //some value al.add(arr) } println al[0][1] ​
type: AcceptedAnswer

http://stackoverflow.com/comment/39798420
has text: @user417896 Would switching to Canvas fix my problem? And the problem still remains even if I remove the sleep function.
comment on: http://stackoverflow.com/q/25496911
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39836029
comment on: http://stackoverflow.com/q/25516991
has text: Hi,yes doing as you say the problem is solved but there is still another problem, what's in the camera (the tiledmap) represents the background so if I scroll down (thus move the y coordinate of the camera) the collision is not detected
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25431934
has title: Android Listview onItemLongClick Listener not working for Second Time
has answer: http://stackoverflow.com/a/25434289
has comment: http://stackoverflow.com/comment/39677679
has body: I am implementing LongClick Listener on android list view. Here is the code I am using for that, this.lst_CartDetails.setLongClickable(true); this.lst_CartDetails.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub SelectedItem menu = (SelectedItem)cartdetailsAdapter.getItem(arg2); if(menu.getDelete() == 0) { menu.setDelete(1); } else { menu.setDelete(0); } cartdetailsAdapter.notifyDataSetChanged(); //lst_CartDetails.invalidateViews(); return true; } }); Long click works for the first time. But if I click(long) again on that item its not responding. Whats going wrong? I found whats going wrong, OnLongClick I am enabling a button within the list item. If that button is not enabled the longclick works normally. Thanks
answer count: 3
has comment: http://stackoverflow.com/comment/39679069
tagged with: android-listview
has answer: http://stackoverflow.com/a/25432330
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39677582
downvote count: 0
has comment: http://stackoverflow.com/comment/39730834
has comment: http://stackoverflow.com/comment/39677508
has answer: http://stackoverflow.com/a/47248750
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39712900
has comment: http://stackoverflow.com/comment/39678858
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39678678
tagged with: android
has comment: http://stackoverflow.com/comment/39676748
has comment: http://stackoverflow.com/comment/39677078

http://stackoverflow.com/a/25635599
has body: You need to close your Connections and ResultSets after you are done with them, otherwise, it will be as if you're still executing queries with them, even though you aren't. To close a Connection or ResultSet, just use variableName.close();. So, for example, you should use: connection.close(); resultset.close(); In the case of your code, you should use: Connection conn = DriverManager.getConnection(DB_URL, USER, PASS); //set the query, create the statement ResultSet rs = stmt.executeQuery(sql); //get values conn.close(); rs.close(); //return values The reason you're getting the error is because MySQL thinks that you're still using all of those connections, even though you aren't. To make it so MySQL doesn't think you're still using those connections, is to close them, with connection.close().
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25392656
type: Answer
accepted answer of: http://stackoverflow.com/q/25392656
upvote count: 2
score: 2

http://stackoverflow.com/comment/39604957
score: 0
type: AnswerComment
has text: It works well indeed. It would be perfect if I can stop the JPanel to grow in width once every component is on the same line. But I am still happy with this solution. Thank you very much.
comment on: http://stackoverflow.com/a/25392640
type: Comment

http://stackoverflow.com/a/25471092
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25406961
accepted answer of: http://stackoverflow.com/q/25406961
has body: The Filter Examples operator can be used to filter examples where an attribute has a specific value. Perhaps the code for this could be useful as the basis for doing it in your own code.
type: AcceptedAnswer
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25416610
has comment: http://stackoverflow.com/comment/39648557
has body: Arrays are reference objects. When you assign them, they are not copied at all - what happens there is similar to assigning an array to a pointer in C++. When you copy an array using System.arraycopy, a shallow copy is performed. Constructing a collection from another collection creates a shallow copy as well. Note: Unlike C++ libraries, Java class libraries uses immutable classes a lot. For example, String is immutable; so are the wrappers for numbers, such as Integer. Immutability makes the shallow vs. deep copying a lot less relevant. Another note: Vector&lt;T&gt; should be used when you need a synchronized container; if you do not want synchronization, use ArrayList&lt;T&gt; instead.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/39648457
accepted answer of: http://stackoverflow.com/q/25416559
upvote count: 2
answers question: http://stackoverflow.com/q/25416559
type: Answer
score: 2

http://stackoverflow.com/comment/39900165
has text: `$1` backreferences the match result from group index 1.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25549749
type: AnswerComment

http://stackoverflow.com/a/25533407
has body: You need a Calender to do that. Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.YEAR, year); c.add(Calendar.MONTH, month); Date newDate = c.getTime();
answers question: http://stackoverflow.com/q/25533363
score: 3
accepted answer of: http://stackoverflow.com/q/25533363
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/34060069
answers question: http://stackoverflow.com/q/25409069
type: Answer
has body: had a similar problem, but in my case it was postman leaving a stupid Content-Type:application/json in the header! Hope this might avoid my struggling for someone having the same issue!
score: 0

http://stackoverflow.com/comment/39870787
score: 0
type: AnswerComment
has text: PS: I'm not trying to sound argumentative or pedantic; I just think these are important distinctions, especially if anyone stumbles across this in the future (unlikely, since the question is dying the death of a dupe...).
comment on: http://stackoverflow.com/a/25535974
type: Comment

tomcat7
tags question: http://stackoverflow.com/q/25418434
tags question: http://stackoverflow.com/q/25523796
tags question: http://stackoverflow.com/q/25515967
tags question: http://stackoverflow.com/q/25512316
tags question: http://stackoverflow.com/q/25484453
tags question: http://stackoverflow.com/q/25448052
tags question: http://stackoverflow.com/q/25494391
tag name: tomcat7
tags question: http://stackoverflow.com/q/25420999
tags question: http://stackoverflow.com/q/25476074
tags question: http://stackoverflow.com/q/25484261
type: Tag

http://stackoverflow.com/a/25429470
has comment: http://stackoverflow.com/comment/39672057
type: Answer
answers question: http://stackoverflow.com/q/25428533
type: AcceptedAnswer
downvote count: 0
has body: Simply put: This css will style dialog box content .ui-dialog, .ui-dialog-content { border:10px solid orange; /** change css properties to match your theme*/ background-color: pink !important; color: red; } This css will style the title bar of dialog box .ui-dialog-titlebar { background-image: none; /** change css properties to match your theme*/ background-color: yellow; } This css will style bottom pane of dialog box .ui-dialog .ui-dialog-buttonpane{} /** change css properties to match your theme*/ Also for your info this is insert from http://api.jqueryui.com/dialog/ CSS class names can be used: ui-dialog: The outer container of the dialog. ui-dialog-titlebar: The title bar containing the dialog's title and close button. ui-dialog-title: The container around the textual title of the dialog. ui-dialog-titlebar-close: The dialog's close button. ui-dialog-content: The container around the dialog's content. This is also the element the widget was instantiated with. ui-dialog-buttonpane: The pane that contains the dialog's buttons. This will only be present if the buttons option is set. ui-dialog-buttonset: The container around the buttons themselves.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25428533
score: 1

http://stackoverflow.com/a/25422089
answers question: http://stackoverflow.com/q/25422011
has body: You may try like this: try { // connect to MySQL DB using JDBC and run different queries } catch ( Exception e ) { // throw this exception by wrapping it in another user defined exception class } finally { closeMyConnection(resource); } protected void closeMyConnection( Resource resource ) { try { if (resource != null) { resource.close(); } } catch( Exception ex ) { log( "There is some excetion", ex ); } }
type: Answer
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39683909

http://stackoverflow.com/comment/39683035
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25435237
has text: Oh nevermind, I misread your code, I thought you were instantiating a replyview in replyfragment but you're not there. it still says you're instantiating replyview somewhere but it appears your stacktrace is cut off
type: AnswerComment

scroll
type: Tag
tags question: http://stackoverflow.com/q/25442659
tags question: http://stackoverflow.com/q/25466283
tags question: http://stackoverflow.com/q/25461240
tags question: http://stackoverflow.com/q/25544387
tag name: scroll

http://stackoverflow.com/q/25477605
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25477775
has title: How to instantiate multiple objects of a class in run time?
has comment: http://stackoverflow.com/comment/39761639
downvote count: 2
has comment: http://stackoverflow.com/comment/39761582
has comment: http://stackoverflow.com/comment/39761959
tagged with: input
upvote count: 1
score: -1
has body: I'm reading an input file which has data specific to a person in one line as comma separated values. i have successfully tokenized each line. Now, I want to create different objects (with different variable names of course!) of type Person during run time as I read each line. Is this possible?
has comment: http://stackoverflow.com/comment/39761584
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25477775
has comment: http://stackoverflow.com/comment/39761635
tagged with: java
has comment: http://stackoverflow.com/comment/39761527
answer count: 1
has comment: http://stackoverflow.com/comment/39761541
has comment: http://stackoverflow.com/comment/39761687

http://stackoverflow.com/q/25505028
tagged with: spring
tagged with: glassfish
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25505782
has body: This is probably and extremely easy question for some of you, although I require assistance in understanding the process of setting up a database connection between my Spring MVC application, which is currently running on Glassfish 4 and MySQL. What are the steps in doing this? I have outlined my ideas below, however I am still left unclear with this process. So far I have created a JDBC Connection Pool within the Glassfish 4 administration panel and connected successfully with the defined parameters; ping returns successful. Do I need to create a JNDI DataSource now, because I believe this is required to connect to the Database Connection Pool? If this is the correct steps thus far; What steps are performed next? My assumption is that the web.xml needs to be configured so that it links to the JNDI DataSource? Is this correct? Your assistance in this manner will be appreciated. [UPDATED] I have figured this all out and now everything is performing as expected. However, I ran into one implication along the way which I did not quite understand why the connection did not want to function at one point. This was my configuration within the web.xml where I faced issues with: jdbc/application javax.sql.DataSource Container I was receiving all types of errors when attempting to pull records from one of my tables. The error message was something along the lines of: "javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527" Although I found the solution to this where I included the element within the parent element in the web.xml This is what the file looked after I had applied the update: jdbc/application javax.sql.DataSource Container jdbc/application What does the node do which allows me to establish this connection correctly? My assumption is that is finds and maps it …
score: 0
answer count: 1
tagged with: mysql
type: Question
type: UnansweredQuestion
tagged with: java
has title: Spring Database Connection Configuration Process

gradle-eclipse
type: Tag
tag name: gradle-eclipse
tags question: http://stackoverflow.com/q/25474075

http://stackoverflow.com/comment/39685060
has text: Would that not make the game impossible for the human player?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25436352
score: 0

http://stackoverflow.com/q/25426069
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25426184
accepted answer: http://stackoverflow.com/a/25426184
has title: What replaces ObjectId.massageToObjectId() in new mongo java driver?
tagged with: java
has body: According to the documentation of API of new MongoDB Java driver 2.12 which can be seen here the method that converts string into an ObjectId is deprecated and will be dropped in 3.x drivers. What are we supposed to rewrite the code to use? The documentation does not state this.
type: Question
upvote count: 2
score: 2
tagged with: mongodb
downvote count: 0
tagged with: objectid
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25532866
accepted answer: http://stackoverflow.com/a/25533137
has answer: http://stackoverflow.com/a/25533137
type: Question
score: 0
has title: Java Server to iOS app Stream: Not Correct
has body: I have a Java Server and want to send String messages to a iOS application. Sending theoretically works, but i always receive "¬í" in my App. I tried different encoding like ASCII, Unicode, UTF-16. My Java send method looks like this: public void sendName(String str) { try { System.out.println("Send: "+str); ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream()); oos.writeObject(str.getBytes(StandardCharsets.US_ASCII)); } catch (IOException ex) { } } and my objective C receive Method looks like this: - (void)readFromStream{ uint8_t buffer[1024]; int len; NSMutableString *total = [[NSMutableString alloc] init]; while ([inputStream hasBytesAvailable]) { len = [inputStream read:buffer maxLength:sizeof(buffer)]; if (len &gt; 0) { [total appendString: [[NSString alloc] initWithBytes:buffer length:len encoding:NSASCIIStringEncoding]]; NSLog(@"%@",total); } } } Does someone know, whats wrong? Thank you :)
tagged with: stream
answer count: 1
tagged with: ios
has comment: http://stackoverflow.com/comment/39863857
type: AnsweredQuestion
tagged with: network-programming
tagged with: java

http://stackoverflow.com/comment/39644847
type: QuestionComment
has text: @MadProgrammer - I've questioned that too. I was thinking it would make the GUI seem more responsive to have different table instances(playlists) in memory rather than changing the model. To me, it seems that reloading the table with info would cause a hiccup or pause. Then again - this is my first swing/GUI project so, I'm not coming from a very informed perspective.
score: 0
comment on: http://stackoverflow.com/q/25414060
type: Comment

http://stackoverflow.com/q/25397132
tagged with: java
tagged with: twitter
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25405825
has body: Is it possible to detect that someone retweeted or favourited my status? Does twitter api provide any listeners for a user's tweet RTd or Favourited? In particular, I am looking for something with twitter4j that allows me to do so.
possible better answer: http://stackoverflow.com/a/25399854
has answer: http://stackoverflow.com/a/25405825
downvote count: 0
upvote count: 1
has title: Twitter Api detect my tweet retweeted or favourited
score: 1
has answer: http://stackoverflow.com/a/25399854
tagged with: twitter-streaming-api
favorite count: 0
type: AnsweredQuestion
tagged with: twitter4j

http://stackoverflow.com/q/25547555
has answer: http://stackoverflow.com/a/40601446
tagged with: debian
answer count: 11
has answer: http://stackoverflow.com/a/48969281
type: Question
tagged with: netbeans
has answer: http://stackoverflow.com/a/49650978
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/65217930
has comment: http://stackoverflow.com/comment/39891704
has comment: http://stackoverflow.com/comment/39890702
has title: How to solve error java.lang.NoClassDefFoundError at the time of installing netbeans8 in debian
score: 6
upvote count: 6
has body: I am trying to install netbeans 8 in debian-7.0-amd64-minimal. (VPS) 1st I have installed java/JDK latest version (1.8.0_20) by following https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps Next I am trying to install netbeans by following http://installnetbeansdebian.blogspot.com/2013/06/how-to-install-netbeans-73-ide-complete.html when I run ./netbeans-8.0-php-linux.sh it displays the following error. Configuring the installer... Searching for JVM on the system... Extracting installation data... Running the installer wizard... Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main" Anybody knows, how to fix this?
has answer: http://stackoverflow.com/a/47599694
has answer: http://stackoverflow.com/a/25562483
has answer: http://stackoverflow.com/a/44192745
has answer: http://stackoverflow.com/a/38962427
has answer: http://stackoverflow.com/a/41076686
favorite count: 0
tagged with: linux
has answer: http://stackoverflow.com/a/57395040
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/56754644

http://stackoverflow.com/a/25467721
score: 0
answers question: http://stackoverflow.com/q/25461640
type: Answer
has body: Avoid java.util.Date &amp; .Calendar Avoid java.util.Date and .Calendar because they are notoriously troublesome, flawed, and confusing. Use either Joda-Time or the new java.time package in Java 8. Joda-Time In Joda-Time 2.4. DateTimeZone timeZone = DateTimeZone.forID( "America/Montreal" ); DateTime start = DateTime.now( timeZone ); // DateTime start = new DateTime( fileLastModifiedMillis, timeZone ); DateTime dateTime = start; while ( dateTime.getDayOfWeek() != DateTimeConstants.FRIDAY ) { dateTime = dateTime.plusDays( 1 ); } To compare… boolean isLate = oneDateTime.isAfter( someOtherDateTime );

http://stackoverflow.com/q/25463103
score: 4
has comment: http://stackoverflow.com/comment/39734663
tagged with: android-studio
upvote count: 4
has answer: http://stackoverflow.com/a/40813676
tagged with: java
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/110855160
has comment: http://stackoverflow.com/comment/39735508
has title: Detect and remove unused classes in external libraries
favorite count: 0
type: Question
has body: I'm working on an Android project that has uses several large external libraries (.jar files). Since Android has the 65536 methods limit of DEX, I'd like to remove all classes and methods in the external libraries that I haven't used once in my code. The problem is that the classes I'm using in the external libraries have dependencies of their own. I wish to identify all of the classes in the external libraries that I do not need (are not used by my code and are not dependencies of classes I do need). Two clarifications: ProGuard and DexGuard are irrelevant since they do not modify external libraries I do not wish to use custom loaders or split my code into multiple dex files. All I wish to do is identify and remove the classes in question.
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42794649

http://stackoverflow.com/comment/39716374
type: AnswerComment
comment on: http://stackoverflow.com/a/25452112
has text: Thanks for the reply. Shouldn't I create an another class which contains all the fields of these classes?
score: 1
type: Comment

http://stackoverflow.com/q/25476291
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25487228
has body: I cannot figure out how to use ValueBuilder.convertTo as a clause in Apache Camel's mock endpoint expectations. For some reason the expectations containing convertTo are ignored. Here's a test that illustrates the issue: package wheleph; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; public class ConvertToTest extends CamelTestSupport { private static final String INBOUND_ENDPOINT = "direct:inbound"; private static final String OUTBOUND_ENDPOINT = "mock:outbound"; @Test public void testConvertToBody() throws InterruptedException { MockEndpoint mockOutboundEndpoint = getMockEndpoint(OUTBOUND_ENDPOINT); mockOutboundEndpoint.expectedMessageCount(1); mockOutboundEndpoint.message(0).body().convertTo(String.class).isEqualTo("Blah"); template.sendBody(INBOUND_ENDPOINT, "Message 1"); assertMockEndpointsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from(INBOUND_ENDPOINT). to(OUTBOUND_ENDPOINT); } }; } } The test case above should fail because the mock endpoint actually receives a message with body "Message 1" which is not equal to the expected value "Blah". However this test is green. But if I remove convertTo from the mock endpoint setup (mockOutboundEndpoint.message(0).body().convertTo(String.class).isEqualTo("Blah")) then the test fails as it should. Am I using ValueBuilder.convertTo in a wrong way or is this a bug in Apache Camel testing framework?
tagged with: apache-camel
has answer: http://stackoverflow.com/a/25487228
favorite count: 0
type: Question
tagged with: mocking
answer count: 1
downvote count: 0
has title: Apache Camel: usage of ValueBuilder.convertTo in mock endpoint expectations
upvote count: 1
tagged with: unit-testing
type: AnsweredQuestion

http://stackoverflow.com/a/48068844
score: 8
upvote count: 8
answers question: http://stackoverflow.com/q/25395255
type: Answer
downvote count: 0
has body: This worked for me: mvn clean install mvn site Even though the minimum code coverage was not met and mvn clean install failed, the mvn site build succeeded and created the coverage report at: .../target/site/jacoco/index.html

http://stackoverflow.com/comment/39793910
type: Comment
comment on: http://stackoverflow.com/a/25491863
type: AnswerComment
has text: Not quite; the bytecode does preserve the type of each local variable in the stack frame for the method.
score: 0

http://stackoverflow.com/a/25399800
has comment: http://stackoverflow.com/comment/39617034
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25399777
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39616832
has comment: http://stackoverflow.com/comment/39617349
accepted answer of: http://stackoverflow.com/q/25399777
has body: Your problem: in y[i+1] = y[i] + h * Math.abs(functionof(x[i],y[i])); //do yi+1 = yi + h * function of current x and current y through the loop when looping for(i = 0 ; i &lt; 100 ; i ++) which means for(i=0 to 99) y[i+1] -- &gt; when i=99, you will try to acess y[99+1] i.e, y[100] that doesn't exist EDIT : change your code to : for(i = 1 ; i &lt; 100 ; i ++){ // for x1 to x99 y[i] = y[i-1] + h * Math.abs(functionof(x[i-1],y[i-1])); out.print("y"); out.print(i-1); out.print("="); out.print(y[i-1]); }
has comment: http://stackoverflow.com/comment/39617154
type: Answer

http://stackoverflow.com/a/25473007
has body: Hi i think this might be helpful for you. Here you can find out the link to calculate hmac sha1: http://caligatio.github.io/jsSHA/ Here you can find the source code in javascript. https://github.com/Caligatio/jsSHA/releases/tag/v1.5.0
type: Answer
accepted answer of: http://stackoverflow.com/q/25472966
score: 8
upvote count: 8
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25472966

http://stackoverflow.com/comment/39706901
comment on: http://stackoverflow.com/a/25443401
has text: is a jsp showing with struts tags? You should have getter for the `price` and if you are using inner class `FeedBack` the you should make it outer public class.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39833849
type: Comment
type: QuestionComment
has text: Please show full stacktrace ...
score: 0
comment on: http://stackoverflow.com/q/25514244

http://stackoverflow.com/q/25533211
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25555570
has comment: http://stackoverflow.com/comment/39866614
accepted answer: http://stackoverflow.com/a/25555570
tagged with: java
answer count: 1
has title: Spring MVC onto Tomcat 8 using Maven: NullPointerException with SerializableTypeWrapper
has comment: http://stackoverflow.com/comment/39866321
has comment: http://stackoverflow.com/comment/39866172
type: Question
has body: I am trying to setup a Dynamic Web Project in Eclipse Luna. I have setup the Tomcat 8 server to be able to be deployed to. I have a small Spring MVC (Spring 4) project that I am trying to get deployed. When I do, I get the following Exception: Aug 27, 2014 12:52:52 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /SponsoredNetIDs threw load() exception java.lang.NullPointerException at org.springframework.core.SerializableTypeWrapper$TypeProxyInvocationHandler.invoke(SerializableTypeWrapper.java:239) at org.springframework.core.$Proxy4.hashCode(Unknown Source) at org.springframework.util.ObjectUtils.nullSafeHashCode(ObjectUtils.java:273) at org.springframework.core.ResolvableType.hashCode(ResolvableType.java:811) at org.springframework.util.ConcurrentReferenceHashMap.getHash(ConcurrentReferenceHashMap.java:214) at org.springframework.util.ConcurrentReferenceHashMap.getReference(ConcurrentReferenceHashMap.java:246) at org.springframework.util.ConcurrentReferenceHashMap.get(ConcurrentReferenceHashMap.java:226) at org.springframework.core.ResolvableType.forType(ResolvableType.java:1186) at org.springframework.core.ResolvableType.forType(ResolvableType.java:1165) at org.springframework.core.ResolvableType.forTypes(ResolvableType.java:844) at org.springframework.core.ResolvableType.getInterfaces(ResolvableType.java:403) at org.springframework.core.ResolvableType.as(ResolvableType.java:365) at org.springframework.core.convert.support.GenericConversionService.getRequiredTypeInfo(GenericConversionService.java:266) at org.springframework.core.convert.support.GenericConversionService.addConverterFactory(GenericConversionService.java:103) at org.springframework.core.convert.support.DefaultConversionService.addScalarConverters(DefaultConversionService.java:79) at org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(DefaultConversionService.java:63) at org.springframework.core.convert.support.DefaultConversionService.<in…
has comment: http://stackoverflow.com/comment/39866092
has comment: http://stackoverflow.com/comment/39866256

http://stackoverflow.com/q/25410608
has comment: http://stackoverflow.com/comment/39656445
has body: Dummy question but I spent half an hour looking for an answer If I try to set it on runtime System.setProperty("java.library.path", "C:\\Users\\elect\\Documents\\SixenseSDK_062612\\SixenseSDK_062612\\bin\\x64\\release_dll"); or System.setProperty("java.library.path", "C:\\Users\\elect\\Documents\\SixenseSDK_062612\\SixenseSDK_062612\\bin\\x64\\release_dll\\"); it doesnt see the lib if I put it in the VM option it works, but I want to append, neither %% or $ work Ps: I am on win
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39654577
upvote count: 1
has answer: http://stackoverflow.com/a/25419731
has title: How to append library path to the java.library.path in the VM options in Netbeans
answer count: 2
score: 1
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/7598623
favorite count: 0
has answer: http://stackoverflow.com/a/25419865
type: Question
linked to: http://stackoverflow.com/q/12798530

http://stackoverflow.com/a/25478691
score: 2
upvote count: 3
answers question: http://stackoverflow.com/q/25474353
type: AcceptedAnswer
type: Answer
downvote count: 1
has body: You can read Google's doc at this link, which explains well enough what this PMF class is https://developers.google.com/appengine/docs/java/datastore/jdo/overview-dn2 Scroll down to "Getting a PersistenceManager Instance" and there is the code. That is just one way of getting a PersistenceManagerFactory, and basic JDO doesn't need this class of Google's. Your code seems to have confused a real PersistenceManagerFactory with this wrapper class of Google's.
accepted answer of: http://stackoverflow.com/q/25474353

http://stackoverflow.com/comment/39906556
score: 0
has text: I dont see any functionality issues as of now, but its flooding the logcat and making it very difficult to find appropriate debug messages.
comment on: http://stackoverflow.com/q/25512523
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39627506
score: 0
type: AnswerComment
has text: What about the resources that the thread opens, files, connections?. The JVM doesn't close them right?
comment on: http://stackoverflow.com/a/25405660
type: Comment

http://stackoverflow.com/q/25543206
has comment: http://stackoverflow.com/comment/39883159
tagged with: sql
tagged with: java
tagged with: hibernate
has body: I am trying to Create a criteria that will select distinct values from a column. How can I return this value as String; I have this: Criteria criteria = session.createCriteria(Students.class) .add(Restrictions.eq("studentYear","2")) .add(Restrictions.eq("studentSemester","1")) .setProjection(Projections.distinct(Projections.property("studentHostel"))); any ideas will be appreciated. Can I convert this to a String value?
answer count: 1
accepted answer: http://stackoverflow.com/a/25550609
type: Question
type: AnsweredQuestion
tagged with: criteria
has comment: http://stackoverflow.com/comment/39882528
has title: Return distinct Criteria result as String in Hibernate
has answer: http://stackoverflow.com/a/25550609
score: 0

gigya
tag name: gigya
tags question: http://stackoverflow.com/q/25393771
type: Tag

http://stackoverflow.com/comment/39844945
score: 0
has text: Thank You for the comment, I did not think about this. Eight hours should be sufficient for my purposes.
type: QuestionComment
comment on: http://stackoverflow.com/q/25522139
type: Comment

http://stackoverflow.com/comment/39609467
type: Comment
score: 0
type: AnswerComment
has text: @TuanDang A `File` reference can be absolute or relative, until you use something like `getCanonicalFile`, it won't be resolved to a full path. Java is fully capable of using this as is and it should work just fine...
comment on: http://stackoverflow.com/a/25395638

timer
tag name: timer
tags question: http://stackoverflow.com/q/25478900
tags question: http://stackoverflow.com/q/25412232
type: Tag
tags question: http://stackoverflow.com/q/25504139
tags question: http://stackoverflow.com/q/25419550
tags question: http://stackoverflow.com/q/25516226
tags question: http://stackoverflow.com/q/25444238
tags question: http://stackoverflow.com/q/25487472
tags question: http://stackoverflow.com/q/25471818
tags question: http://stackoverflow.com/q/25492235

http://stackoverflow.com/a/25461770
has body: Yes why not. You can manually do that or automatically happens that only when you synchronized static members of a class. In Manual case synchronized(Example.class) { } System puts lock on class when you do public static synchronized void example() {
has comment: http://stackoverflow.com/comment/39732655
answers question: http://stackoverflow.com/q/25461751
type: Answer
has comment: http://stackoverflow.com/comment/39801966
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39802252

http://stackoverflow.com/q/25540502
linked to: http://stackoverflow.com/q/30337582
answer count: 6
tagged with: spring
linked to: http://stackoverflow.com/q/25256487
has title: Use of multiple DataSources in Spring Batch
linked to: http://stackoverflow.com/q/48954763
tagged with: spring-batch
has answer: http://stackoverflow.com/a/29286681
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/46628360
tagged with: java
has answer: http://stackoverflow.com/a/63691521
has answer: http://stackoverflow.com/a/48046998
has answer: http://stackoverflow.com/a/51602761
has answer: http://stackoverflow.com/a/29165232
downvote count: 0
accepted answer: http://stackoverflow.com/a/29165232
tagged with: datasource
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39878798
has comment: http://stackoverflow.com/comment/41513933
has answer: http://stackoverflow.com/a/30346035
possible better answer: http://stackoverflow.com/a/30346035
score: 54
has body: I am trying to configure a couple of datasources within Spring Batch. On startup, Spring Batch is throwing the following exception: To use the default BatchConfigurer the context must contain no more thanone DataSource, found 2 Snippet from Batch Configuration @Configuration @EnableBatchProcessing public class BatchJobConfiguration { @Primary @Bean(name = "baseDatasource") public DataSource dataSource() { // first datasource definition here } @Bean(name = "secondaryDataSource") public DataSource dataSource2() { // second datasource definition here } ... } Not sure why I am seeing this exception, because I have seen some xml based configuration for Spring batch that declare multiple datasources. I am using Spring Batch core version 3.0.1.RELEASE with Spring Boot version 1.1.5.RELEASE. Any help would be greatly appreciated.
upvote count: 54
has comment: http://stackoverflow.com/comment/39902208

http://stackoverflow.com/a/25522016
score: 0
has comment: http://stackoverflow.com/comment/39853321
answers question: http://stackoverflow.com/q/25509492
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39853936
has comment: http://stackoverflow.com/comment/39851129
type: Answer
accepted answer of: http://stackoverflow.com/q/25509492
has comment: http://stackoverflow.com/comment/39853146
has body: I think your problem is a combination of these two: You have two event loops (the while (!X.isDisposed()) part) You're blocking the UI by using Thread.sleep() on the main thread. Point 2 causes your application to be unresponsive to user interactions while the progress bar is shown, e.g. the user can't focus the window anymore. Also note, that (at least for the code you have so far) a Dialog isn't necessary. I've attached a code example that shows how you can do two things: Have a modal window on top of your main window Update the UI periodically using Display#timerExec(int, Runnable) protected ProgressBar bar; protected Shell shell; public ProgressBox(Shell parent, final String name) { this.shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.TITLE); shell.setLayout(new FillLayout()); bar = new ProgressBar(shell, SWT.SMOOTH); shell.setText(name); shell.pack(); shell.open(); } public void open() { final int max = 10; this.bar.setMaximum(max); new Thread(new Runnable() { @Override public void run() { for (int i = 1; i &lt;= max; i++) { if (bar == null || bar.isDisposed()) { closeShell(); return; } else { final int index = i; shell.getDisplay().asyncExec(new Runnable() { @Override public void run() { bar.setSelection(index); } }); } try { Thread.sleep(1000); } catch (InterruptedException e) { closeShell(); e.printStackTrace(); } } closeShell(); } private void closeShell() { shell.getDisplay().asyncExec(new Runnable() { @Override public void run() { shell.close(); } }); } }).start(); } public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell(); shell.setSize(450, 300); shell.open(); new ProgressBox(shell, "Progress").open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }

http://stackoverflow.com/comment/39678549
score: 0
has text: If there are limited number of objects in the Enum then you can happily iterate all the `values()` to get the desired one.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25431403

http://stackoverflow.com/comment/39659937
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25423188
has text: What result do you get?

http://stackoverflow.com/comment/39856084
type: QuestionComment
comment on: http://stackoverflow.com/q/25528475
has text: @Gimby IF i put the context.xml in src/main/resources then it is not coming into the war. It is supposed to come in META-INF but not coming.
type: Comment
score: 0

http://stackoverflow.com/q/25550092
duplicate of: http://stackoverflow.com/q/513832
tagged with: android-edittext
linked to: http://stackoverflow.com/q/513832
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25550134
answer count: 3
has answer: http://stackoverflow.com/a/25550134
tagged with: string
possible better answer: http://stackoverflow.com/a/25550163
has title: EditText.getText().toString() comparison to other string fails
favorite count: 0
tagged with: tostring
has answer: http://stackoverflow.com/a/25550163
type: Question
has body: The Toast keeps saying access denied, even if i fill in the right pin. I need to lock users into an kiosk-mode app, and only with the right pin they will have access to the settings and the exit option. public void onClick(View v) { AlertDialog.Builder alert = new AlertDialog.Builder(FullscreenActivity.this); alert.setTitle("PIN:"); //alert.setMessage("Message"); final EditText pinEntry = new EditText(FullscreenActivity.this); alert.setView(pinEntry); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String pin = pinEntry.getText().toString().trim(); String secret = "0000"; if (pin == secret){ Toast.makeText(getApplicationContext(),"Access Approved", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(),"Access Denied", Toast.LENGTH_SHORT).show(); } Toast.makeText(getApplicationContext(),pin, Toast.LENGTH_SHORT).show(); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); } });
has answer: http://stackoverflow.com/a/25550236
has comment: http://stackoverflow.com/comment/39895253
tagged with: android
tagged with: java
downvote count: 5
score: -3

http://stackoverflow.com/comment/39860309
type: Comment
comment on: http://stackoverflow.com/a/25530631
score: 0
type: AnswerComment
has text: Thank you, Kumar. i n my classA i don't know where to put the main method.

http://stackoverflow.com/a/25525458
has body: hash codes are meant to speed up searching. if you had a.equals(b) == true and a.hashCode() != b.hashCode() then containers that use hashing would not find some results that containers without hashing would find, among other problems. also the last row is the contrapositive of the first row.
has comment: http://stackoverflow.com/comment/39849974
has comment: http://stackoverflow.com/comment/39850143
has comment: http://stackoverflow.com/comment/39850285
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25525146

http://stackoverflow.com/a/25505127
type: Answer
answers question: http://stackoverflow.com/q/25504894
has comment: http://stackoverflow.com/comment/39812770
score: 0
has comment: http://stackoverflow.com/comment/39813712
has body: You need a service, something that will run in the background constantly. Than have your service do check for specific PID (process id). As every application has its own process id, one can get it by int id= android.os.Process.myPid(); Listen for the android.intent.action.MAIN also with the category android.intent.category.LAUNCHER. Then have that broadcast receiver override the onReceive method and do check to see the name of the application or process. Then make conditions according to the need. regards
has comment: http://stackoverflow.com/comment/39812542

http://stackoverflow.com/comment/39796432
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25495854
type: AnswerComment
has text: Ah. Well, the ArrayList is storing all your variables for you. If you don't know how many inputs you will have, then it is best to use some sort of collection to hold the resulting variables.

http://stackoverflow.com/q/25460986
type: Question
has comment: http://stackoverflow.com/comment/39730888
type: UnansweredQuestion
tagged with: jpanel
tagged with: image
score: 0
has title: saving panel as an image
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25461195
tagged with: swing
has body: My panel is saved as jpeg image but drawings are not visible. here is my code BufferedImage img = new BufferedImage(painting.panel.getWidth(), painting.panel.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g1 = img.createGraphics(); painting.panel.paintAll(g1); try { ImageIO.write(img, "jpeg", new File(fd.getDirectory()+"\\"+fd.getFile()+".jpeg")); System.out.println("panel saved as image"); } catch (Exception e) { System.out.println("panel not saved" + e.getMessage()); } But when i open file, drawings are not visible.

http://stackoverflow.com/q/25475541
has body: how to play video view in a small size in portrait and full screen in landscape? Uri uri = Uri.parse(videoDetail.getVideoPath()); // Uri uri = Uri.parse("http://daily3gp.com/vids/747.3gp"); VideoView videoView = (VideoView) findViewById(R.id.videoPlayer); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); mediaController.setMediaPlayer(videoView); videoView.setMediaController(mediaController); videoView.setVideoURI(uri); videoView.start();
tagged with: video
score: 1
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25475865
has answer: http://stackoverflow.com/a/25476509
answer count: 4
type: Question
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25482827
tagged with: web-services
downvote count: 1
has title: video view in landscape
has comment: http://stackoverflow.com/comment/39758097
favorite count: 0
has answer: http://stackoverflow.com/a/25475929

http://stackoverflow.com/comment/56481782
comment on: http://stackoverflow.com/a/25477567
type: Comment
type: AnswerComment
score: 0
has text: The OP should answer this because I went off his question;

http://stackoverflow.com/q/25421513
has body: I would like to listen to events when clicked on Ok and Cancel buttons in CheckBoxListComboBox Does any one know how to register for events on Ok and Cancel buttons? If the events registration is not possible, can we override the Ok and cancel buttons of our own?
answer count: 1
accepted answer: http://stackoverflow.com/a/25456822
type: AnsweredQuestion
score: 0
has title: Ok and cancel button handle in Jide CheckBoxListComboBox
tagged with: java
tagged with: jide
type: Question
has answer: http://stackoverflow.com/a/25456822

http://stackoverflow.com/comment/39709722
has text: Do you have your connection set up properly?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25449800

http://stackoverflow.com/a/25479913
has comment: http://stackoverflow.com/comment/39766011
type: Answer
has comment: http://stackoverflow.com/comment/39766257
has comment: http://stackoverflow.com/comment/39783837
has body: Your mUserNameRetrieved variable is not receiving any value. Try to SysOut its value or put some condition check so that if it will not receive any value then it will not give an error(use condition only if required).
score: 1
answers question: http://stackoverflow.com/q/25479784
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39617605
type: QuestionComment
comment on: http://stackoverflow.com/q/25400250
type: Comment
score: 0
has text: @Smutje I placed a breakpoint inside the method the assert is supposert to call like `assert foo()` so i placed a breakpoint (remote debug to server) inside `foo()` and I see I reach that method from the assert stack.

http://stackoverflow.com/comment/39987124
comment on: http://stackoverflow.com/a/25442486
type: AnswerComment
has text: @b16db0 in the constructor yes but how do you know that the ```getCanonicalPath()``` or even the constructor don't use some randomized/volatile values to initialize the state/produce the result?
score: 1
type: Comment

http://stackoverflow.com/comment/39760033
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25476790
has text: I'm dumb as bread. I tried calling the `TimerTask` using `.run()` instead of with a `Timer`. It works now, but I prefer your `AsyncTask` approach. Thank you.
type: Comment

http://stackoverflow.com/comment/39841281
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25520000
has text: Try looking up observer pattern. Looks like it might be what you are looking for. Or if you want a minimum working setup, have B be a property in A. On method call to process A, make a call to process B when it is done, and return C. This tightly couples your code and is not recommended. I bring it up for sake of having something working to start with
score: 0

http://stackoverflow.com/q/25474947
type: AnsweredQuestion
downvote count: 0
upvote count: 1
score: 1
tagged with: java
answer count: 1
favorite count: 0
type: Question
has body: i am trying to build a hex string to be used as a hex code for a color background. i have the conversion done, but there is an issue when the "converted" string is less than 16--because the the number is only one digit long. you will see in my code that i tried making a method that check id the string is to short, then pads a 0 in front if it is...but i can't get it to ever do the padding. so i end up still with a string of length 1. package com.example.android.test; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.NumberPicker; import android.widget.NumberPicker.OnValueChangeListener; public class MainActivity extends Activity { static final int MIN_VAL = 0; static final int MAX_VAL = 255; NumberPicker alpha, red, green, blue; View view; String redVal = "00", blueVal = "00", greenVal = "00", alphaVal = "FF"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); alpha = (NumberPicker) findViewById(R.id.alphaPicker); red = (NumberPicker) findViewById(R.id.redPicker); green = (NumberPicker) findViewById(R.id.greenPicker); blue = (NumberPicker) findViewById(R.id.bluePicker); alpha.setMinValue(MIN_VAL); alpha.setMaxValue(MAX_VAL); alpha.setWrapSelectorWheel(false); red.setMinValue(MIN_VAL); red.setMaxValue(MAX_VAL); red.setWrapSelectorWheel(false); green.setMinValue(MIN_VAL); green.setMaxValue(MAX_VAL); green.setWrapSelectorWheel(false); blue.setMinValue(MIN_VAL); blue.setMaxValue(MAX_VAL); blue.setWrapSelectorWheel(false); view = findViewById(R.id.color_box); view.setBackgroundColor(0xFF808000); alpha.setOnValueChangedListener(new OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int newVal) { // TODO Auto-generated method stub alphaVal = Integer.toHexString(newVal); pad(alphaVal); String color = generateColor(alphaVal, redVal, greenVal, blueVal); // view.setBackgrou…
tagged with: android-layout
has answer: http://stackoverflow.com/a/25475178
accepted answer: http://stackoverflow.com/a/25475178
tagged with: android
has title: padding a hex string in java

http://stackoverflow.com/q/25394879
tagged with: java
tagged with: jdeveloper
type: Question
answer count: 0
type: UnansweredQuestion
score: 1
downvote count: 0
upvote count: 1
has title: How to control Java class diagrams in jDeveloper 12c
favorite count: 0
tagged with: class-diagram
has body: Consider the following classes. public class Vector { public Vector() { super(); } } public class Observation { private Vector vec1; private Vector vec2; private Vector vec3; private Vector vec4; private Vector vec5; public Observation() { super(); } } Observation and Vector are associated because Observation's members are all Vectors. If I create a Java class diagram in jDeveloper 12c, I get the following model: Notice that there is an association edge for each Vector member of Observation. I don't want this! I've figured out how to mitigate some of the problem (it had previously also included the member name at the end of each edge!), but I can't figure out how to get rid of the extra association edges all together. I simply want ONE edge that shows that there is in fact an association. I have considered hiding all the superfluous edges... but that is labor intensive. Surely there is an option somewhere to turn this off. I have yet to find it, though, either on my own or through searching forum posts. Thank you for your help in advance.
tagged with: model-associations

http://stackoverflow.com/q/25507177
downvote count: 0
upvote count: 1
type: UnansweredQuestion
answer count: 1
favorite count: 0
type: Question
score: 1
tagged with: android
tagged with: java
has body: I want a server to validate a client through a certificate. I have the certificate user_cert.pem and the key user_cert.pkey stored locally. How will i do an httpsURLconnection authenticating the client to the server? I have searched, but i am a little bit confused. I found this link . The problem is that my certificate is in *.pem format. Should i set the KeyStore like this? KeyStore ks = KeyStore.getInstance("PEM"); Sorry, if i give vague information, but i think there is not enough documentation. I found a post describing android supports certificates only in BKS Format and if we have certificates in PEM format, we should change them into BKS format through the Portecle GUI software. I just ask for any source for information about client certificates in PEM format in android .
tagged with: ssl
linked to: http://stackoverflow.com/q/4064810
tagged with: httpurlconnection
tagged with: pem
has title: Client Certificates in android
has answer: http://stackoverflow.com/a/25508230

http://stackoverflow.com/a/25521008
answers question: http://stackoverflow.com/q/25520980
upvote count: 2
downvote count: 0
type: Answer
score: 2
has body: Overloaded method is called on the basis of best/closest match. Object is the top level class, which means this will be matched at the last. So matching starts with the method taking String parameter, as string can be null so it is matched and called.

http://stackoverflow.com/q/25471433
type: Question
has body: I am trying to display text in the text view based on information on Parse. For instance, in this case, I am trying to display the activity name of a user. Below is the code query2.findInBackground(new FindCallback&lt;ParseUser&gt;() { public void done(List&lt;ParseUser&gt; userlistactivityname, ParseException e) { if (e == null) { TextView text=(TextView)getActivity().findViewById(R.id.userlistactivityname); text.get("ActivityName").setText(); } else { } } }); layout &lt;TextView android:id="@+id/userlistactivityname" android:layout_width="220dp" android:layout_height="50dp" android:cacheColorHint="@android:color/transparent" android:layout_below="@+id/textView1" android:layout_toLeftOf="@+id/imageView2" android:divider="@null" &gt; &lt;/TextView&gt; Below is the entire code public interface Constants { String LOG = "com.dooba.beta"; } private String currentUserId; private ArrayAdapter&lt;String&gt; namesArrayAdapter; private ArrayList&lt;String&gt; names; private ArrayList&lt;String&gt; age; private ArrayList&lt;String&gt; headline; private ArrayList&lt;String&gt; activityname; private ArrayList&lt;Images&gt; alProfilePicture; private ListView usersListName; private ListView usersListHeadline; private ListView usersListActivityname; private Button logoutButton; String userGender = ParseUser.getCurrentUser().getString("Gender"); String activityName = ParseUser.getCurrentUser().getString("ActivityName"); Number maxDistance = ParseUser.getCurrentUser().getNumber( "Maximum_Distance"); String userLookingGender = ParseUser.getCurrentUser().getString( "Looking_Gender"); Number minimumAge = ParseUser.getCurrentUser().getNumber("Minimum_Age"); Number maximumAge = ParseUser.getCurrentUser().getNumber("Maximum_Age"); Number userage = ParseUser.getCurrentUser().getNumber("Age"); @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setConversationsList(); } @Override public View onCreateView(LayoutInflater inflater, …
tagged with: android-layout
tagged with: parse-platform
has answer: http://stackoverflow.com/a/25512646
tagged with: android
has title: Displaying information from Parse on a textview
type: AnsweredQuestion
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25512646
tagged with: android-fragments
accepted answer: http://stackoverflow.com/a/25512782
tagged with: java
has answer: http://stackoverflow.com/a/25512782

http://stackoverflow.com/comment/39735502
has text: What makes it safe is to *always* access the shared count variable using a synchronized block, and to always use the *same* object as monitor. Whether this monitor is `SharedCounter.class` or any other object doesn't change anything.
comment on: http://stackoverflow.com/q/25463440
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/39845358
has text: Why is this tagged Python?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25522833
type: QuestionComment

http://stackoverflow.com/comment/39891411
comment on: http://stackoverflow.com/a/25547356
type: Comment
type: AnswerComment
has text: thanks, both worked for me, but this explained what i was doing wrong, many thanks.
score: 0

rss
type: Tag
tags question: http://stackoverflow.com/q/25392988
tags question: http://stackoverflow.com/q/25432031
tag name: rss
tags question: http://stackoverflow.com/q/25501970
tags question: http://stackoverflow.com/q/25522564
tags question: http://stackoverflow.com/q/25488529
tags question: http://stackoverflow.com/q/25524946
tags question: http://stackoverflow.com/q/25391038

http://stackoverflow.com/q/25486782
has comment: http://stackoverflow.com/comment/39800257
has title: How to compare json object with the document having same value store in mongodb using java
has comment: http://stackoverflow.com/comment/39778274
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/39802874
has comment: http://stackoverflow.com/comment/39800201
tagged with: mongodb-query
has body: I am trying to compare json with the document having same values in MongoDb. But it returns false whether both are same or not. So guys,let me help I have given details about my code to get help you. **//comparison code** DBObject dbObject = (DBObject)JSON.parse(json4); boolean val=collection.equals(dbObject); System.out.println(val); System.out.println(dbObject); **//document stored into 'dummyColl' collection** > db.dummyColl.find().pretty(); { "_id" : "11", "xml" : "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?> yong11 mook kim11</nickn ame> mkyong11 10000011 <curre ntAddress>Bhopal11 pune11 999999999 11 test11@basex.com testA11@b asex.com Tom11 " **//json to compare with document stored into 'dummyColl' collection** { "_id" : "11" , "xml" : "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?> yong11 mook kim11 mkyong11 10000011 Bhopal11 pune11 99999999911 test11@basex.com testA11@basex.com Tom11 "}
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/39802148
score: 0
tagged with: mongodb
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25505751
has comment: http://stackoverflow.com/comment/39815402
tagged with: jar
tagged with: maven
has comment: http://stackoverflow.com/comment/39813940
has answer: http://stackoverflow.com/a/25520710
upvote count: 2
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/25520710
answer count: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/28233290
tagged with: meta-inf
has answer: http://stackoverflow.com/a/25505925
possible better answer: http://stackoverflow.com/a/25505925
has body: I've just started to use Maven and I am having trouble creating a JAR of all my classes. In fact, I have to include a service located at WEB-INF/services/javax.annotation.processing.Processor I've tested different issues with this problem and it appears that when I remove the /services directory, the JAR contains all the .class files. I read that it could be a wrong Maven folder structure but the problem occurs just when I have the servicesdirectory present. Here is an extract of my pom.xml file working with resources: ${myRessources} META-INF/**/* The maven console tell me that the resource is successfully copied so I assume this part is not the problem. Any ideas?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39814009
has comment: http://stackoverflow.com/comment/39813864
has title: No .class file in the jar when adding a META-INF/services directory

http://stackoverflow.com/q/25401124
score: 54
has answer: http://stackoverflow.com/a/45856615
has answer: http://stackoverflow.com/a/64389809
favorite count: 0
tagged with: git
possible better answer: http://stackoverflow.com/a/51746690
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/68902196
has answer: http://stackoverflow.com/a/51746690
has answer: http://stackoverflow.com/a/60817516
has body: When I try to use ctrl+space this error is shown: This compilation unit is not on the build path of a Java project. I see that there are similar topics but my work environment is Eclipse and i pull my project from Git (I import project as general project) and i use Apache Ant. Can anyone help me?
tagged with: ant
tagged with: java
linked to: http://stackoverflow.com/q/60817455
has comment: http://stackoverflow.com/comment/39619425
upvote count: 54
answer count: 11
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39619170
type: Question
accepted answer: http://stackoverflow.com/a/25401489
has answer: http://stackoverflow.com/a/55733198
has comment: http://stackoverflow.com/comment/39619100
has title: This compilation unit is not on the build path of a Java project
has answer: http://stackoverflow.com/a/25401489
has answer: http://stackoverflow.com/a/60749249
has answer: http://stackoverflow.com/a/76509901
has answer: http://stackoverflow.com/a/72391914
has answer: http://stackoverflow.com/a/44134351
downvote count: 0
has comment: http://stackoverflow.com/comment/125781307
has comment: http://stackoverflow.com/comment/39619692

http://stackoverflow.com/comment/39863375
has text: Thank you very much for your attention to this. It will be very helpful.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25529791

http://stackoverflow.com/a/25397186
answers question: http://stackoverflow.com/q/25397145
has body: hasNext()- "Returns true if the iteration has more elements" So you can check if there are more objects you can get from the iterator, and if there are it returns true. If there are no more objects it will return false. next() - "Returns the next element in the iteration" So if there is a next item, it will be returned. If there isn't it'll throw a 'NoSuchElementException', but if you use iterators properly you should never encounter it.
type: Answer
score: 0

http://stackoverflow.com/q/25467921
accepted answer: http://stackoverflow.com/a/25467997
type: AnsweredQuestion
score: 0
has body: I'm using @ElementCollectionon a set for role types but its inserting the first primary key that is being tested while it adds the third entry but is a duplicate key. Its the wrong key. I"m not sure if its in my test or essentially how I'm executing entity manager. As you can see the user_id only has the first ID and not the second id on user Role table. DAO @Entity @Table(name = "users") public class DefaultUser implements Serializable { @Id @SequenceGenerator(name="user_id_seq_gen", sequenceName="USER_ID_SEQ") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="user_id_seq_gen") @Column(name = "user_id", nullable = false) @OrderColumn private long user_id; @Column(name = "user_name") private String user_name; @Column(name = "first_name") private String firstName; @Column(name = "last_name") private String lastName; @Column(name = "password") private String password; @ElementCollection(targetClass=UserType.class, fetch = FetchType.EAGER) @CollectionTable( name="user_roles", joinColumns=@JoinColumn(name="user_id") ) @Enumerated(EnumType.STRING) @Column(name="role_type") @OrderColumn private Set&lt;UserType&gt; userRoleSet = new HashSet&lt;UserType&gt;(); //getters and setters } Test Method public class UserDTOTest { JpaUserDAO userDAO = new JpaUserDAO(EntityManagerUtil.getEntityManager()); DefaultUser user = new DefaultUser(); user.setUser_name("user"); user.setPassword("ddafsf"); user.setFirstName("dadafddfsffsd"); user.setLastName("dafddfafdfsasdf"); Set&lt;UserType&gt; userTypeSet = new HashSet&lt;UserType&gt;(); userTypeSet.add(UserType.BROKER); userTypeSet.add(UserType.SHAREHOLDER); user.setUserRoleSet(userTypeSet); userDAO.persist(user); //JpaUserDAO userDAO1 = new JpaUserDAO(EntityManagerUtil.getEntityManager()); DefaultUser user2 = new DefaultUser(); user2.setUser_name("user1"); user2.setPassword("a342fsd"); user2.setFirstName("some54thing"); user2.setLastName("diff435ernt"); Set&lt;UserType&gt; userTypeSet2 = new HashSet&lt;UserType&gt;(); userType…
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25467997
type: Question
tagged with: jpa
answer count: 1
has title: JPA - Wrong repeated foreign key

http://stackoverflow.com/comment/39764211
has text: Yes I think it is null, when I put android:text="0" on the layout XML. Like Andrew T. told me. Then I dont have error in compilation. But then I have '0' in my inputbox not my text from "hint"
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25478911
type: AnswerComment

http://stackoverflow.com/comment/39842396
has text: @Zhuinden - It will compile :)
score: 0
comment on: http://stackoverflow.com/q/25520980
type: Comment
type: QuestionComment

jdo
tags question: http://stackoverflow.com/q/25398118
tags question: http://stackoverflow.com/q/25483495
tags question: http://stackoverflow.com/q/25436114
type: Tag
tags question: http://stackoverflow.com/q/25525847
tag name: jdo
tags question: http://stackoverflow.com/q/25474353

http://stackoverflow.com/comment/39767877
has text: Sorry i'm mistake about said rs return null.It is empty.
comment on: http://stackoverflow.com/q/25480529
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39777148
has text: I want to add an offer to this answer. Just to stop phone from periodically wasting resources you can do next. Every next time myltiply delay on some value. For example 2. So you will scan for networks in: 5, 10, 20, 40 seconds. And according to your application logic sometimes drop this value to 1, to scan with beginning values.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25485980
type: AnswerComment

http://stackoverflow.com/comment/39669196
score: 0
has text: Versions are ok. I did , I installed the inner one first.
comment on: http://stackoverflow.com/q/25391203
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25499579
has comment: http://stackoverflow.com/comment/39803215
favorite count: 0
upvote count: 11
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25542019
has body: In pom of A.B.C i have defined a property as abc where A B C are modules. Now i want to access that property in pom of A.D.F module. <A.B.C>${buildNumber}</A.B.C> org.codehaus.mojo buildnumber-maven-plugin 1.3 buildnumber validate create {0,date,dd-MM-yyyy HH:mm:ss} false false <providerImplementations> javasvn </providerImplementations> Build: #{0} ({1,date}) buildNumber\d* timestamp com.google.code.maven-scm-provider-svnjava maven-scm-provider-svnjava 2.1.1 org.tmatesoft.svnkit svnkit 1.8.5 I am using ${A.B.C} as value of version in a dependency in A.D.F module's pom. ${A.B.C} bundle So it is giving me error: bundle must be a valid version but is ${A.B.C}. EDIT: or can i use version of C module in someway as i have defined: ${A.B.C}
downvote count: 0
tagged with: maven
score: 11
linked to: http://stackoverflow.com/q/14725197
tagged with: buildnumber-maven-plugin
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25542019
has title: how to access properties defined in other module pom in maven multimodule project
tagged with: java
has answer: http://stackoverflow.com/a/25499687
possible better answer: http://stackoverflow.com/a/25499687
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/39802988

http://stackoverflow.com/comment/39885256
type: Comment
type: QuestionComment
has text: This is just a wild guess, but the project itself is not include twice maybe. (Once as project / once as a jar?)
score: 0
comment on: http://stackoverflow.com/q/25529056

http://stackoverflow.com/comment/39890168
has text: Have you tried reading the Proguard documentation? For example, this section: http://proguard.sourceforge.net/manual/usage.html#classspecification ???
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25547354
type: QuestionComment

http://stackoverflow.com/comment/39694582
comment on: http://stackoverflow.com/q/25441723
score: 1
type: Comment
has text: Define what you mean by "delete the position". What happens, and what would you want to happen instead? HashMaps don't have "positions", so it's quite hard to understand what you mean. Also, your code will lead to ConcurrentModificationException. Use the iterator to remove the entry.
type: QuestionComment

http://stackoverflow.com/q/25401884
favorite count: 0
type: Question
type: UnansweredQuestion
has body: I want to update the UI during an intensive task. I've got a separate thread where the intensive method runs but I can't update the UI... This is the structure of my code: btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { updateUI(); Thread t = new Thread(){ @Override public void run(){ runIntensiveMethod(); } } t.start(); } }); If I comment runIntensiveMethod(); the animation runs perfectly fine. However, it seems as though the UI queue is delayed until the method is run. How can I post an animation and run the method while the animation runs? Everything I've tried halts the UI until the method has been executed.
tagged with: android
has answer: http://stackoverflow.com/a/25401988
has title: Android - updating UI during intensive task?
tagged with: animation
answer count: 3
has answer: http://stackoverflow.com/a/26171190
score: 1
tagged with: java
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/81531132
has answer: http://stackoverflow.com/a/25401995

http://stackoverflow.com/comment/39766550
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25469516
score: 0
has text: AsI said: it's a class below com.sun, and these aren't meant to be used in everyday application code; also note the comment "subject to change w.o. further notice". All of JAXB you are likely to need is available via javax.xml.bind. Why can't you use JAXBContext?

http://stackoverflow.com/comment/39827662
comment on: http://stackoverflow.com/a/25493170
type: Comment
type: AnswerComment
has text: @ ToasteR...thank you for reply and code...I am editing my code..will let you know shortly...
score: 0

http://stackoverflow.com/q/25464336
answer count: 1
linked to: http://stackoverflow.com/q/5824049
has comment: http://stackoverflow.com/comment/39736929
has title: I can't connect my pc using external ip with Java.Socket
has answer: http://stackoverflow.com/a/25466342
has comment: http://stackoverflow.com/comment/39736903
score: 0
has comment: http://stackoverflow.com/comment/39736931
tagged with: java
tagged with: external
tagged with: ip
type: Question
has comment: http://stackoverflow.com/comment/39736980
type: UnansweredQuestion
tagged with: sockets
has body: I made a simple socket application using Java.Sockets. I ran client and the server at the same pc which is connected a modem with some other pcs. Client can connect to server with my local ip. But when it try to connect with external ip it fails. Here the server code: int portno=Integer.parseInt(args[0]); ServerSocket ssock = new ServerSocket(portno); while(true){ Socket csock = ssock.accept(); PrintWriter out = new PrintWriter(csock.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader(csock.getInputStream())); String buffer = in.readLine(); System.out.println(buffer); csock.close(); } And client code: public static void main(String args[]) throws Exception{ String ip="My External IP"; int port=Integer.parseInt(args[0]); Socket sock = new Socket(ip,port); PrintWriter out = new PrintWriter(sock.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader(sock.getInputStream()) ); BufferedReader stdin = new BufferedReader( new InputStreamReader(System.in) ); String buffer=stdin.readLine(); out.println(buffer); sock.close(); }

http://stackoverflow.com/q/25519736
has answer: http://stackoverflow.com/a/25519838
has answer: http://stackoverflow.com/a/25520461
possible better answer: http://stackoverflow.com/a/25520461
has comment: http://stackoverflow.com/comment/39839934
answer count: 7
has answer: http://stackoverflow.com/a/25519798
downvote count: 1
has title: How to test that a exception is thrown and caught in junit
has comment: http://stackoverflow.com/comment/39840491
favorite count: 0
has answer: http://stackoverflow.com/a/25520105
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25519948
score: 1
tagged with: java
tagged with: junit
has answer: http://stackoverflow.com/a/25520042
has comment: http://stackoverflow.com/comment/39841228
type: Question
has comment: http://stackoverflow.com/comment/39840747
accepted answer: http://stackoverflow.com/a/25519948
has comment: http://stackoverflow.com/comment/39840893
has answer: http://stackoverflow.com/a/25520074
has body: I need to test the following code: try{ while((testBean = csvReader.read(TestBean.class,headers,getCellProcessors()))!=null){ System.out.println("no excpetion"); i=5; } }catch(SuperCsvException csvExc){ System.out.println("superCSV excpetion"); i=0; }catch(Exception ex){ System.out.println("excpetion"); i=0; } How to test that whether SuperCsvException is thrown and caught.
has comment: http://stackoverflow.com/comment/39840051
upvote count: 2

http://stackoverflow.com/q/25447799
tagged with: java
has comment: http://stackoverflow.com/comment/39707097
has comment: http://stackoverflow.com/comment/39713579
score: 2
has comment: http://stackoverflow.com/comment/39723936
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/29280631
tagged with: itext
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39714053
has title: How are iText PdfAnnotation Polyline vertices specified?
type: UnansweredQuestion
has body: I'm trying to create a PdfAnnotation consisting of, for a simple example, an X pattern which I assume would be a SUBTYPE of POLYLINE (one or more discontiguous line segments?). If so then I think I'm providing the vertices incorrectly. If I specify vertices like this: put(PdfName.SUBTYPE, PdfName.POLYGON); float[] coords = { 100f, 100f, 200f, 200f, 100f, 200f, 200f, 100f }; put(PdfName.VERTICES, new PdfArray(coords)); The following is generated: 2 0 obj &lt;&lt;/C[1 1 0]/Type/Annot/Contents(contents)/Title(title)/Subtype/Polygon/Rect[99 99 201 201]/Vertices[100 100 200 200 100 200 200 100]&gt;&gt; and I get a yellow hourglass shape as expected, annotation title/contents are loaded correctly, and the annotation appears in the Acrobat Comments List. But if I change POLYGON to POLYLINE (hoping to get an X instead of an hourglass), the (almost) identical PDF code is generated (Polyline replaces Polygon): 2 0 obj &lt;&lt;/C[1 1 0]/Type/Annot/Contents(contents)/Title(title)/Subtype/Polyline/Rect[99 99 201 201]/Vertices[100 100 200 200 100 200 200 100]&gt;&gt; but a question mark appears instead of any line segments and no annotation appears in the Comments List. I’ve tried variations such as trying to create a PdfArray of PdfArrays, placing all x-coords first, then all y-coords, etc. I have itext-pdfa-5.3.4 jars loaded.

session
tags question: http://stackoverflow.com/q/25542095
tags question: http://stackoverflow.com/q/25499776
tags question: http://stackoverflow.com/q/25395903
tags question: http://stackoverflow.com/q/25526562
tags question: http://stackoverflow.com/q/25478867
tags question: http://stackoverflow.com/q/25498303
tags question: http://stackoverflow.com/q/25500328
tags question: http://stackoverflow.com/q/25406985
tags question: http://stackoverflow.com/q/25476707
tag name: session
tags question: http://stackoverflow.com/q/25472444
tags question: http://stackoverflow.com/q/25523581
tags question: http://stackoverflow.com/q/25449483
tags question: http://stackoverflow.com/q/25486352
type: Tag
tags question: http://stackoverflow.com/q/25433224
tags question: http://stackoverflow.com/q/25419004

messaging
tags question: http://stackoverflow.com/q/25521390
tag name: messaging
type: Tag
tags question: http://stackoverflow.com/q/25460568

http://stackoverflow.com/comment/39888226
has text: How you expect to use it. You can look at Map interface (HashMap for example) if you need to store dinamic name-value pair.
score: 0
comment on: http://stackoverflow.com/a/25546479
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25441010
has comment: http://stackoverflow.com/comment/39890350
score: 0
tagged with: playframework
tagged with: java
answer count: 1
has body: I'm using play-1.3, and I saw there's an play javadoc command, but it doesn't work for me. The command line tells me everything is done, and I should be able to read find the doc under javadoc directory. But there's nothing there, just an empty directory. ./play javadoc project_name Generating Javadoc in /Users/xxx/play-1.3/project_name/javadoc... Done! You can open /Users/xxx/play-1.3/project_name/javadoc/overview-tree.html in your browser.
type: Question
has answer: http://stackoverflow.com/a/25451522
tagged with: playframework-1.x
type: UnansweredQuestion
has title: playframework1.3 : How to generate javadoc?

http://stackoverflow.com/comment/39632502
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25390782
has text: Yes, a `Set` is not indexed. Also it does not use `equals`, as I pointed out - it uses `compareTo`. A `SortedSet` is **very** different to a `List`. You should be able to write a simple wrapper over an `ArrayList` that uses a `ReentrantReadWriteLock` and a variant on an Insertion Sort to achieve `O(n)` `add` (amortised). If you need faster performance than that you are going to have to look at more advanced tree/heap structures.
type: QuestionComment

http://stackoverflow.com/comment/39758500
score: 0
type: Comment
type: AnswerComment
has text: @user3907211 so what is at line 154 of Fragment1.java?
comment on: http://stackoverflow.com/a/25475833

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/25490820
tags question: http://stackoverflow.com/q/25490988
tags question: http://stackoverflow.com/q/25539104
tags question: http://stackoverflow.com/q/25483061
tags question: http://stackoverflow.com/q/25521097
tags question: http://stackoverflow.com/q/25491379
tags question: http://stackoverflow.com/q/25411157
tags question: http://stackoverflow.com/q/25533062
tags question: http://stackoverflow.com/q/25461462
tags question: http://stackoverflow.com/q/25400916
tags question: http://stackoverflow.com/q/25415049
tags question: http://stackoverflow.com/q/25399971
tags question: http://stackoverflow.com/q/25420660
tags question: http://stackoverflow.com/q/25536053
tags question: http://stackoverflow.com/q/25417504
tags question: http://stackoverflow.com/q/25511693
tags question: http://stackoverflow.com/q/25410483
tags question: http://stackoverflow.com/q/25529002
tags question: http://stackoverflow.com/q/25436244
tags question: http://stackoverflow.com/q/25416475
tags question: http://stackoverflow.com/q/25505358
tags question: http://stackoverflow.com/q/25417583
tags question: http://stackoverflow.com/q/25447957
tags question: http://stackoverflow.com/q/25440427
type: Tag
tags question: http://stackoverflow.com/q/25468416
tag name: html
tags question: http://stackoverflow.com/q/25419787
tags question: http://stackoverflow.com/q/25535604
tags question: http://stackoverflow.com/q/25460818
tags question: http://stackoverflow.com/q/25491424
tags question: http://stackoverflow.com/q/25502261
tags question: http://stackoverflow.com/q/25499361
tags question: http://stackoverflow.com/q/25525421
tags question: http://stackoverflow.com/q/25463151
tags question: http://stackoverflow.com/q/25464463
tags question: http://stackoverflow.com/q/25517353
tags question: http://stackoverflow.com/q/25435312
tags question: http://stackoverflow.com/q/25457289
tags question: http://stackoverflow.com/q/25441784
tags question: http://stackoverflow.com/q/25450036

mysql
tags question: http://stackoverflow.com/q/25399123
tags question: http://stackoverflow.com/q/25524794
tags question: http://stackoverflow.com/q/25488572
tags question: http://stackoverflow.com/q/25425317
tags question: http://stackoverflow.com/q/25434269
tags question: http://stackoverflow.com/q/25523950
tags question: http://stackoverflow.com/q/25519401
tags question: http://stackoverflow.com/q/25533442
tags question: http://stackoverflow.com/q/25426101
tags question: http://stackoverflow.com/q/25494214
tags question: http://stackoverflow.com/q/25485434
tags question: http://stackoverflow.com/q/25435785
tags question: http://stackoverflow.com/q/25440284
tags question: http://stackoverflow.com/q/25448611
type: Tag
tags question: http://stackoverflow.com/q/25480529
tags question: http://stackoverflow.com/q/25464316
tags question: http://stackoverflow.com/q/25431570
tags question: http://stackoverflow.com/q/25538246
tags question: http://stackoverflow.com/q/25396708
tags question: http://stackoverflow.com/q/25402830
tags question: http://stackoverflow.com/q/25474261
tags question: http://stackoverflow.com/q/25462270
tag name: mysql
tags question: http://stackoverflow.com/q/25452866
tags question: http://stackoverflow.com/q/25546678
tags question: http://stackoverflow.com/q/25539347
tags question: http://stackoverflow.com/q/25442822
tags question: http://stackoverflow.com/q/25526374
tags question: http://stackoverflow.com/q/25419798
tags question: http://stackoverflow.com/q/25517612
tags question: http://stackoverflow.com/q/25545728
tags question: http://stackoverflow.com/q/25411703
tags question: http://stackoverflow.com/q/25522057
tags question: http://stackoverflow.com/q/25475989
tags question: http://stackoverflow.com/q/25513095
tags question: http://stackoverflow.com/q/25504562
tags question: http://stackoverflow.com/q/25483863
tags question: http://stackoverflow.com/q/25485086
tags question: http://stackoverflow.com/q/25498067
tags question: http://stackoverflow.com/q/25482241
tags question: http://stackoverflow.com/q/25419488
tags question: http://stackoverflow.com/q/25443827
tags question: http://stackoverflow.com/q/25520498
tags question: http://stackoverflow.com/q/25407352
tags question: http://stackoverflow.com/q/25506749
tags question: http://stackoverflow.com/q/25420999
tags question: http://stackoverflow.com/q/25406887
tags question: http://stackoverflow.com/q/25460410
tags question: http://stackoverflow.com/q/25391409
tags question: http://stackoverflow.com/q/25541588
tags question: http://stackoverflow.com/q/25529314
tags question: http://stackoverflow.com/q/25458027
tags question: http://stackoverflow.com/q/25440882
tags question: http://stackoverflow.com/q/25426841
tags question: http://stackoverflow.com/q/25444398
tags question: http://stackoverflow.com/q/25462646
tags question: http://stackoverflow.com/q/25509290
tags question: http://stackoverflow.com/q/25499620
tags question: http://stackoverflow.com/q/25448100
tags question: http://stackoverflow.com/q/25454703
tags question: http://stackoverflow.com/q/25504450
tags question: http://stackoverflow.com/q/25450510
tags question: http://stackoverflow.com/q/25522770
tags question: http://stackoverflow.com/q/25392656
tags question: http://stackoverflow.com/q/25426048
tags question: http://stackoverflow.com/q/25496484
tags question: http://stackoverflow.com/q/25505028
tags question: http://stackoverflow.com/q/25426232
tags question: http://stackoverflow.com/q/25414385
tags question: http://stackoverflow.com/q/25513513
tags question: http://stackoverflow.com/q/25446300
tags question: http://stackoverflow.com/q/25404511
tags question: http://stackoverflow.com/q/25442120
tags question: http://stackoverflow.com/q/25451873
tags question: http://stackoverflow.com/q/25483296
tags question: http://stackoverflow.com/q/25437929
tags question: http://stackoverflow.com/q/25439565
tags question: http://stackoverflow.com/q/25484733
tags question: http://stackoverflow.com/q/25478390

http://stackoverflow.com/q/25451420
has body: Using "String concatenation" I can get a Class Object via its fully qualified class name: String s = "Foo";// package String s2 = "bar";// Class Class c=Class.forName(s+"."+s2); How do I do the Object equivalent: String s = "Foo";// portion of Object's name String s2 = "bar";// another portion of Object's name JButton foo_Bar = new JButton(); JButton o = Object.forName(s+"_"+s2);// Using "String concatenation" (key phrase) to obtain Object Or ANY WAY (simple or otherwise) that retains using "String concatenation"
has comment: http://stackoverflow.com/comment/39712381
has comment: http://stackoverflow.com/comment/39716524
linked to: http://stackoverflow.com/q/2770321
upvote count: 3
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39715804
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/39713635
has title: get object via "String concatenation"
favorite count: 0
has answer: http://stackoverflow.com/a/25452966
type: Question
has comment: http://stackoverflow.com/comment/39716578
has comment: http://stackoverflow.com/comment/39712453
type: UnansweredQuestion

http://stackoverflow.com/a/25427121
upvote count: 1
score: 1
downvote count: 0
has body: If we look at Oracle docs on int values We can find out that: The operators that work on the int primitive value do not indicate overflow or underflow The results are specified by the language and independent of the JVM version as folows: Integer.MAX_VALUE + 1 is the same as Integer.MIN_VALUE Integer.MIN_VALUE - 1 is the same as Integer.MAX_VALUE
type: Answer
answers question: http://stackoverflow.com/q/25426900

http://stackoverflow.com/a/25395527
has body: Kind of clunky, but this sample code seems to work: TableView table = new TableView&lt;&gt;(); private char nextChar = 'A'; private void addColumn(TableView table) { String mapChar = String.valueOf(nextChar++); TableColumn&lt;Map, String&gt; column = new TableColumn&lt;&gt;("Class " + mapChar); column.setCellValueFactory(new MapValueFactory(mapChar)); column.setMinWidth(130); column.setCellFactory(cellFactoryForMap); table.getColumns().add(column); } private void addRow(TableView table) { ObservableList&lt;Map&gt; allData = table.getItems(); int offset = allData.size(); Map&lt;String, String&gt; dataRow = new HashMap&lt;&gt;(); for (int j = 0; j &lt; table.getColumns().size(); j++) { String mapKey = Character.toString((char) ('A' + j)); String value1 = mapKey + (offset + 1); dataRow.put(mapKey, value1); } allData.add(dataRow); } }
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25395016
score: 9
upvote count: 9

http://stackoverflow.com/q/25491241
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39787450
has body: I have a question regarding the Mule Riak connector and its configuration possibilities. I would like to configure the connector using an HTTPS endpoint. Now the connector contains a org.mule.modules.riak.config.RiakHttpClientConfigurationAdapter and not the Mule HttpConnector. To make my approach more clear, I tried the following configuration: &lt;http:connector name="HTTP_HTTPS" cookieSpec="netscape" validateConnections="true" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" socketSoLinger="0" doc:name="HTTP-HTTPS" /&gt; &lt;spring:beans&gt; &lt;spring:bean id="riakclient" class="org.mule.modules.riak.config.RiakHttpClientConfigurationAdapter"&gt; &lt;spring:property name="httpClient" ref="HTTP_HTTPS"&gt;&lt;/spring:property&gt; &lt;/spring:bean&gt; &lt;/spring:beans&gt; Of course that fails: Cannot convert value of type [org.mule.transport.http.HttpConnector] to required type [org.apache.http.client.HttpClient] for property 'httpClient': no matching editors or conversion strategy found Now, can you think of a way to actually reuse an existing HttpConnector (with all that SSL configuration setup)? I actually don't want to configure a HttpClient again and add this to the riak client. EDIT 1: Updated with David's approach I added the following configuration straightforward to get the reflection part done: &lt;spring:beans&gt; &lt;!-- get class instance of HttpsConnector for reflection --&gt; &lt;spring:bean id="httpsConnectorClass" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"&gt; &lt;spring:property name="targetObject" ref="HTTP_HTTPS"&gt; &lt;/spring:property&gt; &lt;spring:property name="targetMethod"&gt; &lt;spring:value&gt;getClass&lt;/spring:value&gt; &lt;/spring:property&gt; &lt;/spring:bean&gt; &lt;!-- get method via reflection of HttpsConnector for reflection --&gt; &lt;spring:bean id="httpsConnectorMethod" class="org.springframework.beans.factory.config.MethodInvokingF…
type: UnansweredQuestion
tagged with: riak
tagged with: mule
tagged with: ssl
has title: Mule ESB Riak connector: How to configure HTTP over SSL endpoints
score: 1
has answer: http://stackoverflow.com/a/25495054
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39790407

http://stackoverflow.com/comment/44097370
has text: @Ovilia could you help me??
type: Comment
comment on: http://stackoverflow.com/a/25479138
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39829317
score: 0
has text: I edited your question to remove the new question. You should _try_ to implement it, then ask another question if/when you're unable to find a solution after researching.
comment on: http://stackoverflow.com/q/25512857
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25466440
has body: User user = new User("User", new Ticket("abc"), new Ticket("xyz")); The above is pure Java code, that has nothing to do with Hibernate. You are creating an instance of the User class (not Hibernate), and you are populating it with tickets (not Hibernate). The TreeSet is initialized by private SortedSet&lt;Ticket&gt; tickets = new TreeSet&lt;Ticket&gt;(); So, you're creating the set without providing a comparator. The set is thus sorted using the natural ordering of the Ticket class. But Ticket doesn't implement Comparable, hence the exception. If you ask Hibernate to get a user from the database, then Hibernate will create an instance of User, will replace your TreeSet with its own collection, using the comparator provided in the annotation, and your tickets will be sorted properly.
accepted answer of: http://stackoverflow.com/q/25466392
type: Answer
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25466392

http://stackoverflow.com/a/25485678
has body: It looks like element you try to click in disabled and click operation cannot be performed to this element. Try to perform click operation on another element e.g. on : driver.findElement(By.css(".title_button tr")).click();
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25485515
downvote count: 0

http://stackoverflow.com/a/25465919
has comment: http://stackoverflow.com/comment/39739988
upvote count: 4
score: 4
downvote count: 0
has body: Because they're synchronizing on different objects. Thread t synchs on t and c synchs on c. If you create a shared object f and put synchronized(f) in the methods, it'll work as you intend. For example put private final static Object lock = new Object(); in your A class, and put synchronized(lock) { // method body } inside read().
has comment: http://stackoverflow.com/comment/39740003
answers question: http://stackoverflow.com/q/25465912
type: Answer

servlets
tags question: http://stackoverflow.com/q/25460400
tags question: http://stackoverflow.com/q/25512316
tags question: http://stackoverflow.com/q/25449438
tags question: http://stackoverflow.com/q/25505138
tags question: http://stackoverflow.com/q/25476793
tags question: http://stackoverflow.com/q/25440502
tags question: http://stackoverflow.com/q/25546592
tags question: http://stackoverflow.com/q/25418087
tags question: http://stackoverflow.com/q/25521861
tags question: http://stackoverflow.com/q/25499766
tags question: http://stackoverflow.com/q/25492359
tags question: http://stackoverflow.com/q/25461253
tags question: http://stackoverflow.com/q/25463427
tags question: http://stackoverflow.com/q/25457546
tags question: http://stackoverflow.com/q/25448443
tags question: http://stackoverflow.com/q/25410137
tags question: http://stackoverflow.com/q/25397158
tags question: http://stackoverflow.com/q/25541564
tags question: http://stackoverflow.com/q/25529385
tags question: http://stackoverflow.com/q/25494391
tags question: http://stackoverflow.com/q/25491556
tags question: http://stackoverflow.com/q/25480675
tags question: http://stackoverflow.com/q/25421654
tags question: http://stackoverflow.com/q/25522226
tags question: http://stackoverflow.com/q/25439914
tags question: http://stackoverflow.com/q/25519894
tags question: http://stackoverflow.com/q/25400869
tags question: http://stackoverflow.com/q/25506006
tags question: http://stackoverflow.com/q/25501982
tags question: http://stackoverflow.com/q/25515248
tags question: http://stackoverflow.com/q/25480229
tags question: http://stackoverflow.com/q/25511352
tags question: http://stackoverflow.com/q/25546413
tags question: http://stackoverflow.com/q/25504928
tags question: http://stackoverflow.com/q/25462850
tags question: http://stackoverflow.com/q/25521386
tags question: http://stackoverflow.com/q/25497479
tags question: http://stackoverflow.com/q/25493177
tags question: http://stackoverflow.com/q/25524121
tags question: http://stackoverflow.com/q/25517824
tags question: http://stackoverflow.com/q/25396657
tags question: http://stackoverflow.com/q/25448179
tags question: http://stackoverflow.com/q/25425801
tags question: http://stackoverflow.com/q/25544059
tag name: servlets
tags question: http://stackoverflow.com/q/25522827
tags question: http://stackoverflow.com/q/25491428
tags question: http://stackoverflow.com/q/25400355
tags question: http://stackoverflow.com/q/25419741
tags question: http://stackoverflow.com/q/25407352
tags question: http://stackoverflow.com/q/25472055
tags question: http://stackoverflow.com/q/25449130
tags question: http://stackoverflow.com/q/25542561
tags question: http://stackoverflow.com/q/25406887
tags question: http://stackoverflow.com/q/25527781
tags question: http://stackoverflow.com/q/25525690
type: Tag
tags question: http://stackoverflow.com/q/25512055
tags question: http://stackoverflow.com/q/25501441
tags question: http://stackoverflow.com/q/25529012
tags question: http://stackoverflow.com/q/25522770
tags question: http://stackoverflow.com/q/25545174
tags question: http://stackoverflow.com/q/25507607
tags question: http://stackoverflow.com/q/25391418
tags question: http://stackoverflow.com/q/25444597
tags question: http://stackoverflow.com/q/25483296
tags question: http://stackoverflow.com/q/25535604
tags question: http://stackoverflow.com/q/25418672
tags question: http://stackoverflow.com/q/25462230
tags question: http://stackoverflow.com/q/25419004
tags question: http://stackoverflow.com/q/25442822
tags question: http://stackoverflow.com/q/25510085
tags question: http://stackoverflow.com/q/25398174
tags question: http://stackoverflow.com/q/25455638
tags question: http://stackoverflow.com/q/25534680
tags question: http://stackoverflow.com/q/25497909

http://stackoverflow.com/a/25530721
has comment: http://stackoverflow.com/comment/39859800
downvote count: 0
has comment: http://stackoverflow.com/comment/39859933
has comment: http://stackoverflow.com/comment/39860151
upvote count: 8
answers question: http://stackoverflow.com/q/25530696
type: Answer
has body: Your first example converts the octal value 17 to decimal, which is 15. Your second example converts the decimal value 17 to octal, which is 21. If you modify your second example to use 017 (octal 17), you'll get the same result.
score: 8
has comment: http://stackoverflow.com/comment/39859995

http://stackoverflow.com/comment/39904521
score: 0
type: Comment
type: AnswerComment
has text: I hope that I can get with it to a point where I could special case very few cases.
comment on: http://stackoverflow.com/a/25539283

http://stackoverflow.com/comment/39774826
score: 0
comment on: http://stackoverflow.com/q/25484784
type: Comment
type: QuestionComment
has text: To support API 21, I need to support API 20. I just don't want to support API 20.

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/25531466
type: Tag

http://stackoverflow.com/comment/39625789
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25401307
has text: The first snippet can only be a positive value instead of the second snippet that can be a negative or positive value. You're right I can't have a floating point, so my example is 1176

http://stackoverflow.com/comment/39930192
type: AnswerComment
has text: **logcat added** -just filling characters-
type: Comment
comment on: http://stackoverflow.com/a/25508308
score: 0

http://stackoverflow.com/q/25483735
has comment: http://stackoverflow.com/comment/39772454
favorite count: 0
linked to: http://stackoverflow.com/q/23792029
type: Question
has answer: http://stackoverflow.com/a/36572820
answer count: 2
has body: In my current application i need to maintain one config.properties file and from this properties file i need to get the data in my java file. I have placed the properties file and ConfigUtil.java which is accessing those properties files values are in the same location. But when i am running the application it's giving FileNotFoundException. I am not able to get why this is not loading the properties file when both are inside the same folder. My ConfigUtils.java code is : public class ConfigUtil { private Properties properties; InputStream inputStream = null; public Properties getUrl(){ properties = new Properties(); try { inputStream = new FileInputStream("config.properties"); properties.load(inputStream); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }finally { if(inputStream != null){ try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } return properties; } } and config.properties file is also in same folder location of config.properties is : /app/src/main/java/config.properties location of ConfigUtil.java is : /app/src/main/java.configutils.java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25484101
downvote count: 0
score: 13
has title: How to load .properties file data in android studio project
upvote count: 13
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/47852135

http://stackoverflow.com/comment/39738882
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25465411
type: Comment
has text: Its dangling pointer.

http://stackoverflow.com/q/25489664
linked to: http://stackoverflow.com/q/12909332
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39805201
linked to: http://stackoverflow.com/q/4208886
tagged with: static
answer count: 2
has comment: http://stackoverflow.com/comment/39784713
has comment: http://stackoverflow.com/comment/39787947
tagged with: android
has comment: http://stackoverflow.com/comment/39784318
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25489894
accepted answer: http://stackoverflow.com/a/25489871
has answer: http://stackoverflow.com/a/25489894
has title: Signing out from Google Plus api
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/39784272
has body: I have just integrated a Google+ Sign in button for my app. Everything works perfectly when you sign in, grant access and get the people information. However, I have a feeling I have one huge flaw in how I am doing this that may prevent a proper G+ sign out. I have a LoginActivity where I create the mGoogleApiClient instance. As soon as I do the Login Check and update my DB and var's with the persons info, I finish() theLoginActivity and go to my MainActivity. This is where the user can choose to sign out. However, I am afraid that I need the same instance of mGoogleApiClient; but this was wiped when I finished the LoginActivity. So I slightly modified things and tried to store it as a static var in another Activity I ahve where I use some variables globally -- that extends Application, but it doesn't seem to be signing out. Am I on the right path or do I need to do this differently?
tagged with: java
has answer: http://stackoverflow.com/a/25489871
downvote count: 0
has comment: http://stackoverflow.com/comment/39784354
has comment: http://stackoverflow.com/comment/39862103
tagged with: google-plus

http://stackoverflow.com/q/25404145
downvote count: 0
upvote count: 7
possible better answer: http://stackoverflow.com/a/55688913
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39624685
accepted answer: http://stackoverflow.com/a/25503853
score: 7
has title: Register font is corrupting .TTF file
favorite count: 0
has body: On my system I need to register two external font .TTF files: HamletOrNot.ttf (74 KB) MorrisRoman-Black.ttf (67 KB) Before creating the Font() objects, I record with the following commands: /* Set full path of font */ String path = filesPath + fileName; /* Read file */ Resource resource = applicationContext.getResource( path ); File fontFile = resource.getFile(); /* Load font */ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, fontFile )); Then I create the objects (I create more than one Font () because the formatting is different): Font font = new Font( "HamletOrNot" , Font.TRUETYPE_FONT , 10 ); Font font = new Font( "HamletOrNot" , Font.TRUETYPE_FONT , 12 ); Font font = new Font( "MorrisRoman-Black" , Font.TRUETYPE_FONT , 20 ); Font font = new Font( "MorrisRoman-Black" , Font.TRUETYPE_FONT , 22 ); Ok, system works normally. The problem is that after running, the .TTF files change size (to 83 KB and 80 KB), thus: HamletOrNot.ttf (83 KB) MorrisRoman-Black.ttf (80 KB) Then when I go to run the system for the second time, the following error occurs: ... Caused by: java.awt.FontFormatException: bad table, tag=1280594760 at sun.font.TrueTypeFont.init(TrueTypeFont.java:513) at sun.font.TrueTypeFont.&lt;init&gt;(TrueTypeFont.java:162) at sun.font.FontManager.createFont2D(FontManager.java:2474) at java.awt.Font.&lt;init&gt;(Font.java:570) at java.awt.Font.createFont(Font.java:980) at br.com.linu.vectortown.base.screen.font.GameFontFactory.postConstruct(GameFontFactory.java:43) at br.com.linu.vectortown.base.screen.font.GameFontContainer.postConstruct(GameFontContainer.java:27) at br.com.linu.vectortown.client.looping.util.AutomaticInjector.postConstruct(AutomaticInjector.java:47) ... 99 more If I replace the .TTF files with changed size (83 KB and 80 KB) by the original (with 74 KB and 67 KB), the program works normally. What am I doing wrong? I thought I'd have to close open files with applica…
has answer: http://stackoverflow.com/a/25503853
has answer: http://stackoverflow.com/a/55688913
tagged with: truetype
answer count: 2
has comment: http://stackoverflow.com/comment/39626366

http://stackoverflow.com/q/25481847
tagged with: getter-setter
score: 0
tagged with: java
has title: Bean : accessors vs attributes
tagged with: javabeans
has comment: http://stackoverflow.com/comment/39769388
has answer: http://stackoverflow.com/a/25482150
type: Question
has answer: http://stackoverflow.com/a/25481991
has comment: http://stackoverflow.com/comment/39769480
has body: I have always wondered how a bean should access its own attributes. Does it have to always use its getters and setters i.e. this.getAttribute1() and this.setAttribute1() or does it have to access it directly with this.attribute1 when there is no additional processing ? And what are the best practices when dealing with JPA ?
has answer: http://stackoverflow.com/a/25482428
accepted answer: http://stackoverflow.com/a/25481970
possible better answer: http://stackoverflow.com/a/25481991
has answer: http://stackoverflow.com/a/25481970
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/39849008
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25523976
score: 0
has text: I have given all the permissions viz. android.permission.ACCESS_WIFI_STATE, android.permission.CHANGE_WIFI_STATE, android.permission.INTERNET android.permission.ACCESS_NETWORK_STATE

http://stackoverflow.com/comment/39821567
type: AnswerComment
has text: yes in success ajax call its goig to the error function
comment on: http://stackoverflow.com/a/25478872
score: 0
type: Comment

http://stackoverflow.com/a/25500496
upvote count: 1
answers question: http://stackoverflow.com/q/25500060
has comment: http://stackoverflow.com/comment/39804074
has comment: http://stackoverflow.com/comment/39804147
has comment: http://stackoverflow.com/comment/39804281
score: 1
has comment: http://stackoverflow.com/comment/39804497
has comment: http://stackoverflow.com/comment/39804025
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25500060
has comment: http://stackoverflow.com/comment/39804366
has body: Use this in you OnClick: public void ClickMe(View v) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.idd.applicationtocall","com.idd.applicationtocall.MainActivity")); startActivity(intent); } And the manifest file of ApplicationToCall <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> You need to export the activity: android:exported="true" That way it works for me.
type: Answer

http://stackoverflow.com/q/25500115
tagged with: android-audiorecord
favorite count: 0
type: Question
type: UnansweredQuestion
tagged with: android
tagged with: visualization
upvote count: 3
score: 3
has answer: http://stackoverflow.com/a/25500419
tagged with: java
answer count: 1
downvote count: 0
has body: i am looking for a way to show MIC input level voice strength. i Am using Android AudioRecord to record voice input. i am following this tutorial for reference http://developer.samsung.com/android/technical-docs/Displaying-Sound-Volume-in-Real-Time-While-Recording i have implemented this also as while (isRecording) { read = recorder.read(data, 0, bufferSize); if (AudioRecord.ERROR_INVALID_OPERATION != read) { try { os.write(data); int amplitude = (data[0] &amp; 0xff) &lt;&lt; 8 | data[1]; amplitude = Math.abs(amplitude); pbVisulaizer.setProgress(amplitude); } catch (Exception e) { e.printStackTrace(); } } } but the amplitude changing is too frequent i am also looking for a maximum progress of progress bar according to recording quality. any suggestions.
has title: How to show MIC input visualization while audio recording Android
tagged with: audiorecord

http://stackoverflow.com/comment/39713340
type: Comment
has text: `SOURCE` retention annotation can be used to disable warnings in IDEs like f.e `@SupressWarnings` while `CLASS` retention anntotation are useful if you deal with the byte-code (or byte-code manipulation framework like javassist) before the bytes are actually loaded into the VM via a classloader. The general intent is like in OOP to limit the scope of an annotation as much as possible - though in practice most annotations have retention `RUNTIME` as probably most programmers don`t care or want to use reflection to check if an annotation is available
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/25451806

http://stackoverflow.com/comment/39988147
score: 0
type: Comment
has text: I use second part that you said . and i use System.out.println( "Classpath = " + classPath.toString()); sintax to see what is the classPath .the output is Classpath = com.google.common.reflect.ClassPath@1663380 . I want to chang classpath to server packag in src . what should i do ?
type: AnswerComment
comment on: http://stackoverflow.com/a/25512964

http://stackoverflow.com/comment/39803843
type: AnswerComment
has text: so when when i click on hello focus changes to hello button ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25500407

http://stackoverflow.com/comment/39734742
has text: http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/htmlsingle/#tx-decl-explained
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25462526

http://stackoverflow.com/q/25402781
score: 4
tagged with: xmlbeans
tagged with: apache-poi
has answer: http://stackoverflow.com/a/25429140
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39665502
downvote count: 0
has body: I am writing an aplication to export data to an Excel sheet. I wont to use the XSSFWorkbook class because my Excel exceeds the limit of 255 column of HSSFWorkbook class. I downloaded the Apache POI libraries and I included the folowing libraries to my proyect: - poi-3.9.jar - poi-excelant-3.9.jar - poi-ooxml-3.9.jar - poi-ooxml-schemas-3.9.jar - poi-scratchpad-3.9.jar - dom4j-1.6.1.jar - stax-api-1.0.1.jar - xmlbeans-2.3.0.jar When I export the data to get the Excel sheet I get this runtime error: java.lang.ExceptionInInitializerError at sun.misc.Unsafe.ensureClassInitialized(Native Method) at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25) at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122) at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918) at java.lang.reflect.Field.getFieldAccessor(Field.java:899) Truncated. see log file for complete stacktrace Caused By: java.lang.RuntimeException: Could not instantiate SchemaTypeSystemImpl (java.lang.reflect.InvocationTargetException): is the version of xbean.jar correct? at schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder.loadTypeSystem(Unknown Source) at schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder.&lt;clinit&gt;(Unknown Source) at sun.misc.Unsafe.ensureClassInitialized(Native Method) at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25) at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122) Truncated. see log file for complete stacktrace Caused By: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Cons…
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39655932
has comment: http://stackoverflow.com/comment/39658303
upvote count: 4
linked to: http://stackoverflow.com/q/4305231
type: Question
accepted answer: http://stackoverflow.com/a/25429140
has comment: http://stackoverflow.com/comment/39626369
has comment: http://stackoverflow.com/comment/39666555
has title: XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sE130CAA0A01A7CDE5A2B4FEB8B311707/index.xsb
has comment: http://stackoverflow.com/comment/39670858

http://stackoverflow.com/comment/39799794
has text: Have you tested this code? Is this the basic functionality you are looking for, as far as display and getting the id from the selected item?
type: Comment
comment on: http://stackoverflow.com/a/25490859
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39657027
has text: @Baz thanks for the advice, I'll look it up and let you know if I have any more questions
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25421016

http://stackoverflow.com/q/25547722
has answer: http://stackoverflow.com/a/25548135
has comment: http://stackoverflow.com/comment/39890495
type: UnansweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39890721
downvote count: 3
has answer: http://stackoverflow.com/a/25547897
favorite count: 0
has answer: http://stackoverflow.com/a/25547819
has comment: http://stackoverflow.com/comment/39890572
type: Question
has body: I need to reverse my content list. I found Collections.reverse(temp);, but don't know how to implement it right. private class MyFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults oReturn = new FilterResults(); ArrayList&lt;Advice&gt; results = new ArrayList&lt;Advice&gt;(); if (orig == null) orig = list; if (constraint != null) { if (orig != null) { for (Advice d : orig) { if ((d.getTitle() + " " + d.getText()).toLowerCase() .contains(constraint.toString())) { results.add(d); } } } } list = results; return oReturn; } @Override protected void publishResults(CharSequence constraint, FilterResults results) { notifyDataSetChanged(); } }
has answer: http://stackoverflow.com/a/25547814
has title: How to reverse an ArrayList
tagged with: android
has comment: http://stackoverflow.com/comment/39890640
tagged with: arrays
has answer: http://stackoverflow.com/a/25548713
answer count: 5
tagged with: sorting
score: -3

http://stackoverflow.com/comment/39686300
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25434300
has text: I don't know. I happened to find a piece of example Java code and i made it work using the example. Link to the example: https://github.com/kctang/gcs-helper

http://stackoverflow.com/comment/97216933
type: AnswerComment
score: 0
has text: or just `gradle clean`.
comment on: http://stackoverflow.com/a/25403109
type: Comment

http://stackoverflow.com/comment/39850225
type: QuestionComment
comment on: http://stackoverflow.com/q/25525646
has text: its for compile time type safety so you won't add something else to your List that is made to have String only
score: 0
type: Comment

http://stackoverflow.com/q/25434705
has comment: http://stackoverflow.com/comment/39682009
has body: Problem: For Developers that work on many different platforms and need to do regression testing on different versions of Java, the Android NDK, OpenGL, etc, there are often issues trying to install multiple versions of the JRE and JDK. It is common to manually deploy/extract many versions of the NDK, JDK, JRE, and J2EE environments in linux, (archlinux). However, automated installation packages are not-standardized in how/where they place the SDKs, and JREs, and there are often collisions reported during installations. Question: Is there a "standard" method described, provided by Oracle, (Sun), or any others that has been adopted, (for example, the best practices for setting up the proxies/shims, symlinks, etc? Are there any common GUI tools, scripts, (like archlinux-java), that will let me "Switch" the Active Java environment? (pointing symlinks in different directions, etc)? Is there a tool that allows users to click "Add New Java Platform" and lets them specify JRE and JDK paths separately, (like, update 8_u34, and 8_u49, separately). Notes: archlinux-java only supports openjdk and java-8-oracle, but not the past versions of oracle java, (6, or 7), (https://wiki.archlinux.org/index.php/java#Switching_between_JVM) Hopefully, this "one tool" to proxy/shim for all of the different java versions would be updated in updates. By manually installing the different java versions, its a given that this will break updates, but that is kind of the point--to test on different, older, and non-updated versions. In this scenario, there are anywhere from 2 to 6 or so deployments on a machine. What ends up happening is that /opt is used (sometimes), and usr/lib/jvm, and even other folders get pulled in with other installations. It is preferable to have all of the deployments in one tree under "opt" or even "lib" so that its easier to change scripts/variables. Thank you for your thoughts!
type: Question
upvote count: 2
score: 2
answer count: 2
has title: Linux Standard For Deploying Java "Side By Side" and Tools?
downvote count: 0
type: UnansweredQuestion
tagged with: archlinux
has answer: http://stackoverflow.com/a/55782168
has answer: http://stackoverflow.com/a/25565191
favorite count: 0
tagged with: linux
tagged with: java

http://stackoverflow.com/q/25442174
answer count: 1
has body: I am in need of writing a Single pointcut to intercept the constructor of all the classes. The actual need is to intercept all the beans where in no other methods apart from the init() and the constructor are invoked. For the init it is straight forward. But since the constructor name changes with the class name writing a single point cut is getting tough. Any help would be appreciated...
type: Question
has comment: http://stackoverflow.com/comment/39695271
tagged with: constructor
has title: Spring AspectJ point cuts
linked to: http://stackoverflow.com/q/15797331
tagged with: spring
accepted answer: http://stackoverflow.com/a/25467177
has answer: http://stackoverflow.com/a/25467177
type: AnsweredQuestion
score: 0
tagged with: pointcut
tagged with: java

http://stackoverflow.com/a/25492490
has body: You can do it like this. String userinput="Designation2"; String[] array = { "Designation1", "Designation2", "Designation3" }; int length=array.length(); int index=0; for(int i=0;i&lt;length;i++) { if(array[i].equals(userinput)) { index=i; break; } } And index will give you the array key that user wants. Regards..
score: 0
answers question: http://stackoverflow.com/q/25492381
type: Answer

http://stackoverflow.com/q/25527412
tagged with: java
has comment: http://stackoverflow.com/comment/39855199
has comment: http://stackoverflow.com/comment/39854728
has comment: http://stackoverflow.com/comment/39854276
type: Question
has title: Google Maps V2 NoClassDefFoundError for SupportMapFragment
has comment: http://stackoverflow.com/comment/39854147
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16572020
tagged with: android
has body: I'm trying to get the Google Maps API v2 working for a project. I've downloaded the latest version of the Google Play Services via the Android SDK Manager and imported the Google Play services as an library project into Eclipse. I've also added a reference to the library project via Project->Properties->Android->Library for my app. My project to test the Google Maps API has only a MainActivity and the associated layout file. MainActivity.java package com.example.googlemapstest; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import com.google.android.gms.maps.SupportMapFragment; public class MainActivity extends FragmentActivity { @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) { return; } getSupportFragmentManager().beginTransaction() .add(R.id.fragment_container, new SupportMapFragment()).addToBackStack(null).commit(); } } activity_main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.googlemapstest" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; …
linked to: http://stackoverflow.com/q/16602640
has comment: http://stackoverflow.com/comment/39854196
has comment: http://stackoverflow.com/comment/39854614
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39853670
linked to: http://stackoverflow.com/q/8678630
score: 0
has comment: http://stackoverflow.com/comment/39856365
answer count: 0
tagged with: google-maps
has comment: http://stackoverflow.com/comment/39853513

http://stackoverflow.com/comment/39692936
type: QuestionComment
score: 0
has text: The value of the variables is: group: "1250" serie: "leadTime_30" dollarSerie: "$leadTime_30" serieQuery: "leadTime_30.date" stringDate: "2014-08-12T22:00:00Z"
comment on: http://stackoverflow.com/q/25441013
type: Comment

entity-bean
tag name: entity-bean
type: Tag
tags question: http://stackoverflow.com/q/25390430

http://stackoverflow.com/q/25527938
has body: In two different parts of my code I use ZonedDateTime.of() to create an instance. In both I use the same ZoneId which is defined with ZoneId zoneId = ZoneId.of("Brazil/Acre"); Then when comparing the instances with before() and after() I get wrong results. I observed that the timezone of both are surprisingly different. Printing one gives 0013-06-20T00:00-04:31:12[Brazil/Acre] And printing the other gives 2013-06-20T00:00:21-04:00[Brazil/Acre] Note the change: 04:31:12[Brazil/Acre] in one but 04:00[Brazil/Acre] in the other (the latter seems correct because of the exact 4:00 hours difference from Greenwich clock). I created both in the following way: ZonedDateTime time = ZonedDateTime.of(year, month, day, hours, minutes, seconds, 0, zoneId); I would be so happy to learn what went wrong with my code.
type: Question
has comment: http://stackoverflow.com/comment/39854970
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39855102
score: 0
has title: Inconsistency with ZonedDateTime.of()
tagged with: java
has answer: http://stackoverflow.com/a/25528422
answer count: 1

http://stackoverflow.com/q/25432516
has title: Spark streaming,how to merge different streams into one stream
has body: I'm new to spark,now I want to transform two streams together,such as JavaNetworkWordCount example,I receive two different streams : JavaStreamingContext jssc = new JavaStreamingContext("local[2]", "JavaNetworkWordCount",new Duration(1000)); JavaReceiverInputDStream&lt;String&gt; lines1 = jssc.socketTextStream(ip1, port1); JavaReceiverInputDStream&lt;String&gt; lines2 = jssc.socketTextStream(ip2, port2); //can I union them like this in one driver program: JavaDStream&lt;String&gt; words = lines1.union(lines2); words = lines.flatMap( new FlatMapFunction&lt;String, String&gt;() { @Override public Iterable&lt;String&gt; call(String x) { return Arrays.asList(x.split(" ")); } }); &lt;/code&gt; then do other transforms and action.I tested it and failed. I had read spark documentation, can't find an example.
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25435017
has comment: http://stackoverflow.com/comment/39678252
tagged with: apache-spark
score: 1
tagged with: java
answer count: 1
upvote count: 1
favorite count: 0
type: Question

andengine
tags question: http://stackoverflow.com/q/25422632
type: Tag
tag name: andengine

http://stackoverflow.com/q/25502203
has comment: http://stackoverflow.com/comment/39807153
has answer: http://stackoverflow.com/a/25507552
answer count: 1
has comment: http://stackoverflow.com/comment/39808179
downvote count: 0
tagged with: file
score: 1
upvote count: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25507552
type: AnsweredQuestion
has body: I have a TilePane with a imageView items, each imageview displaying an image got from a directory in my pc. When any of the images in the tilePane is clicked a message is printed onto console with the direcory path address to the folder where the image resides, for example: You clicked: ImageResources/wp.png I would like to extend this further so that when a particular image is clicked the folder in which the image resides opens. My implementation below only prints to console the message below, but no directory/ folder gets opened. The message is: File Not Found How can I get it to work so that the folder|directory opens? Thank you all in advance. Also, of the directory could open with the clicked image selected, then that would be an extra, but is not a priority right now. My implementation so far goes as follows: public class TilePaneExample extends Application { @Override public void start(Stage primaryStage) { VBox root = new VBox(30); String[] imageResources = new String[]{ //loading images "ImageResources/facebook.png", "ImageResources/faviicon.png", "ImageResources/jquery-logo.png", "ImageResources/linkedin_32.png", "ImageResources/loading1.png", "ImageResources/twitter.png", "ImageResources/twitter_32.png", "ImageResources/wp.png",}; // Pane TilePane tilePane = new TilePane(); tilePane.setHgap(5); tilePane.setVgap(5); for (final String imageResource : imageResources) { Image image = new Image(getClass().getResourceAsStream(imageResource)); ImageView imageView = new ImageView(image); imageView.setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent event) { File f = new File(imageResource); String absolutePath = f.getAbsolutePath(); String folderPath = absolutePath. substring(0, absolutePath.lastIndexOf(File.separator)); try { Desktop.getDesktop().open(new File(folderPath)); } catch (IllegalArgumentException iae) { System.out.println("File Not Found"); } catch (IOException ex) { Logger.getLogger(TilePaneExample.class.g…
has title: How to open a folder/Directory in Java
has comment: http://stackoverflow.com/comment/39807333
tagged with: java
tagged with: directory

http://stackoverflow.com/comment/39658136
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25420999
has text: I am not entirely certain in your case, but I ran into a similar issue that was traced down to unclosed, orphaned connections.
type: Comment

http://stackoverflow.com/a/26532891
type: Answer
answers question: http://stackoverflow.com/q/25550616
has body: Definetly the CSS Selector is wrong. If it is working with a selector a and is not working with ur current one, the problem is the CSS Selector div.pst-content safety clearfix entry-content p If u can tell what u are trying to extract from the HTML or the webpage might be helpuful to solve ur problem. Take fun with JSoup –
score: 0

http://stackoverflow.com/q/25528241
type: AnsweredQuestion
has title: Jenkins-Plugin: Optional block and its nested radio buttons are not persisted after saving and loading the configuration dialogue
tagged with: java
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25566646
tagged with: jenkins-plugins
has answer: http://stackoverflow.com/a/25566646
favorite count: 0
tagged with: jelly
type: Question
tagged with: jenkins
upvote count: 2
has body: I'm trying to get started with Jenkins plugin development and have a little problem regarding the persistence of a global configuration of the plugin. The option in question is an optional block with 2 nested radio buttons, as you can see in the plugin's global.jelly: <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> <f:section title="Hello World Builder"> <f:optionalBlock name="useForeignLanguage" title="Use foreign language" checked="useForeignLanguage"> <f:entry title="Language to use" field="useLanguage" description="Check if we should say hello in another language"> <f:radio name="useLanguage" title="French" value="fr" /> <f:radio name="useLanguage" title="Japanese" value="jp" /> </f:entry> </f:optionalBlock> </f:section> </j:jelly> The relevant Java code is as follows: public class HelloWorldBuilder extends Builder { //... @Extension public static final class Descriptor extends BuildStepDescriptor<Builder> { private boolean useForeignLanguage; private String useLanguage; public Descriptor() { load(); } @Override public boolean configure( final StaplerRequest req, final JSONObject formData ) throws FormException { // To persist global configuration information, // set that to properties and call save(). final JSONObject languageJSON = formData.getJSONObject( "useForeignLanguage" ); if ( ( languageJSON != null ) && !( languageJSON.isNullObject() ) ) { this.useLanguage = languageJSON.getString( "useLanguage" ); this.useForeignLanguage = true; } else { this.useLanguage = null; this.useForeignLanguage = false; } save(); return super.configure( req, formData ); } public String getUseLanguage() { return this.useLanguage; } public boolean getUseForeignLanguage() { return this.useForeignLanguage; } //... } } The config itself gets saved fine in an xml, which is loaded everytime the configuration is saved, so I guess the problem lies within loading and filling the form modules: …
score: 2

http://stackoverflow.com/comment/39848501
has text: Hello Query is executing but error is `java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.abc.its.beans.LatitudeBean`
score: 0
comment on: http://stackoverflow.com/a/25503747
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25510069
answers question: http://stackoverflow.com/q/25509763
has body: Ensure that the dependency is at least specified under &lt;project&gt;&lt;dependencies&gt; on not only under &lt;project&gt;&lt;dependencyManagement&gt;&lt;dependencies&gt;.
score: 1
type: Answer
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25454699
answer count: 2
has comment: http://stackoverflow.com/comment/39719015
has title: jsp:UseBean vs. Struts <bean> tag
accepted answer: http://stackoverflow.com/a/25454826
has answer: http://stackoverflow.com/a/25455502
has answer: http://stackoverflow.com/a/25454826
tagged with: jsp
tagged with: javabeans
tagged with: struts2
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25455502
tagged with: java
has comment: http://stackoverflow.com/comment/39718970
type: Question
has body: I am learning about Struts2 and it's not completely clear to me how and when to use the tag <jsp:UseBean> vs the Struts bean:... tag. I found an article outlining the differences but them but there is not any example provided. http://struts.apache.org/development/1.x/struts-taglib/tlddoc/bean/define.html The <bean:define> tag differs from <jsp:useBean> in several ways, including: Unconditionally creates (or replaces) a bean under the specified identifier. Can create a bean with the value returned by a property getter of a different bean (including properties referenced with a nested and/or indexed property name). Can create a bean whose contents is a literal string (or the result of a runtime expression) specified by the value attribute. Does not support nested content (such as jsp:setProperty tags) that are only executed if a bean was actually created. Here's my quick test code that uses the UseBean tag. Could anyone please give me an example how/why (or if) I should use the Struts bean:... tag(s) in the display.jsp instead? index.jsp: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here TestServlet.java: package com.website.servlets; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.website.models.Person; /** * Servlet implementation class TestServlet */ @WebServlet("/TestServlet") public class TestServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public TestServlet() { super(); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String fn…

http://stackoverflow.com/comment/39896096
has text: I don't know JavaFX, but _most_ GUI frameworks are single-threaded. That is to say, they'll have an "event-dispatch" thread that calls application defined handler functions in response to GUI inputs; and they'll have many methods that must only be called from within that one thread. Usually there is something akin to Swing's `invokeLater(...)` that some other thread can use to post a request for a callback in the event thread.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25549423
type: Comment

classloader
tags question: http://stackoverflow.com/q/25394319
tags question: http://stackoverflow.com/q/25478223
tags question: http://stackoverflow.com/q/25465771
tags question: http://stackoverflow.com/q/25523873
type: Tag
tags question: http://stackoverflow.com/q/25523796
tags question: http://stackoverflow.com/q/25496389
tags question: http://stackoverflow.com/q/25515171
tags question: http://stackoverflow.com/q/25465542
tags question: http://stackoverflow.com/q/25528192
tags question: http://stackoverflow.com/q/25484558
tag name: classloader
tags question: http://stackoverflow.com/q/25483420

http://stackoverflow.com/comment/39622955
has text: @stuXnet As you mention, we are hashing and storing
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25401557
score: 0

http://stackoverflow.com/comment/39672595
type: QuestionComment
has text: For Java, you can also consider using [SvnRev](http://www.compuphase.com/svnrev.htm)
comment on: http://stackoverflow.com/q/25423505
score: 0
type: Comment

http://stackoverflow.com/q/25534031
downvote count: 0
accepted answer: http://stackoverflow.com/a/25543844
score: 1
upvote count: 1
tagged with: java
answer count: 1
favorite count: 0
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/25543844
tagged with: android
tagged with: datetime
has body: getBestDateTimePattern() Requires Android API Level 18, is there a suitable open source library (like I can use with Joda DateTime) which acts as an effective replacement?
type: AnsweredQuestion
has title: Android: DateFormat.getBestDateTimePattern API Level < 18 replacement

http://stackoverflow.com/comment/39885272
type: AnswerComment
has text: yes, this because of adding Int in String param, replace menuArray.length() with this Integer.toString(menuArray.length())
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25506633

http://stackoverflow.com/comment/39833897
type: QuestionComment
has text: You will probably have to "split" it first with the Java String.split() method. There are other ways of course.
comment on: http://stackoverflow.com/q/25516108
score: 0
type: Comment

android-asynctask
tags question: http://stackoverflow.com/q/25542268
tags question: http://stackoverflow.com/q/25465370
tags question: http://stackoverflow.com/q/25538658
tags question: http://stackoverflow.com/q/25431743
tags question: http://stackoverflow.com/q/25404628
type: Tag
tags question: http://stackoverflow.com/q/25481034
tags question: http://stackoverflow.com/q/25418672
tags question: http://stackoverflow.com/q/25445433
tags question: http://stackoverflow.com/q/25456696
tags question: http://stackoverflow.com/q/25464062
tags question: http://stackoverflow.com/q/25429263
tag name: android-asynctask
tags question: http://stackoverflow.com/q/25427906
tags question: http://stackoverflow.com/q/25546522
tags question: http://stackoverflow.com/q/25441517
tags question: http://stackoverflow.com/q/25542291
tags question: http://stackoverflow.com/q/25520130
tags question: http://stackoverflow.com/q/25421486
tags question: http://stackoverflow.com/q/25440490
tags question: http://stackoverflow.com/q/25482068
tags question: http://stackoverflow.com/q/25490281
tags question: http://stackoverflow.com/q/25457973
tags question: http://stackoverflow.com/q/25399676
tags question: http://stackoverflow.com/q/25494339
tags question: http://stackoverflow.com/q/25432704
tags question: http://stackoverflow.com/q/25462932
tags question: http://stackoverflow.com/q/25488561

http://stackoverflow.com/q/25443890
score: 0
tagged with: java
upvote count: 1
downvote count: 1
favorite count: 0
has body: How can I convert WBXML (WAP Binary XML) data to XML in Java?
type: Question
answer count: 1
has title: Convert WBXML to XML in Java
tagged with: wbxml
accepted answer: http://stackoverflow.com/a/25444378
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25444378
type: AnsweredQuestion

http://stackoverflow.com/comment/39852102
comment on: http://stackoverflow.com/a/25524097
type: AnswerComment
has text: Editing the question is not enough, you'd do that and add the information asked. "I want the location where the classes are coming from, because ..." - please fill in the dot dot dot.
type: Comment
score: 0

http://stackoverflow.com/comment/39884710
score: 0
comment on: http://stackoverflow.com/q/25544387
type: QuestionComment
has text: It doesn't add anything to the frame
type: Comment

http://stackoverflow.com/q/25418802
tagged with: playframework-2.0
has title: headless exception in java using play framework
has body: I am using joptionpane in java i got an error "play - Cannot invoke the action, eventually got an error: java.awt.HeadlessException" I put by code below and i am using play framework enter code here System.setProperty("java.awt.headless", "true"); JFrame frame = new JFrame(); frame.setVisible(true); JOptionPane.showMessageDialog(frame, "Login into Your Account"); error message ! @6j9l3c30p - Internal server error, for (POST) [/login] -&gt; play.api.Application$$anon$1: Execution exceptionHeadlessException: null at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.3] at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.3] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:264) [play_2.10.jar:2.2.3] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:264) [play_2.10.jar:2.2.3] at scala.Option.map(Option.scala:145) [scala-library.jar:na] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3.applyOrElse(PlayDefaultUpstreamHandler.scala:264) [play_2.10.jar:2.2.3] Caused by: java.awt.HeadlessException: null at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207) ~[na:1.7.0_51] at java.awt.Window.(Window.java:535) ~[na:1.7.0_51] at java.awt.Frame.(Frame.java:420) ~[na:1.7.0_51] at java.awt.Frame.(Frame.java:385) ~[na:1.7.0_51] at javax.swing.JFrame.(JFrame.java:174) ~[na:1.7.0_51] at controllers.Application.login(Application.java:68) ~[na:na]
upvote count: 0
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
score: -1
has answer: http://stackoverflow.com/a/25431452

http://stackoverflow.com/comment/39682134
type: Comment
comment on: http://stackoverflow.com/a/25431968
type: AnswerComment
has text: My Java program need a dll in the running folder. This file is in the right place but I'm still getting the same error : missing dll. Otherwise I've used the surefire plugin for my Junit tests and it works fine for me, the workingDirectory target works
score: 0

http://stackoverflow.com/a/25405853
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25405449
type: Answer
has body: The thread will terminate normally except the problem would be it will not release any resources that it was holding when the exception occurred. Example : public class TryThreads { static void someMethod() throws Exception { System.out.println("hello"); throw new Exception(); } public static void main(String[] args) throws InterruptedException { Thread T = new Thread(new Runnable() { @Override public void run() { System.out.println(Thread.currentThread().getState()); try { someMethod(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("still here"); } }); T.start(); Thread.currentThread().sleep(1000); System.out.println(T.getState()); } } O/P: RUNNABLE hello java.lang.Exception at TryThreads.someMethod(TryThreads.java:4) at TryThreads$1.run(TryThreads.java:15) at java.lang.Thread.run(Unknown Source) still here **TERMINATED** --&gt; this line
accepted answer of: http://stackoverflow.com/q/25405449
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/25522085
favorite count: 0
tagged with: gwt
accepted answer: http://stackoverflow.com/a/25560167
type: AnsweredQuestion
score: 3
has body: In GWT we need to use # in a URL to navigate from one page to another i.e for creating history for eg. www.abc.com/#questions/10245857 but due to which I am facing a problem in sharing the url. Google scrappers are reading the url only before # i.e. www.abc.com. Now I want to remove # from my url and want to keep it straight as www.abc.com/question/10245857. I am unable to do so. How can I do this? When user navigates the app I use the hash urls and History object (as to not reload the pages). However sometimes it's nice/needed to have a pretty URL (e.g. for sharing, showing in public, etc..) so I would like to know how to provide the pretty URL of the same page. Note: We have to do this to make our webpages url crawlable and to link the website with outside world.
has answer: http://stackoverflow.com/a/25560167
tagged with: java
type: Question
upvote count: 3
has title: Make gwt website crawlable without hash symbol?
answer count: 1
downvote count: 0
tagged with: url-routing

http://stackoverflow.com/comment/39806372
type: QuestionComment
comment on: http://stackoverflow.com/q/25501217
has text: Hi Andrew, unfortunately setting a margin had little effect on the appearance of the render components (I have updated the SO code incase I did something wrong). Sorry if you thought the code was a little long winded, I have been called out in the past for providing too little information.
score: 0
type: Comment

http://stackoverflow.com/comment/39893104
type: QuestionComment
score: 2
has text: Don't paint on the frame. Paint on a JPanel (with `paintComponent` not `paint`) and add the panel to the frame. You're image is getting cut off because 0,0 refers to the very top left corner of the actual frame and not its content view area. Also override `getPreferredSize()` of the panel, and `pack()` your frame instead of setting its size.
comment on: http://stackoverflow.com/q/25548716
type: Comment

bigdecimal
tags question: http://stackoverflow.com/q/25509810
type: Tag
tags question: http://stackoverflow.com/q/25454734
tags question: http://stackoverflow.com/q/25434148
tag name: bigdecimal
tags question: http://stackoverflow.com/q/25534276

http://stackoverflow.com/q/25515260
tagged with: java
answer count: 1
type: Question
has body: I have developed an application using some of swing components that application is using jnotify to monitor folder, it is working fine in eclipse but when I produce jar file and try to execute that jar on my system it show me below error, I tried a lot in solving this error but it is still giving me the same error, Please tell what I am doing wrong. $$ java -jar DemoJFileChooser.jar Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: net/contentobjects/jnotify/JNotifyListener at DemoJFileChooser.actionPerformed(DemoJFileChooser.java:124) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3311) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.se…
tagged with: linux
tagged with: jnotify
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25525515
has title: Error in java path in configuring jnotify and libnotify.so

http://stackoverflow.com/comment/39692807
has text: I want to do in recursive mode.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25440540

http://stackoverflow.com/a/25548465
has body: Just a shot in the dark, but what happens when you enable the location layer only when the map has loaded? Like this: googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Override public void onMapLoaded() { googleMap.setMyLocationEnabled(true); } }); Does the map load properly and then crash?
score: 0
answers question: http://stackoverflow.com/q/25546608
has comment: http://stackoverflow.com/comment/39892345
type: Answer

generics
tags question: http://stackoverflow.com/q/25536688
tags question: http://stackoverflow.com/q/25445918
tags question: http://stackoverflow.com/q/25529990
tags question: http://stackoverflow.com/q/25410012
tags question: http://stackoverflow.com/q/25510454
tags question: http://stackoverflow.com/q/25512169
tags question: http://stackoverflow.com/q/25505015
tags question: http://stackoverflow.com/q/25478340
tags question: http://stackoverflow.com/q/25520469
tags question: http://stackoverflow.com/q/25452073
tags question: http://stackoverflow.com/q/25510393
tags question: http://stackoverflow.com/q/25452832
tags question: http://stackoverflow.com/q/25493402
tags question: http://stackoverflow.com/q/25465590
tags question: http://stackoverflow.com/q/25466735
tags question: http://stackoverflow.com/q/25428570
tags question: http://stackoverflow.com/q/25487619
tags question: http://stackoverflow.com/q/25548641
tags question: http://stackoverflow.com/q/25400690
tags question: http://stackoverflow.com/q/25517714
tags question: http://stackoverflow.com/q/25482238
tags question: http://stackoverflow.com/q/25496510
tags question: http://stackoverflow.com/q/25432947
tags question: http://stackoverflow.com/q/25431859
tags question: http://stackoverflow.com/q/25510157
tags question: http://stackoverflow.com/q/25513739
tags question: http://stackoverflow.com/q/25426598
tags question: http://stackoverflow.com/q/25458729
tags question: http://stackoverflow.com/q/25456181
tags question: http://stackoverflow.com/q/25407292
tags question: http://stackoverflow.com/q/25532319
tags question: http://stackoverflow.com/q/25473849
tags question: http://stackoverflow.com/q/25547205
type: Tag
tags question: http://stackoverflow.com/q/25525553
tags question: http://stackoverflow.com/q/25421122
tags question: http://stackoverflow.com/q/25490796
tags question: http://stackoverflow.com/q/25432610
tags question: http://stackoverflow.com/q/25433630
tag name: generics
tags question: http://stackoverflow.com/q/25501563
tags question: http://stackoverflow.com/q/25440453
tags question: http://stackoverflow.com/q/25480172
tags question: http://stackoverflow.com/q/25476826
tags question: http://stackoverflow.com/q/25516145
tags question: http://stackoverflow.com/q/25442070
tags question: http://stackoverflow.com/q/25535579

http://stackoverflow.com/comment/39610394
type: QuestionComment
has text: okay for the record I found a mistake in my classpath declaration in the Manifest file. I can now include other jar files by adding them to the manifest file but I'm not sure why it won't work from the command line
type: Comment
comment on: http://stackoverflow.com/q/25396082
score: 1

http://stackoverflow.com/comment/39752966
type: Comment
comment on: http://stackoverflow.com/a/25465884
type: AnswerComment
has text: I looked there; there's over 300 lines of code, and I don't see the Data class. It's why you often see requests on SO for posters to boil their problem down to a very small code set, and to post it rather than linking to it. So often one follows a link only to find there are things missing. Does the code I filled in for `mouseClicked()` help?
score: 1

http://stackoverflow.com/comment/39656265
score: 0
has text: The problem, when I select query again that entity, it results in one select. But when I make merge, it results in many selects with inner joins
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25420500

http://stackoverflow.com/comment/39800817
type: Comment
type: AnswerComment
has text: @user949300, I thought this contributes to performance degradation.
comment on: http://stackoverflow.com/a/25498722
score: 0

http://stackoverflow.com/comment/42025056
has text: Its Due to ack error,sending wrong acknowledge then this error occur.
comment on: http://stackoverflow.com/a/25501030
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/39832280
type: AnswerComment
comment on: http://stackoverflow.com/a/25512681
type: Comment
has text: should not conduct an audit to make sure the password entered is correct?
score: 0

http://stackoverflow.com/comment/39690268
comment on: http://stackoverflow.com/q/25439409
has text: Just as a note, you appear to be adding `father` to the `fatherList` twice. I'm not sure if that was intentional. This is outside the scope of the question, but might cause you confusion later on.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25418711
downvote count: 0
score: 1
upvote count: 1
tagged with: java
linked to: http://stackoverflow.com/q/15668329
tagged with: mysql
has body: I have a graphical user interface which takes some user inputs, it takes the current date also. Then I need to store them in a database. Everything is fine but I cannot understand the way how should I parse the input string of date field to mysql date for inserting it into the database. I have a code like this. Date date = txtToday.getText(); I know this should be parsed in to a type which is compatible with Data data type. This Date type is from java.sql.Date. How can I overcome this issue.?
has title: Parsing String into mysql Date
answer count: 4
has answer: http://stackoverflow.com/a/25419252
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25419031
linked to: http://stackoverflow.com/q/35814706
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/38922754
has comment: http://stackoverflow.com/comment/39652124
has comment: http://stackoverflow.com/comment/39652139
duplicate of: http://stackoverflow.com/q/15668329
has answer: http://stackoverflow.com/a/25418742
has answer: http://stackoverflow.com/a/43959542

http://stackoverflow.com/a/25451333
has comment: http://stackoverflow.com/comment/70969133
has comment: http://stackoverflow.com/comment/39712402
answers question: http://stackoverflow.com/q/25447632
type: Answer
has comment: http://stackoverflow.com/comment/39714780
has comment: http://stackoverflow.com/comment/39713028
has body: First of all, It's very difficult to measure the object distance from one single shot/view. You would find many research papers which tried to employ vision based techniques to judge the object distance. I can refer you one such paper. They tried to implement a positioning system that would solely work on mobile camera+sensors. You would probably realize how non-trivial it is to measure the object distance from one single camera view. They finally used a method called "structure from motion" vision technique to calculate the distance (From multiple photos taken from multiple angle). Even traditional apps like SmartDistance and SmartMeasure needs to use geometric tricks to measure the distance. None of them could only rely on camera parameters. Sorry for the elongated introduction. I have done a project of this sort before and I am telling you all these based on my experience. To answer your query, I haven't found any Android device yet which returns realistic values of focus distances. They are either returned as some constant values or sometimes 0 and infinity. I found someone reporting that it worked for Galaxy Nexus but only within 30cm object distance, it doesn't work for distances more than that. The bottom line is that you cannot rely on this function from camera API which is heavily dependent on the device drivers. And, phone camera's are not well-known for their lens/sensor qualities. It would be very very difficult for you to work on any optics based formula for mobile-phone cameras. I would suggest you to rather go for some sensor based geometric tricks.
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/39809787
type: Comment
type: QuestionComment
has text: when I change default language it is able to recognize. I also checked other languages.But the problem is that I am not able to change languages. It always picks one despite of language locale. On another devices there is not such problem
score: 0
comment on: http://stackoverflow.com/q/25503059

http://stackoverflow.com/comment/39795550
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25478978
has text: I have added a small example for you
type: AnswerComment

http://stackoverflow.com/comment/39774880
type: AnswerComment
score: 6
has text: This would be much better as a comment...
comment on: http://stackoverflow.com/a/25485089
type: Comment

http://stackoverflow.com/a/25525076
accepted answer of: http://stackoverflow.com/q/25524850
downvote count: 0
answers question: http://stackoverflow.com/q/25524850
type: Answer
has body: You need to register a ToAttributedValueConverter for the revision class. This converter lets you specify a single property of the class that should be mapped to the character content of the element, and all other properties are mapped to attributes on the element. The simplest way to do this is with annotations: @XStreamConverter(value=ToAttributedValueConverter.class, strings={"number"}) public class revision { // class body as before } and tell the XStream instance to read the annotations with xstream.processAnnotations(revision.class); With this converter in place you don't need the useAttributeFor call, as the converter will automatically use attributes for everything except the number. If you don't want to use annotations then you can configure the converter with a method call on the XStream instance instead, you just have to extract the various helpers from xstream and pass them to the constructor explicitly (the annotation processor passes these things to the converter automatically if it requires them) xstream.registerConverter(new ToAttributedValueConverter( revision.class, xstream.getMapper(), xstream.getReflectionProvider(), xstream.getConverterLookup(), "number"));
score: 3
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/comment/39874638
type: Comment
comment on: http://stackoverflow.com/q/25538213
type: QuestionComment
has text: @MadProgrammer thanks, but it sounds very complicate. I have no idea how to build the UI delegate, so is there any possible simpler way to do that? thanks again :)
score: 0

caching
tags question: http://stackoverflow.com/q/25492744
tags question: http://stackoverflow.com/q/25545571
tags question: http://stackoverflow.com/q/25397563
tags question: http://stackoverflow.com/q/25442298
type: Tag
tag name: caching
tags question: http://stackoverflow.com/q/25528965
tags question: http://stackoverflow.com/q/25434693
tags question: http://stackoverflow.com/q/25439276
tags question: http://stackoverflow.com/q/25510720
tags question: http://stackoverflow.com/q/25487707
tags question: http://stackoverflow.com/q/25458444
tags question: http://stackoverflow.com/q/25533797

http://stackoverflow.com/a/25479635
answers question: http://stackoverflow.com/q/25479516
has comment: http://stackoverflow.com/comment/39765957
score: 7
has comment: http://stackoverflow.com/comment/39766245
accepted answer of: http://stackoverflow.com/q/25479516
type: Answer
has comment: http://stackoverflow.com/comment/39765602
type: AcceptedAnswer
downvote count: 0
upvote count: 7
has comment: http://stackoverflow.com/comment/39765863
has body: What you experience on Windows is not the expected behaviour (as it is not documented), it is just an implementation side effect. The showDialog() is used to display a custom dialog (e.g. not an Open nor Save dialog). It has a parameter to specify the text of the Approve button. If the title has not been set with the setDialogTitle() method, the implementation arbitrarily chooses to use the approve button's text as the title on Windows OS, however this is not documented anywhere and you should not count on this to work. If you want a custom title, use setDialogTitle(). If you want a custom approve button text, use setApproveButtonText(). Obviously showDialog() also takes the approve button's text in which case you do not need to call setApproveButtonText() prior. If you want an Open dialog, use the showOpenDialog() method. If you want a Save dialog, use the showSaveDialog(). Only use showDialog() if you want a custom dialog.
has comment: http://stackoverflow.com/comment/39766146

http://stackoverflow.com/comment/40070177
has text: @user3417179 Java is not a web-browser, and will not read HTML entity values as characters
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25431102

http://stackoverflow.com/comment/39884379
has text: Worked brilliantly. Thanks a lot!
comment on: http://stackoverflow.com/a/25503571
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25507493
type: Question
tagged with: tiff
has title: Adobe LiveCycle convert PDF to TIFF = very low resolution TIFF
accepted answer: http://stackoverflow.com/a/25509555
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/25509555
tagged with: adobe
has body: When using Adobe LiveCycle's ConvertPdfServiceClient toImage operation (in Java) to convert a text-heavy PDF to a TIFF image, the output TIFF image is very low resolution, despite setting Resolution to "300" and ImageSizeHeight &amp; ImageSizeWidth to PageSize.LETTER dimensions. How can I get LiveCycle to give me a higher resolution TIFF? My source PDF is 8.5" x 11" (Letter size). It is text-based (not just an image inside a PDF). This is my spec object: ToImageOptionsSpec spec = new ToImageOptionsSpec(); spec.setImageConvertFormat(ImageConvertFormat.TIFF); spec.setGrayScaleCompression(GrayScaleCompression.None); spec.setMultiPageTiff(true); spec.setColorSpace(ColorSpace.Monochrome); spec.setResolution("300"); spec.setMonochrome(MonochromeCompression.CCITTG4); spec.setGrayScalePolicy(GrayScalePolicy.Off); spec.setImageSizeHeight(PageSize.Letter.getHeight()); spec.setImageSizeWidth(PageSize.Letter.getWidth()); The TIFF output file is: Resolution: 612 x 792 DPI: 300 x 300 Print Size: 5.2 x 6.7 cm; 2.0 x 2.6 inches Colors: 2 (1 BitsPerPixel)
type: AnsweredQuestion
score: 0
tagged with: livecycle
answer count: 1

http://stackoverflow.com/a/36618004
upvote count: 2
has body: I think you're missing using Discriminator to let JPA understand what subclass to use for a given object (how does it know otherwise?). I tend to use abstract classes for table-per-subclass hireachies, so here's an example adapted to that for you: Event.java @Entity @DiscriminatorColumn(name = "type") @Inheritance(strategy = InheritanceType.JOINED) public abstract class Event { @Id @GeneratedValue public Long id; public String type; } SubEvent.java @Entity @DiscriminatorValue("subevent") @PrimaryKeyJoinColumn(name = "event_id") public class PeeringService extends Service { private String code; } With the above code, you'll notice something odd however - when generating the resource path for one of these objects, it assumes you have a Repository for each subclass, and generates something like this: { "type" : "subevent", "code" : "bacon", "_links" : { "self" : { "href" : "http://localhost:8081/subEvents/1" }, "peeringService" : { "href" : "http://localhost:8081/subEvents/1" } } } This is pretty easy to fix though, you just need to add the following annotation to your base class: @RestResource(path = "events") And it will generate the resource paths you'd expect! Hope this helps :)
downvote count: 0
has comment: http://stackoverflow.com/comment/61142226
has comment: http://stackoverflow.com/comment/61142304
type: Answer
answers question: http://stackoverflow.com/q/25451578
has comment: http://stackoverflow.com/comment/61139683
score: 2

http://stackoverflow.com/comment/39625912
comment on: http://stackoverflow.com/a/25404648
type: Comment
score: 0
type: AnswerComment
has text: Well, notDeComPresCo has a length of 85 and this Exception is also not thrown ... does that mean the problem is a kind of runtime exception?

http://stackoverflow.com/q/25418672
tagged with: servlets
tagged with: android-asynctask
has body: So the scenario is I am trying to debug a simple application on my real device.I am using eclipse to make the application. Now my application is communicating with a servlet which is on Server and application is running very smoothly in genymotion emulator(not using the emulator provided by eclipse). But when I try to run it in my device it is working perfectly till one activity class,but application is crashing on second activity. So, after so many searches I am posting this question here. Hope I can find out any solution for this. This is my Second Activity: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.success); Intent objIntent = getIntent(); s2 = objIntent.getStringExtra("repname"); findViewsById(); submit.setOnClickListener(this); } private void findViewsById() { submit = (Button) findViewById(R.id.submit); headerText = (TextView) findViewById(R.id.tv1); headerText.setVisibility(View.INVISIBLE); submit2 = (Button) findViewById(R.id.secondSubmit); submit2.setVisibility(View.INVISIBLE); t1= (TextView) findViewById(R.id.tvexample1); t2= (TextView) findViewById(R.id.tvexample2); submit2.setOnClickListener(new OnClickListener() { public void onClick(View v) { //DO SOMETHING! {RUN SOME FUNCTION ... DO CHECKS... ETC} lviewAdapter.clear(); lviewAdapter.notifyDataSetChanged(); Calendar cal = Calendar.getInstance(); System.out.println("what is from calendar"+cal); Date currentLocalTime = cal.getTime(); //System.out.println("what is from CurrentLocalTime"+currentLocalTime); DateFormat date = new SimpleDateFormat("yyyy-MM-dd"); date.setTimeZone(TimeZone.getTimeZone("GMT")); //System.out.println("what is from date"+date); String localTime = date.format(currentLocalTime); //localTime = "2014-08-26"; System.out.println("and result is == " + localTime); pb.setVisibility(View.VISIBLE); new MyAsyncTask().execute(localTime,s2); } }); pb=(ProgressBar)findViewById(R.id.progressBar1); pb.setVisibility(View.GONE); c=thi…
has comment: http://stackoverflow.com/comment/39726415
has answer: http://stackoverflow.com/a/25418876
type: UnansweredQuestion
answer count: 1
has title: Debugging Android App communicating with Servlet on real device
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
score: 1
tagged with: android
tagged with: java

http://stackoverflow.com/comment/39682037
type: Comment
type: QuestionComment
has text: don't have `name` and `class` in your Fragment XML choose 1 or the other
comment on: http://stackoverflow.com/q/25434593
score: 0

http://stackoverflow.com/a/34784468
answers question: http://stackoverflow.com/q/25454374
upvote count: 0
downvote count: 1
type: Answer
score: -1
has body: download.eclipse.org/technology/m2e/releases/1.3 has worked for Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 2 Build id: 20120216-1857 Thanks

http://stackoverflow.com/comment/39814695
comment on: http://stackoverflow.com/a/25504713
has text: Exactly, if you want to store images with different formats go for method 2.. :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25548148
score: 0
has body: I am using c3p0 connection pool for pooling in my hibernate project.This is my hibernate.cfg.xml file: <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/minkme_active java java123 org.hibernate.connection.C3P0ConnectionProvider 1 5 5 20 50 30 1 250 true true org.hibernate.transaction.JDBCTransactionFactory thread <mapping resource="Save.hbm.xml"/> <mapping resource="ad.hbm.xml"/> <mapping resource="msgs.hbm.xml"/> </hibernate-configuration> Here is my Snapshot ofrom TOAD for MYSQL: http://postimg.org/image/i45d3wri1/ Here i have set idle_test_period of 5 seconds so after every 5 seconds the ids of sessions change but i have also mentioned timeout of 30 seconds so after every 30 seconds the connections should be removed from database but that is not hapenning.
answer count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40004777
has title: Connections are not getting removed from connection pool in hibernate?
type: Question
tagged with: toad
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39996142
tagged with: c3p0
has comment: http://stackoverflow.com/comment/39967306

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/25493307
tags question: http://stackoverflow.com/q/25409908
tag name: android-actionbar
tags question: http://stackoverflow.com/q/25442753
tags question: http://stackoverflow.com/q/25390892

http://stackoverflow.com/q/25532419
has comment: http://stackoverflow.com/comment/39863217
tagged with: eclipse
tagged with: spring-mvc
score: 0
tagged with: java
answer count: 1
has title: Not getting response from controller in Spring MVC when using ajax
has comment: http://stackoverflow.com/comment/39862924
tagged with: jquery
type: Question
has answer: http://stackoverflow.com/a/25533913
tagged with: ajax
accepted answer: http://stackoverflow.com/a/25533913
type: AnsweredQuestion
has body: I have problem with Ajax call controller in Spring MVC 3 using eclipse kepler ide. i have find some tutoruials on youtube and make project for studying. I have earlier problem too when i have Ajax call to controller, but after some time get work normally. My project is made in Spring MVC project, i have all request jars, just not hitting controller with Ajax call. thise is my conf files, controller method and ajax call in jquery web.xml contextConfigLocation /WEB-INF/spring/root-context.xml org.springframework.web.context.ContextLoaderListener appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/appServlet/servlet-context.xml 1 appServlet / servlet-context.xml <mvc:resources location="/resources/" mapping="/resources/**"/> <property name="prefix" value="/WEB-INF/views/" /> <property name="suffix" value=".jsp" /> <context:component-scan base-package="com.milan.springajax.controller" /> my controller method @RequestMapping(value="/getJSON/{firstName}/{lastName}", method=RequestMethod.GET) public @ResponseBody Contact findByName(@PathVariable("firstName") String first, @PathVariable("lastName") String last, HttpServletRequest request, HttpServletResponse response){ Contact contact=contactService.findByName(first, last); return contact; } and ajax call who is located in jsp page in tag $(document).ready(function () { $('.button').on('click', function () { var first=$('#firstInput').val(); var last=$('#lastInput').val(); alert("button je stisnut " + first + " " + last); $.ajax({ type:"GET", url:'${pageContext.request.contextPath}/getJSON/' + first + "/" + last, dataType:'json', success: function(result) { var contact = "id: " + result.id + " | name : " + result.firstName + " " result.lastName + " | age : " + result.age; $('#theJson').html(contact); }, error: function(jqXHR, textStatus, errorThrown) { alert("Contact " + textStatus + errorThrown + " !"); } in thise line i get warning that i miss semicolon ??? }); }); }); and ht…

http://stackoverflow.com/comment/39793425
type: Comment
type: AnswerComment
has text: That's not really an answer. As I noted in my question, I know it only creates a reference on the stack, and nothing in the heap (unless s is a field, in which case the reference _does_ exist in the stack). My question is about where the type information is stored.
comment on: http://stackoverflow.com/a/25491383
score: 0

http://stackoverflow.com/comment/39711335
type: Comment
comment on: http://stackoverflow.com/a/25450587
score: 0
type: AnswerComment
has text: I'm afraid you won't able to do that. You need to have a key to deserialize a field in your POJO. JSON array doesn't have a key to bind to. The two just don't map one to another logically. Now, if you have any control over the back-end system you are talking to, you can add a key to the JSON array like this: { "variableObjects" : [...] } but I presume you can't do that, right?

http://stackoverflow.com/q/25425974
downvote count: 0
answer count: 1
tagged with: jaxb
has title: how to "canonicalize" arbitrary xml (by reordering all attributes and elements)
has comment: http://stackoverflow.com/comment/39671183
has comment: http://stackoverflow.com/comment/39679216
favorite count: 0
tagged with: xslt
type: Question
tagged with: java
has body: i have some code that generates an *.xsd file from a set of jaxb-annotated classes: JAXBContext context = //build from set of classes final DOMResult result = new DOMResult(); //will hold xsd output context.generateSchema(new SchemaOutputResolver() { @Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { return result; } }); Document doc = result.getNode(); OutputFormat format = new OutputFormat(doc); format.setIndenting(true); StringWriter writer = new StringWriter(); XMLSerializer serializer = new XMLSerializer(writer, format); serializer.serialize(doc); String xsd = writer.toString(); the problem is that the xsd produces (stored in xsd) is in random order - 2 runs with the same input might generate logically-identical xsds but in different element order, which plays havoc with diff tools when its written out to file. how to i "canonicalize" the xml inside xsd? i've seen some other references to xslt in related questions but anything i saw required listing the elements in advance. im looking for something that works on any xml input.
score: 4
accepted answer: http://stackoverflow.com/a/25429496
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25429496
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/39793836
has text: @JimGarrison I don't think this question is the same as the duplicate - this question is trying to get pointers to instances of certain type (which happens to be an annotation).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25494624
score: 3

http://stackoverflow.com/a/29661521
type: Answer
answers question: http://stackoverflow.com/q/25523178
score: 3
upvote count: 3
downvote count: 0
has body: It's simple just add the attribute $cancelProxyCreationTag in the java_Client class //Java.inc class java_Client { ... public $cancelProxyCreationTag; ... } This attribute is used in the Java destruct method . its mandatory if you are using the bridge in a loop.

google-app-engine
tags question: http://stackoverflow.com/q/25512632
tag name: google-app-engine
tags question: http://stackoverflow.com/q/25474353
tags question: http://stackoverflow.com/q/25515145
tags question: http://stackoverflow.com/q/25481874
tags question: http://stackoverflow.com/q/25434300
tags question: http://stackoverflow.com/q/25423679
tags question: http://stackoverflow.com/q/25537307
tags question: http://stackoverflow.com/q/25545712
type: Tag
tags question: http://stackoverflow.com/q/25414210
tags question: http://stackoverflow.com/q/25438479
tags question: http://stackoverflow.com/q/25445166
tags question: http://stackoverflow.com/q/25398118
tags question: http://stackoverflow.com/q/25515248
tags question: http://stackoverflow.com/q/25472752
tags question: http://stackoverflow.com/q/25494261
tags question: http://stackoverflow.com/q/25431712
tags question: http://stackoverflow.com/q/25528383
tags question: http://stackoverflow.com/q/25483495
tags question: http://stackoverflow.com/q/25391252
tags question: http://stackoverflow.com/q/25482241
tags question: http://stackoverflow.com/q/25405170
tags question: http://stackoverflow.com/q/25547895
tags question: http://stackoverflow.com/q/25529756
tags question: http://stackoverflow.com/q/25436114
tags question: http://stackoverflow.com/q/25415370
tags question: http://stackoverflow.com/q/25425976
tags question: http://stackoverflow.com/q/25393406
tags question: http://stackoverflow.com/q/25462002
tags question: http://stackoverflow.com/q/25438887
tags question: http://stackoverflow.com/q/25471271
tags question: http://stackoverflow.com/q/25406227
tags question: http://stackoverflow.com/q/25526611
tags question: http://stackoverflow.com/q/25525847
tags question: http://stackoverflow.com/q/25441693
tags question: http://stackoverflow.com/q/25447256
tags question: http://stackoverflow.com/q/25534772
tags question: http://stackoverflow.com/q/25437341
tags question: http://stackoverflow.com/q/25462233
tags question: http://stackoverflow.com/q/25512591
tags question: http://stackoverflow.com/q/25476793
tags question: http://stackoverflow.com/q/25418581
tags question: http://stackoverflow.com/q/25467609
tags question: http://stackoverflow.com/q/25446489

http://stackoverflow.com/comment/39687009
type: AnswerComment
score: 0
has text: Are you referring to the JPanel solution? If so, how do I make such JPanel behave like a JLabel in regards to layout?
type: Comment
comment on: http://stackoverflow.com/a/25437481

http://stackoverflow.com/comment/39754637
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example). 2) Rather than adding/removing components on user action, use a [`CardLayout`](http://download.oracle.com/javase/8/docs/api/java/awt/CardLayout.html), as shown [here](http://stackoverflow.com/questions/5665156/calling-awt-frame-methods-from-subclass/5786005#5786005).
comment on: http://stackoverflow.com/q/25473472
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39889666
has text: I am wondering which is more performant. The above solution or the solution in http://www.programcreek.com/2012/09/merge-files-in-java/. Do you know, which one is more performant?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25546890
type: Comment

http://stackoverflow.com/comment/39740779
type: Comment
type: QuestionComment
has text: Not unless you have some flag which all of those are monitoring
score: 0
comment on: http://stackoverflow.com/q/25466302

http://stackoverflow.com/a/25540797
downvote count: 0
has comment: http://stackoverflow.com/comment/39878885
score: 1
has body: If this were not Java, this regex should work, depending on what your end-of-line (EOL) character sequence is: (.|\n)*Location:\s*(.*)\n The string you want is at group index 1. Now since this regex is going to be inside a Java String, and since backslashes are escape characters in Java strings, you will actually have to pollute the pure regex with double backslashes: Pattern t_pat = Pattern.compile("(.|\\n)*Location:\\s*(.*)\\n"); In general, to test regexes, I really like this tool: http://regexpal.com/ It's an interactive tester that will progressively highlight your sample input as it matches the regex. When you edit the regex or change the sample input, the matching highlighting will update in real time. This does not support the required double backslashes of Java, so test in the tool with the singles, paste them to Java, and then add the extra backslashes. You may also want to play around with this tool, which is not as real-time but does support Java String regexes: http://www.regexplanet.com/advanced/java/index.html To break down what I have: (.|\n)* - zero or more characters or EOL sequences Location: - the string "Location:" \s* - zero or more white space (.*) - a regex group consisting of absolutely anything, which is what you will capture \n - EOL sequence You may need to replace \n with \r\n if you are on Windows, but try \n first and see. This will match everything in your sample input through "Main Hall", and will ignore everything after (&lt;span . . .&gt; etc.) "Main Hall" will end up in the match group 1.
answers question: http://stackoverflow.com/q/25540636
upvote count: 1
has comment: http://stackoverflow.com/comment/39896658
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/39878906
has comment: http://stackoverflow.com/comment/39878829
has comment: http://stackoverflow.com/comment/39879779
accepted answer of: http://stackoverflow.com/q/25540636

http://stackoverflow.com/q/25393600
favorite count: 0
type: Question
tagged with: unity-game-engine
tagged with: c#
type: UnansweredQuestion
has body: I'm attempting to connect my Unity project to Java via plugin in order to launch another application, and have been unsuccessful with attempts to do so. Unity (C#): public void AndroidCallNonStatic() { using (AndroidJavaClass javaClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using (AndroidJavaObject activity = javaClass.GetStatic&lt;AndroidJavaObject&gt;("currentActivity")) { object[] targs = new object[1] { "org.mozilla.firefox" }; activity.Call("nonStaticMethod", targs); } } } Java (Android): import com.unity3d.player.UnityPlayerActivity; public class Main extends UnityPlayerActivity { public static Context mContext; public static PackageManager mManager; @Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); mContext = this; mManager = getPackageManager(); } public void nonStaticMethod(String s) { Log.d("TAG","nonStatic method was called"); launchApp(s); } public static void StaticMethod(String s) { Log.d("TAG","Static method was called " + s); launchApp(s); } public void launchApp(String packageName) { Intent intent = getPackageManager().getLaunchIntentForPackage(packageName); if (intent != null) { // Activity was found, launch new app intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { // Activity not found. Send user to market intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("market://details?id="+packageName)); startActivity(intent); } } } Can anyone help me out with this? I've exhausted the extent of my Android/Unity knowledge and can't understand why it's not working. My thoughts are that it has something to do with the package name.
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39605844
has answer: http://stackoverflow.com/a/50205265
has comment: http://stackoverflow.com/comment/39605532
score: 1
tagged with: android
tagged with: java
has title: Launching Android Applications through Unity / Java plugins
answer count: 1

http://stackoverflow.com/comment/39748865
comment on: http://stackoverflow.com/a/25470691
score: 1
type: Comment
has text: Thanks, the issue was as you described. R.id.medresults1 should have been R.id.memresults1. I.e. the "d" and "m" were mixed up resulting in the error.
type: AnswerComment

http://stackoverflow.com/comment/39754112
comment on: http://stackoverflow.com/a/25459991
score: 0
type: Comment
has text: Good luck. :) It looks like the required modifications are extensive! I've been reading up on ImageJ 2.0 and get the impression that its been designed to avoid this kind of incompatibility. Beta or no, it might be worth a look.
type: AnswerComment

http://stackoverflow.com/q/25485478
score: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/25485772
favorite count: 0
tagged with: objectinputstream
type: Question
has answer: http://stackoverflow.com/a/25485772
tagged with: java
tagged with: httprequest
type: AnsweredQuestion
has title: ObjectInputStream gives StreamCorruptedException
downvote count: 0
answer count: 1
has body: I want to convert the inputStream (HttpRequest.getInputStream()) to an Object. try { ObjectInput ois = new ObjectInputStream (inputStream); resObject= ois.readObject(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } the inputStream contains xml in the form of String.

http://stackoverflow.com/q/25479363
has answer: http://stackoverflow.com/a/25479375
linked to: http://stackoverflow.com/q/3069743
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39765001
has comment: http://stackoverflow.com/comment/39764866
score: 1
tagged with: java
has body: In the code I am maintaining, some enums are starting with underscore. Is there any reason for following such practice?
has answer: http://stackoverflow.com/a/25479457
has comment: http://stackoverflow.com/comment/39791985
answer count: 2
has title: Why enum starting with an underscore?
upvote count: 3
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/39765086

http://stackoverflow.com/comment/39865075
has text: `all the tables are linked by the these id columns` -- so you mean to say that all tables have same value for their id? Also can you please clarify what do you mean by `in the last level, the vtiger_accountscf table has 1 vtiger_accountshipads and 1 vtiger_accountbillads.`
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25533449
type: QuestionComment

http://stackoverflow.com/comment/39798258
score: 0
has text: @MadProgrammer I haven't really, I just tried a bunch of different ones, however they all use JPanels, and I believe that's the problem. I have seen other ones which use DataBufferInts, however I have no experience with this, and It would require redoing a lot of my code, and I'm already getting to the point of admitting defeat and giving up.. I've spent almost 1 week straight on this 1 problem.
type: QuestionComment
comment on: http://stackoverflow.com/q/25496911
type: Comment

http://stackoverflow.com/comment/39825170
score: 1
comment on: http://stackoverflow.com/q/25511590
has text: You set the layout to be GridBag on the **old** content pane, that you are then replacing. Try setting the layout on the `content` panel, rather than the frame.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39769588
score: 0
type: Comment
type: QuestionComment
has text: You have something in angle brackets on your `ArrayList`, what does it do? Why are there no angle brackets on the `List` in the method signature?
comment on: http://stackoverflow.com/q/25481934

http://stackoverflow.com/comment/39750639
type: AnswerComment
score: 0
has text: I am trying to make that @MadProgrammer idea to work, but I want learn to so it this way, too. Ok, I created new class as you suggested, but I'm not sure what to put in mouseClicked() method. Putting `.this` seems logical here, so am I creating some kind of constructor here, with getters/setters for my values? And thank you for the answer. ;)
type: Comment
comment on: http://stackoverflow.com/a/25465884

http://stackoverflow.com/q/25518947
has title: In IntelliJ, how to automatically change getter/setter from static to non-static
score: 0
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25519272
has body: In IntelliJ, when changing a variable declaration from static to non-static, is there a way to automatically change its getter and setter's declaration from static to non-static?
tagged with: static
has comment: http://stackoverflow.com/comment/39838806
type: UnansweredQuestion
tagged with: java
tagged with: setter
tagged with: getter

http://stackoverflow.com/comment/39863212
comment on: http://stackoverflow.com/q/25531726
score: 0
type: Comment
type: QuestionComment
has text: String selectQuery = "SELECT * FROM resources id ORDER BY DESC LIMIT 1"; --- still comes up with 'no such column: DESC'...

http://stackoverflow.com/q/25424081
score: -2
tagged with: dialog
tagged with: android
has answer: http://stackoverflow.com/a/25425746
tagged with: class
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/39662086
upvote count: 0
has comment: http://stackoverflow.com/comment/39661804
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/25425746
linked to: http://stackoverflow.com/q/2336692
has title: Why there are two parallel classes in one file?
favorite count: 0
possible better answer: http://stackoverflow.com/a/25425418
type: Question
has answer: http://stackoverflow.com/a/25425418
tagged with: extends
linked to: http://stackoverflow.com/q/11177676
has body: see the classes hirachy below, I was confused very much that why two isolated classes can exist in one java file. I know the two classes have something to do with each other, but the problem is I do not clearly understand what exactly realationship between them. Also, if you noticed that NewFileTask extends TaskDialog.Task not TaskDialog, I can not understand what does that mean, and what does that used for? anyone can help? Any material or reference for me to understand will be appreciated. Thanks in advance! class NewFileTask extends TaskDialog.Task { public NewFileTask(String repoID, String parentDir, String fileName, DataManager dataManager) { @Override protected void runTask() { } } } and next is the class exits in the same java file public class NewFileDialog extends TaskDialog { public void init(String repoID, String parentDir, Account account) { } @Override protected View createDialogContentView(LayoutInflater inflater, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_new_file, null); fileNameText = (EditText) view.findViewById(R.id.new_file_name); if (savedInstanceState != null) { //... } return view; } } If you want to read the complete source code, please go here on github

http://stackoverflow.com/comment/40162222
has text: It points in the right direction but I don't consider it a definitive answer. That said, I don't think we'll get any better info until someone at Oracle can look at the bug report I submitted. So I'll accept this as the answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/25587953
score: 0
type: Comment

http://stackoverflow.com/comment/39667655
has text: @AvinashRaj yes, that's also correct. Nice one. OR keep it simple `<\b`
type: Comment
comment on: http://stackoverflow.com/a/25427146
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39767798
score: 0
has text: @ScaryWombat erm the whole thing compiles with no error but when run, it got stuck at right after i input the txt file to be read.
comment on: http://stackoverflow.com/q/25480766
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25543425
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25543301
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25543301
score: 1
has body: If it did, it would be a bug. Optimization is specifically not allowed to do that. That doesn't mean you don't need to synchronize your multithreaded programs; it means that if the optimizer breaks guarantees the synchronization makes, the optimization is broken. It also doesn't mean that this kind of problem never happens; sometimes, optimizers have bugs.
type: AcceptedAnswer

http://stackoverflow.com/q/25541588
has comment: http://stackoverflow.com/comment/39879730
accepted answer: http://stackoverflow.com/a/25541968
has comment: http://stackoverflow.com/comment/39879981
has answer: http://stackoverflow.com/a/25541968
type: AnsweredQuestion
score: 1
has title: java.sql.SQLException: Subquery returns more than 1 row
tagged with: java
has body: I have a program that when executed it gets lots of words from a file and inserts them into a database, after being inserted if the word is inserted twice it calculates the "IDF" again using a trigger. The problem is that if I do this directly into MySQL it has no problem, but if I do this on Java it returns this error: Exception in thread "main" java.sql.SQLException: Subquery returns more than 1 row at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2828) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2777) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:949) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:795) at model.Consultas.altaBajaCambio(Consultas.java:29) at model.DatosBD.agregarPalabra(DatosBD.java:23) at search.Search.main(Search.java:36) Java Result: 1 I assume the problem has to be with the st.execute(), since it only gives back one int, but I have search on the web for a solution and I cannot find one. Query: String query2 = "INSERT IGNORE INTO Search.IndiceInv (DocID, Term, TF) VALUES ("+doc+",'"+term+"',1) ON DUPLICATE KEY UPDATE `TF` = `TF` + 1;"; c.altaBajaCambio(query2); Execution: try (Connection con = c.getConnection()) { if (con == null) { System.out.println("No hay conexion"); } else { Statement st = con.createStatement(); st.execute(query); } Database: -- ----------------------------------------------------- -- Table `Search`.`Doc` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `Search`.`Doc` ( `DocID` INT NOT NULL, PRIMARY KEY (`DocID`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `Search`.`Term` -- --------------------…
answer count: 1
downvote count: 0
tagged with: mysql
upvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39880170

http://stackoverflow.com/comment/39799759
score: 1
type: Comment
has text: Sir , I need to fetch data from database, also I have created swing Gui i.e., Jdialog Gui in that I have added list Jlist, in this JList I have to fetch data from database.
comment on: http://stackoverflow.com/a/25490859
type: AnswerComment

http://stackoverflow.com/a/25539587
answers question: http://stackoverflow.com/q/25539347
type: Answer
has body: Provided table_layout is in the same scope as tablerowOnClickListener, change the Listener as follows: private OnClickListener tablerowOnClickListener = new OnClickListener() { public void onClick(View v) { //Highlight selected row for (int i = 0; i &lt; table_layout.getChildCount(); i++) { View row = table_layout.getChildAt(i); if (row == v) { row.setBackgroundColor(getResources().getColor(android.R.color.holo_red_light)); } else { //Change this to your normal background color. row.setBackgroundColor(getResources().getColor(android.R.color.transparent)); } } //... } };
score: 2
upvote count: 2
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25539347

http://stackoverflow.com/q/25492359
answer count: 1
tagged with: servlets
type: Question
has body: I have made spring web application sample project. I did all the basic configuration, with java based config and servlet 3.0 web.xml. But after all these configurations when i hit the url it gives me 404 error. What could be the problem. Could anyone please help me? web.xml: <?xml version="1.0" encoding="UTF-8"?> SpringPracs home org.springframework.web.servlet.DispatcherServlet contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation home.practise.configuration.SpringConfigs 1 home /practise/* configuration java class: package home.practise.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @ComponentScan(basePackages = "home.practise.application") @EnableWebMvc @PropertySource("classpath:practise.properties") public class SpringConfigs { @Bean public ViewResolver viewResolver() { InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver(); internalResourceViewResolver.setPrefix("/jspfiles/"); internalResourceViewResolver.setSuffix(".jsp"); return internalResourceViewResolver; } } Controller: package home.practise.application; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("homeController") public class HomeController { @RequestMapping("homePage.ht") public ModelAndView takeMeToHomePage(){ ModelAndView modelAndView = new ModelAndView("index"); return modelAndView; } } When I try to access this url http://localhost:8080/SpringP…
accepted answer: http://stackoverflow.com/a/25492691
has answer: http://stackoverflow.com/a/25492691
tagged with: spring
has title: Spring web application giving 404 error on tomcat-7.0.37
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39789485
has comment: http://stackoverflow.com/comment/39789457
tagged with: java

http://stackoverflow.com/comment/39743858
type: QuestionComment
has text: Thank you. I will change test to testResult
comment on: http://stackoverflow.com/q/25467978
score: 0
type: Comment

clickjacking
tag name: clickjacking
tags question: http://stackoverflow.com/q/25436658
type: Tag

http://stackoverflow.com/q/25511331
score: 0
has title: Spring 3.1.3 common model
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39824706
has answer: http://stackoverflow.com/a/25522390
type: Question
tagged with: model
has body: I'm developing a web page using spring 3.1.3 framework and I want to set a counter (number of registers counter) in all pages but I don't want to put in every get method this counter. There is any other way like a common model to set once and don't worry about this counter in any other page (and new pages also)?? Thanks
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39843663
tagged with: spring

http://stackoverflow.com/a/25467858
score: 0
answers question: http://stackoverflow.com/q/25467722
type: Answer
has body: You should ensure that the user can only enter numbers between 2 and 10, and you will need to store the input for use in your for loop. For example: int num = 0; Scanner in = new Scanner(System.in); do { System.out.print("Please enter a number between 2 and 10:") num = in.nextInt(); System.out.println(); } while((num &lt; 2) || (num &gt; 10)); Followed by your for loop.

http://stackoverflow.com/a/25500948
type: Answer
has body: Already fixed here: https://github.com/spring-projects/spring-boot/commit/2fae4afe (i.e. will be in 1.1.6)
has comment: http://stackoverflow.com/comment/40334971
has comment: http://stackoverflow.com/comment/40296466
has comment: http://stackoverflow.com/comment/40468507
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25499594
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40588750
has comment: http://stackoverflow.com/comment/40468675
answers question: http://stackoverflow.com/q/25499594
has comment: http://stackoverflow.com/comment/40589367
has comment: http://stackoverflow.com/comment/40470270
score: 1
has comment: http://stackoverflow.com/comment/40589203

http://stackoverflow.com/q/25429263
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
tagged with: collections
favorite count: 0
tagged with: android-asynctask
type: Question
type: UnansweredQuestion
has title: Android: cancellable Java Collection sort in AsyncTask.doInBackground
tagged with: android
has body: I am writing an application for Android mobile phones. I have a java.util.ArrayList that contains objects which require a custom java.util.Comparator to be sorted properly. I know I can use java.util.Collections.sort() but the amount of data is such that I want to sort my ArrayList in an android.os.AsyncTask. I do not want to use several AsyncTask objects that would each sort a subset of the data. Any AsyncTask can be cancelled so I want to regularly call AsyncTask.isCancelled() while I sort. If it returns true, I give up on sorting (and on my whole data set). I Googled but could not find an AsyncTask-friendly way to sort while regularly checking for cancellation. I may be able to call isCancelled() in my implementation of java.util.Comparator.compare() and throw my own subclass of java.lang.RuntimeException if it returns true. Then try{java.util.Collections.sort(ArrayList, Comparator);} catch () {} for that specific exception. I don't feel entirely comfortable with that approach. Alternatively, I can use an intermediary java.util.TreeSet and write 2 loops that each check for cancellation before every iteration. The first loop would add all the items of the ArrayList to the TreeSet (and my Comparator implementation keeps them sorted on insertion). The second loop would add all the object in the TreeSet back into the ArrayList, in the correct order, thanks to the TreeSet natural java.util.Iterator. This approach uses some extra memory but will assuredly work. The last approach I can think of is to implement myself what I have actually been looking for in Android: A generic java.util.List (preferably quick)sort using a java.util.Comparator and an android.os.AsyncTask that regularly checks for cancellation. Has anybody found that? Do you have any other solution to this problem? EDIT: Although I haven't given any thought to what the sorting method signature would look like, I would also be perfectly happy with using a android.os.CancellationSignal to decide when to aban…
has comment: http://stackoverflow.com/comment/39672738
linked to: http://stackoverflow.com/q/159590
has answer: http://stackoverflow.com/a/28844179
has comment: http://stackoverflow.com/comment/39671808
score: 1

http://stackoverflow.com/comment/39685739
comment on: http://stackoverflow.com/q/25436659
type: Comment
type: QuestionComment
has text: Yes. Declarative transaction handling is much cleaner, safer and readable than programmatic transaction handling.
score: 0

http://stackoverflow.com/q/25396584
has answer: http://stackoverflow.com/a/25396649
type: UnansweredQuestion
has body: In an attempt to write concise method names, would one usually delegate some of the information to the parameter names? That is to say, rather than: public Foos getFoosForBar(int barId); Could we simply use: public Foos getFoos(int barId); I do recognize that the second version could run into issues with overloading with differing params with idential types, e.g.: public Foos getFoos(int barId); ... public Foos getFoos(int lobsterId); But at the same time, if the method names are too explicit they can get ridiculously long, e.g.: public Foos getFoosForBarWithLobsterAndSteak(int barId, int lobsterId, int steakId); I know there isn't any silver bullet here, so I suppose I'm just asking for opinions.
has comment: http://stackoverflow.com/comment/39610988
has title: Java method naming conventions; Delegate to parameter names?
score: 0
has comment: http://stackoverflow.com/comment/39610936
upvote count: 2
tagged with: java
downvote count: 2
answer count: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/39811651
has text: @Gimby Yes thank you , your comment is what I actually want to do. Thanks thanks thanks. At real , I would like to calculate days from previous month.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25504551
type: QuestionComment

http://stackoverflow.com/q/25395212
type: Question
has comment: http://stackoverflow.com/comment/39608913
has body: A related question is this one: Where is the specification that defines this behavior for InputStreamReader?, but I'm not sure if it answers mine... Please note, I'm just experimenting with the language. I have this code: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Capitalize { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader( System.in))) { char c; do { c = Character.toUpperCase((char) br.read()); System.out.print(c); } while (c != (char) -1); } catch (IOException e) { e.printStackTrace(System.err); } } } Using ubuntu linux, I was expecting the output to be like this: fFoOoO bBaArR but instead, it's like this: foo bar (line feed) FOO BAR (waits for more characters or Ctrl + D) Right now I'm not sure about what is the behavior in windows, probably it's different, but still, this confuses me a bit. Reading the documentation for the read method, I see it will only return -1 if the end of stream is reached. I kind of understand how that would work for reading a file, but how about, in this case, the console? Why does it have to wait until the Ctrl + D is typed? Is there any way to get to the end of the stream without having to type Ctrl + D? Is there a way to achieve what I was expecting? Thanks in advance
answer count: 1
tagged with: inputstreamreader
linked to: http://stackoverflow.com/q/14012818
has comment: http://stackoverflow.com/comment/39609045
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/39608843
accepted answer: http://stackoverflow.com/a/25395424
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25395424
tagged with: java
has comment: http://stackoverflow.com/comment/39608673
has title: java InputStreamReader / BufferedReader "read" behavior

http://stackoverflow.com/comment/65865568
has text: Worked for me as well. I had to also put the option `stepwise=false`. The failure was only on the second connection which generate the error, the first connection was always successful. Putting `disconnect=true` force to release the connection between two consecutive calls.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25663698
score: 2

http://stackoverflow.com/q/25528634
has answer: http://stackoverflow.com/a/25535959
possible better answer: http://stackoverflow.com/a/25535536
answer count: 3
has body: I have a simple ServerSocket-based java program which accepts a client connection and puts it in a threadpool (ThreadPoolExecutor): while() { socket = serverSocket.accept(); pool.submit(new Client(socket)); // Client is a Runnable } Problem is when I try to shutdown the program and client threads stay around until the connection is closed on the other end (the jvm does not exit until then). I could try to maintain all client objects and close all their sockets when server is about to shutdown. But I have no clue how maintain them? Especially removing them when done. I tried beforeExecute etc, but that only gives me another object (a FutureTask), not the Client object I'm looking for. Update: The problem is not adding sockets to a list, the problem is removing them when they are done as there are no way (afaik) to use afterExecute for that.
upvote count: 3
has comment: http://stackoverflow.com/comment/39857332
has answer: http://stackoverflow.com/a/25535536
downvote count: 0
has comment: http://stackoverflow.com/comment/39857466
accepted answer: http://stackoverflow.com/a/25543410
has comment: http://stackoverflow.com/comment/39856464
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39856426
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39856968
has answer: http://stackoverflow.com/a/25543410
tagged with: network-programming
has title: Reliably closing client sockets in a thread pool on shutdown
tagged with: sockets
score: 3
tagged with: threadpool
tagged with: java

http://stackoverflow.com/q/25529012
tagged with: http
has title: How to measure a servlet's running time?
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25529325
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/39881164
has answer: http://stackoverflow.com/a/25529325
has body: I am creating a little tool to measure a java servlet's running time. The servlet gives an EPS type image on the outputstream (so if I call the servlet from a browser an EPS image downloads or a download window pops up - depends on the settings). I would like to measure the servlet's running time with my tool: I call the servlet for example 10000 times then count an average. My problem is: I want to avoid counting expensive I/O operations so I'd like to download the EPS per every single servlet call, but don't want to save them on my HDD. I have written this code: long startTime = System.nanoTime(); try { URLConnection connection = new URL(url + "?" + query).openConnection(); connection.setRequestProperty("Accept-Charset", charset); InputStream response = connection.getInputStream(); } catch (Exception e) { System.out.println("Connection failed!"); e.printStackTrace(); System.exit(0); } long endTime = System.nanoTime(); long deltaTime = endTime - startTime; Does it do what I want? Or should I do something with the imputsream? Does the EPS image download per every servlet call? I know they aren't saved, but do they download? Thanks!
tagged with: time
has comment: http://stackoverflow.com/comment/39856639
answer count: 1
tagged with: url
has comment: http://stackoverflow.com/comment/39856638

http://stackoverflow.com/a/25427496
downvote count: 0
answers question: http://stackoverflow.com/q/25427104
has body: If you don't have the need to test your application's performance exclusively on an ARM processor you can alternatively use other emulators like Genymotion which have a free version and uses your PC's processor instead of simulating an ARM: http://www.genymotion.com/
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/39750587
score: 0
has text: Yes. It works fine. I tried like this too. `echo \'my text\' >> file.txt`. This works fine. Thats why I was asking about alternative of `>`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25471597

http://stackoverflow.com/comment/39615832
comment on: http://stackoverflow.com/q/25399310
score: 0
type: Comment
has text: both way its not working: either by manually opening that is double click on it nor thru code `Desktop.getDesktop().open(file)`
type: QuestionComment

http://stackoverflow.com/comment/39702635
type: QuestionComment
comment on: http://stackoverflow.com/q/25446426
score: 0
type: Comment
has text: This is not possible - you can use a `switch` statement.

http://stackoverflow.com/a/32934829
has body: I had a similar Problem with modproxy and wstunnel module in apache2 version 2.4.10 on Ubuntu 15.04. I used tcpflow to figure out what happened and saw that my HTTP Proxy worked correctly and sent everything to my nodejs server, but my websocket Proxy directly returned the website at /. Luckily, i had a working Debian server with nearly the same configuration, and I found out the only difference was the following: On the non-working server: &lt;Directory /&gt; Options FollowSymLinks AllowOverride None &lt;/Directory&gt; On the working server: &lt;Directory /&gt; Options FollowSymLinks AllowOverride None Require all denied &lt;/Directory&gt; I don't know why this worked in my case, but I hope adding the Directory directive to your VirtualHost will solve your Problem too.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25540103
upvote count: 1
score: 1

http://stackoverflow.com/a/25537797
type: Answer
score: 0
has body: This code is untested, using python's csv library stores the rows in a dictionary with the key as the first column which in this case is the persons name. import csv data = {} with open('/Users/customers.txt', 'rb') as csvfile: spamreader = csv.reader(csvfile, delimiter='|', quotechar='"') for row in spamreader: data[row[0]] = row print data
answers question: http://stackoverflow.com/q/25537575

http://stackoverflow.com/a/25542727
downvote count: 0
has comment: http://stackoverflow.com/comment/39896114
upvote count: 1
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25542511
has body: This line shortenedKey = String.valueOf(shortenedBytes); is not doing what you think. In order to get a string representation of the byte values inside the array you need to implement a little utility method. Furthermore, if the call to MessageDigest.getInstance("MD5"); ever throws a NoSuchAlgorithmException your program will crash a little later here md.update(key.getBytes()); with a NullPointerException.

http://stackoverflow.com/comment/39765086
comment on: http://stackoverflow.com/q/25479363
score: 0
has text: @djechlin: I mean `public enum Argument { private ZEROTH, public FIRST, SECOND, THIRD, FOURTH }` does not compile. Unless you know something I don't (which is quite possible).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39782438
score: 0
comment on: http://stackoverflow.com/a/25480600
has text: Agreed. Such approach could be implemented by using ajax requests too. Could you explain how to do this without websockets or ajax from the clientside? Servlets are managing requests, but how to push such requests from client periodically?
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25486028
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25485648
type: Answer
has body: I would create a class. For example: public class Book{ private int id; private String title; private String author; private String ISBN; private String callNumber; private String type; private String noOfCopy; public Book(int id, String title, String author, String ISBN, String callNumber, String type, String noOfCopy) { this.id = id; this.title = title; this.author = author; this.ISBN = ISBN; this.callNumber = callNumber; this.type = type; this.noOfCopy = noOfCopy; } &lt;Getter and Setter&gt; } and add a new Bookinstance to an Arraylist. List&lt;Book&gt; books= new ArrayList&lt;Book&gt;(); books.add(new Book(id, parts[0], parts[1], parts[2], parts[3], parts[4], parts[5]))
downvote count: 0

http://stackoverflow.com/a/70507614
has body: If you use a combination of @Transactional(propagation = REQUIRES_NEW, noRollbackFor = MyRuntimeException.class) then this service can commit independently from the rollback of the parent transaction (which will occur if it is not annotated with noRollbackFor). Otherwise you would have to mark all the transactional methods involved with the same noRollbackFor annotation.
score: 0
answers question: http://stackoverflow.com/q/25489547
type: Answer

http://stackoverflow.com/comment/39873374
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25537977
type: AnswerComment
has text: It won't call `invokeVirtual` anyway. The only difference in the byte code for the second way is that it will create a pointless instance of `Util`, and then ignore it.

http://stackoverflow.com/q/25504562
has answer: http://stackoverflow.com/a/25504830
tagged with: spring-security
has body: I am working on a small library management system where users log in and add books from their collection. I am using Spring Boot with Spring Security, MySql and Hibernate. Users are able to login and when they are logged in I can take their info via ContexHolder and I can add books to database and get them all and display them in front-end, but now I want to bind every added book with currently logged in user so I can display only books this user has added, not all books from db. I am trying to do it like this: My BookController.java: @RestController @RequestMapping("/book") public class BookController { @Resource BookDAO bookDao; @RequestMapping(value = "/save", method = RequestMethod.POST) public HashMap&lt;String, String&gt; addBook(@RequestBody Book book) { book.setUser(new Security().getCurrentUser()); bookDao.save(book); return Response.setSuccess("Book saved successfuly."); } My Security.java: public class Security { private UserDAO userDao; @RequestMapping(value = "/getCurentUser", method = RequestMethod.GET) public User getCurrentUser() { return userDao.findByEmail(SecurityContextHolder.getContext().getAuthentication().getName()); } } But, for some reason, in this case, method getCurrentUser returns null and I get NullPointerException. But when I use the same method from UserController.java it returns exactly what I expect i to return. This is tested at the same run (first I called a method from Securty.java and it returned null, then I called method from UserControll.java and I got currently logged in user (me) ). Here is my UserController.java (only getCurrentUser and loginUser methods): @RestController @RequestMapping("/user") public class UserController { @Resource private UserDAO userDao; @Autowired AuthenticationManager authenticationManager; @Autowired BCryptPasswordEncoder encoder; @RequestMapping(value = "/getCurentUser", method = RequestMethod.GET) public User getCurrentUser() { return userDao.findByEmail(SecurityContextHolder.getContext().getAuth…
type: Question
has answer: http://stackoverflow.com/a/25524304
type: UnansweredQuestion
tagged with: hibernate
has title: Cant put users ID as FK for added database entry (bind added entry to currently loggedin user) - Hibernate, Spring, Spring Security -
tagged with: spring-mvc
score: 0
answer count: 2
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/39695590
has text: check this answer: http://stackoverflow.com/questions/11060491/is-there-a-clean-way-to-assign-the-class-of-a-generic-type-to-a-variable
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25442070
type: QuestionComment

http://stackoverflow.com/comment/39874449
type: QuestionComment
type: Comment
has text: @JigarJoshi for(X myx : GetList) that was outstanding Thanks ...
score: 0
comment on: http://stackoverflow.com/q/25538511

http://stackoverflow.com/comment/39730227
type: QuestionComment
comment on: http://stackoverflow.com/q/25460448
score: 1
type: Comment
has text: Tomcat doesn't come with JTA support. You'll have to use a full-JEE server like JBoss or WebLogic or Glasshfish to have JTA (or use an XA transaction manager like Bitronix). But do you really need JTA? Do you intend to have transactions spanning multiple databases or JMS services?

http://stackoverflow.com/comment/39743282
comment on: http://stackoverflow.com/a/25462487
type: Comment
score: 0
type: AnswerComment
has text: One a different note, it seems common that `objectToJsonTransformer` and `jsonToObjectTransformer` are used together. The latter knows how to figure out the value for the `json__TypeId__` header from either a `java.lang.Class` or a `java.lang.String` but the former only supplies the `java.lang.Class` type. So it seems there is an asymmetry there.

http://stackoverflow.com/q/25518395
type: Question
has comment: http://stackoverflow.com/comment/39837787
tagged with: nullpointerexception
has title: Android NullPointerException Error Message
tagged with: android
has comment: http://stackoverflow.com/comment/39837775
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39837795
accepted answer: http://stackoverflow.com/a/25518441
has body: I am trying to create a navigation drawer in Android. Here is the code where I set up the navigation drawer: public class NavigationDrawer extends Activity { Context context; private String[] drawerListViewItems; private DrawerLayout drawerLayout; private ListView drawerListView; private ActionBarDrawerToggle actionBarDrawerToggle; protected DrawerLayout fullLayout; protected FrameLayout actContent; @Override public void setContentView(final int layoutResID) { fullLayout = (DrawerLayout) getLayoutInflater().inflate( R.layout.navigation_drawer, null); // Your base layout here actContent = (FrameLayout) fullLayout.findViewById(R.id.act_content); getLayoutInflater().inflate(layoutResID, actContent, true); super.setContentView(fullLayout); // get list items from strings.xml drawerListViewItems = getResources().getStringArray(R.array.items); // get ListView defined in navigation_drawer.xml drawerListView = (ListView) findViewById(R.id.left_drawer); // Set the adapter for the list view drawerListView.setAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.drawer_listview_item, drawerListViewItems)); // App Icon drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); actionBarDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ drawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description */ R.string.drawer_close /* "close drawer" description */ ); // Set actionBarDrawerToggle as the DrawerListener drawerLayout.setDrawerListener(actionBarDrawerToggle); getActionBar().setDisplayHomeAsUpEnabled(true); // just styling option add shadow the right edge of the drawer drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); drawerListView.bringToFront(); //drawerListView.requestLayout(); drawerListView.setOnItemClickListener(new DrawerItemClickListener()); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigu…
has comment: http://stackoverflow.com/comment/39837749
has answer: http://stackoverflow.com/a/25518441
tagged with: navigation-drawer

list
type: Tag
tags question: http://stackoverflow.com/q/25529946
tags question: http://stackoverflow.com/q/25537575
tags question: http://stackoverflow.com/q/25420227
tags question: http://stackoverflow.com/q/25425056
tags question: http://stackoverflow.com/q/25433630
tags question: http://stackoverflow.com/q/25489745
tags question: http://stackoverflow.com/q/25465590
tags question: http://stackoverflow.com/q/25450822
tags question: http://stackoverflow.com/q/25460810
tags question: http://stackoverflow.com/q/25389924
tags question: http://stackoverflow.com/q/25450955
tags question: http://stackoverflow.com/q/25441718
tags question: http://stackoverflow.com/q/25432947
tags question: http://stackoverflow.com/q/25511847
tags question: http://stackoverflow.com/q/25434001
tags question: http://stackoverflow.com/q/25448145
tags question: http://stackoverflow.com/q/25507271
tags question: http://stackoverflow.com/q/25439409
tags question: http://stackoverflow.com/q/25407292
tags question: http://stackoverflow.com/q/25495622
tags question: http://stackoverflow.com/q/25495274
tags question: http://stackoverflow.com/q/25544387
tags question: http://stackoverflow.com/q/25544978
tag name: list
tags question: http://stackoverflow.com/q/25447502
tags question: http://stackoverflow.com/q/25415210
tags question: http://stackoverflow.com/q/25414607
tags question: http://stackoverflow.com/q/25483854
tags question: http://stackoverflow.com/q/25522857
tags question: http://stackoverflow.com/q/25525646
tags question: http://stackoverflow.com/q/25415970
tags question: http://stackoverflow.com/q/25538612
tags question: http://stackoverflow.com/q/25521207
tags question: http://stackoverflow.com/q/25447957
tags question: http://stackoverflow.com/q/25477745
tags question: http://stackoverflow.com/q/25502308

http://stackoverflow.com/comment/39713650
type: QuestionComment
has text: @Absurd-Mind While im not 100% on this, the linked question requires the use of -agentlib, which enables debugging connections on the JVM. Ive seen similar implementations which silently inject breakpoints into the application to capture data about Exceptions. I don't really feel comfortable doing this type of thing, but +1 for the link.
comment on: http://stackoverflow.com/q/25451275
type: Comment
score: 0

http://stackoverflow.com/a/25529784
has comment: http://stackoverflow.com/comment/39880971
has comment: http://stackoverflow.com/comment/39860342
answers question: http://stackoverflow.com/q/25529559
score: 0
type: Answer
has body: What the answer you linked to meant is that you do not use a @Before annotation at all. Instead you put whatever you wanted to do in the @Before method instead of the // run the before method here comment.

http://stackoverflow.com/comment/39672738
score: 0
has text: My vote will be go with throwing RuntimeException from comparator if task is cancelled. It may seem like a minor hack but given the situation is more elegant than having to roll your own sorting code.
type: Comment
comment on: http://stackoverflow.com/q/25429263
type: QuestionComment

http://stackoverflow.com/q/25464992
downvote count: 1
type: AnsweredQuestion
tagged with: android-layout
tagged with: components
has title: Android UI components are changing by their own... Android
tagged with: android
tagged with: java
score: -1
tagged with: eclipse
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39738211
accepted answer: http://stackoverflow.com/a/25470255
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25470255
has body: I am newbie in android development, so I have a little problem. I use relative layout, but my components (buttons, textviews, edittext etc), changes their place when, for example, I change some other component, or even toggle it invisible. I would like to know how can I make them independent one from another? To change place of one, without moving others and so on? Here is my xml code. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.misteriousegg.MainActivity" android:orientation="vertical" android:background="#111111" &gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/editText1" android:layout_centerVertical="true" android:text="Aj da radi brate da se ja onako ne bih nervirao, i tako /n i tako" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#FFFFFF" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/button2" android:layout_alignBottom="@+id/button2" android:layout_toLeftOf="@+id/textView1" android:onClick="Funkcija" android:text="Pocni!" android:textColor="#FFFFFF" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/textView2" android:layout_alignRight="@+id/textView2" android:layout_marginBottom="35dp" android:onClick="Funkcija1" android:text="Help?" android:textColor="#FFFFFF" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_conte…
has comment: http://stackoverflow.com/comment/39738403

http://stackoverflow.com/comment/39894532
comment on: http://stackoverflow.com/q/25549733
type: Comment
type: QuestionComment
score: 0
has text: I guess `drawSplash` is called within the `paint` method. You are explicitly using `Random` to display random text, so obviously, you are ending up with flashy, constantly changing text.

http://stackoverflow.com/q/25501754
has comment: http://stackoverflow.com/comment/39806355
downvote count: 0
has answer: http://stackoverflow.com/a/25502023
upvote count: 1
has comment: http://stackoverflow.com/comment/39806199
favorite count: 0
accepted answer: http://stackoverflow.com/a/25501918
type: Question
tagged with: object
has title: What happens internally when a reference variable of base class points to an object of sub class in JAVA
has comment: http://stackoverflow.com/comment/39806195
has comment: http://stackoverflow.com/comment/39806319
possible better answer: http://stackoverflow.com/a/25502023
has comment: http://stackoverflow.com/comment/39809942
has body: ABC a1 = new XYZ(); Where XYZ extends ABC. datatype is what tells us what a variable will contain. What is confusing me here is how is it even possible to ask a reference variable to point something it is not a variable of? And even if we can do it, whats that benefit of it? How does it work internally. when we write ABC a1 = new XYZ();
tagged with: inheritance
tagged with: class
tagged with: reference
type: AnsweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/39806599
has answer: http://stackoverflow.com/a/25501918
score: 1
tagged with: java

dreamweaver
type: Tag
tags question: http://stackoverflow.com/q/25468416
tag name: dreamweaver

http://stackoverflow.com/q/25416498
has answer: http://stackoverflow.com/a/25417098
has title: Java implicit Generic parameters from superclass
type: Question
linked to: http://stackoverflow.com/q/197190
answer count: 2
upvote count: 1
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25417299
favorite count: 0
score: 1
tagged with: java
has body: edit: I've made this example far simpler I want to create a class with a generic parameter which extends a type with a generic parameter X and I want to refer to that type X without declaring it explicitly. I'm not sure if this answers it too Why can&#39;t I use a type argument in a type parameter with multiple bounds? class Fruit&lt;T&gt; {} // I don't want to have to redefine T e.g. &lt;F extends Fruit&lt;T&gt;,T&gt; // because T should be implicit for Fruit (see Example of instance below) // the below will not compile, but is roughly what I'd like class Box&lt;F extends Fruit&lt;T&gt;&gt; { T get( F fruit ) { return null; } } Example of instance class Apple extends Fruit&lt;String&gt; // this is what I would like, but this won't compile with above definiton class AppleBox extends Box&lt;Apple&gt; { // String get( Apple apple ) should be implicit } I don't want to have to declare class AppleBox extends Box&lt;Apple,String&gt; Because String is the only option available here and should be known implicitly

http://stackoverflow.com/q/25437673
tagged with: java
has answer: http://stackoverflow.com/a/25437753
has comment: http://stackoverflow.com/comment/39687461
has comment: http://stackoverflow.com/comment/39687422
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/39687380
has title: can you change all this thing (JCheckBox) go to array and loop?
has comment: http://stackoverflow.com/comment/39687403
tagged with: jcheckbox
type: UnansweredQuestion
tagged with: user-interface
has comment: http://stackoverflow.com/comment/39687352
answer count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/39687499
type: Question
has body: I am doing some GUI and I use JCheckBox. I am wondering if this all can be do in an array and loop? It's so tiring to change every single thing. If you can help me I'd love to hear. if (box1.isSelected()) k = 40; if (box2.isSelected()) l = 30; if (box3.isSelected()) m = 20; if (box4.isSelected()) n = 10; if (box5.isSelected()) o = 10; if (box6.isSelected()) p = 10; if (box7.isSelected()) q = 10; if (box8.isSelected()) r = 10; if (box9.isSelected()) j = 10; if (box10.isSelected()) i =10; s = "Price for this is RM" + (k + l + m + n + o + p + q + r + j + i); JOptionPane.showMessageDialog(null, s);
score: 0

http://stackoverflow.com/comment/39610800
type: QuestionComment
comment on: http://stackoverflow.com/q/25396418
type: Comment
has text: @SotiriosDelimanolis: Sure I will update the question.
score: 0

rest
tags question: http://stackoverflow.com/q/25427588
tags question: http://stackoverflow.com/q/25530679
tags question: http://stackoverflow.com/q/25414922
tags question: http://stackoverflow.com/q/25391701
tags question: http://stackoverflow.com/q/25539848
tags question: http://stackoverflow.com/q/25511672
tags question: http://stackoverflow.com/q/25430889
tags question: http://stackoverflow.com/q/25441135
tags question: http://stackoverflow.com/q/25528093
tags question: http://stackoverflow.com/q/25420697
tags question: http://stackoverflow.com/q/25392262
tags question: http://stackoverflow.com/q/25405044
tags question: http://stackoverflow.com/q/25535387
tags question: http://stackoverflow.com/q/25418255
tags question: http://stackoverflow.com/q/25418029
tags question: http://stackoverflow.com/q/25404865
type: Tag
tags question: http://stackoverflow.com/q/25392025
tags question: http://stackoverflow.com/q/25515972
tags question: http://stackoverflow.com/q/25398469
tags question: http://stackoverflow.com/q/25463510
tags question: http://stackoverflow.com/q/25542450
tags question: http://stackoverflow.com/q/25528477
tags question: http://stackoverflow.com/q/25518186
tags question: http://stackoverflow.com/q/25479875
tags question: http://stackoverflow.com/q/25412478
tags question: http://stackoverflow.com/q/25541170
tags question: http://stackoverflow.com/q/25470319
tags question: http://stackoverflow.com/q/25397260
tags question: http://stackoverflow.com/q/25467233
tags question: http://stackoverflow.com/q/25545239
tags question: http://stackoverflow.com/q/25486488
tags question: http://stackoverflow.com/q/25406600
tags question: http://stackoverflow.com/q/25499594
tags question: http://stackoverflow.com/q/25543854
tags question: http://stackoverflow.com/q/25449445
tags question: http://stackoverflow.com/q/25509402
tag name: rest
tags question: http://stackoverflow.com/q/25485245
tags question: http://stackoverflow.com/q/25543692
tags question: http://stackoverflow.com/q/25424302
tags question: http://stackoverflow.com/q/25450455
tags question: http://stackoverflow.com/q/25415244
tags question: http://stackoverflow.com/q/25499025
tags question: http://stackoverflow.com/q/25496250
tags question: http://stackoverflow.com/q/25405399
tags question: http://stackoverflow.com/q/25504624
tags question: http://stackoverflow.com/q/25452184
tags question: http://stackoverflow.com/q/25394976
tags question: http://stackoverflow.com/q/25434614
tags question: http://stackoverflow.com/q/25413035
tags question: http://stackoverflow.com/q/25475881
tags question: http://stackoverflow.com/q/25487655
tags question: http://stackoverflow.com/q/25401210
tags question: http://stackoverflow.com/q/25398081
tags question: http://stackoverflow.com/q/25420304
tags question: http://stackoverflow.com/q/25455058
tags question: http://stackoverflow.com/q/25400646
tags question: http://stackoverflow.com/q/25533062
tags question: http://stackoverflow.com/q/25452866

http://stackoverflow.com/a/25456112
has body: After you have created a BOSH session with smack and have extracted the SID+RID values, you need to pass them to Strophe's attach() and from here on out you need to let strophe deal with this connection. Once Strophe has attached, you do not want your server to be doing anything to the connection at all. If your server side code sends any messages at all to the connection manager after strophe has attached, it's likely that it will send a invalid RID which will cause your session to terminate. Again, once the session has been established and is usable by strophe, do not attempt to continue using it from the server side. After your server side bosh client completes authentication and you've passed the SID+RID to the page, just destroy the server side connection object, don't attempt to disconnect or anything as this will end your session. The thing you need to remember is, unlike traditional XMPP connections over TCP, BOSH clients do NOT maintain a persistent connection to the server (this is why we use BOSH in web applications). So there is nothing to disconnect. The persistent connection is actually between the XMPP server and the BOSH connection manager, it's not something you need to deal with. So when you call disconnect from your server side BOSH client, you're telling the connection manager to end the session and close it's connection to the XMPP server, which completely defeats the purpose of creating the session in the first place.
upvote count: 2
score: 2
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39729688
has comment: http://stackoverflow.com/comment/39737675
has comment: http://stackoverflow.com/comment/39830585
has comment: http://stackoverflow.com/comment/39814583
accepted answer of: http://stackoverflow.com/q/25455638
has comment: http://stackoverflow.com/comment/39823263
has comment: http://stackoverflow.com/comment/39737874
has comment: http://stackoverflow.com/comment/39828946
has comment: http://stackoverflow.com/comment/40057495
answers question: http://stackoverflow.com/q/25455638
type: Answer
has comment: http://stackoverflow.com/comment/39728906
has comment: http://stackoverflow.com/comment/39738319
has comment: http://stackoverflow.com/comment/39864507
has comment: http://stackoverflow.com/comment/39725930

http://stackoverflow.com/comment/39890330
score: 0
has text: This issue is fixed, i made a mistake in the fileSystem location. actually we need to point a shared file system. i gave a local location of each node. Now i changed the location to an shared mount folder [which is accessible by all nodes] and this issue is fixed, Thanks
type: QuestionComment
comment on: http://stackoverflow.com/q/25526286
type: Comment

http://stackoverflow.com/q/25548466
has answer: http://stackoverflow.com/a/25550495
type: Question
score: 0
type: UnansweredQuestion
answer count: 1
has body: I have a requirement to ensure that email addresses contain standard U.S. English characters. Without debating what that means and whether it is advisable, I am wondering if a regex alone is enough to satisfy that requirement, or do I also need to check the character set? Are there any circumstances in which a UTF-8 character could be pass a regex, but not be in the Latin character set that is used in the regex? This is some code I am using, and it appears to me that the regex is sufficient, but I wanted a 2nd opinion. package misc; import java.io.UnsupportedEncodingException; public class ValidateCharacterSet { public static void main(String args[]) { String czech = "Český"; String japanese = "日本語"; String spanish = "¡Qué magnifico es java!"; String english = "elephant_in-theRoom@yahoo.com"; System.out.println("iso check: " + czech + ":" + isISO8859(czech)); System.out.println("iso check: " + japanese + ":" + isISO8859(japanese)); System.out.println("iso check: " + spanish + ":" + isISO8859(spanish)); System.out.println("iso check: " + english + ":" + isISO8859(english)); System.out.println(""); System.out.println("regex match: " + czech + ":" + playWithMatches(czech)); System.out.println("regex match: " + japanese + ":" + playWithMatches(japanese)); System.out.println("regex match: " + spanish + ":" + playWithMatches(spanish)); System.out.println("regex match: " + english + ":" + playWithMatches(english)); } /** * Returns true if the string is null, or the original string (str) equals the string (encodedAsISO8859) * that was encoded ISO-8859-1. * * @param str String containing bytes for which to check the encoding. * @return True if the string is in ISO-8859-1 format. */ private static boolean isISO8859(String str) { // a null string is compliant by definition. if (str == null) { return true; } try { byte[] iso88591Data = str.getBytes("ISO-8859-1"); String encodedAsISO8859 = new String(iso88591Data, "ISO-8859-1"); if (str.equals(encodedAsISO8859)) { return true; }…
tagged with: java
has title: Is Regex Sufficient, or Do I need to check Encoding?
tagged with: character-encoding
tagged with: regex

http://stackoverflow.com/comment/39831554
type: QuestionComment
comment on: http://stackoverflow.com/q/25514964
score: 0
has text: possible duplicate of [Is Java "pass-by-reference" or "pass-by-value"?](http://stackoverflow.com/questions/40480/is-java-pass-by-reference-or-pass-by-value)
type: Comment

http://stackoverflow.com/comment/39619665
score: 0
type: AnswerComment
type: Comment
has text: @Armpc I updated the answer but please note that complete code is less useful than understanding the concepts.
comment on: http://stackoverflow.com/a/25401314

http://stackoverflow.com/comment/39625171
comment on: http://stackoverflow.com/q/25402594
type: Comment
type: QuestionComment
has text: the error message says that the json for Packet class does not have the type information. Does seem that there is anything wrong with data field.
score: 0

http://stackoverflow.com/comment/39703470
has text: It's just a simplified example, most common screens won't be able to get the code of this method on screen xD This one makes no sense, but the problem is the same.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25446442
score: 1

http://stackoverflow.com/q/25464818
score: 0
duplicate of: http://stackoverflow.com/q/13811020
has answer: http://stackoverflow.com/a/25464867
tagged with: java
has title: error: class HackerRank is public, should be declared in a file named HackerRank.java
type: Question
has answer: http://stackoverflow.com/a/25465003
has comment: http://stackoverflow.com/comment/39737906
has body: While submitting code on HackerRank, I am getting this compilation error: error: class HackerRank is public, should be declared in a file named HackerRank.java How can I get rid of it? I have tried changing the name of the class to main, but still it gives me the same compilation error. import java.io.IOException; import java.util.Scanner; public class HackerRank { public static void main(String a[]) throws IOException, Exception { Scanner in = new Scanner (System.in); int test = in.nextInt(); Scanner in1 = new Scanner(System.in); if (test &lt; 1 || test &gt; 10) { throw new Exception("Illegal test cases"); } while (test-- &gt; 0) { // System.out.println("Enter patient dna"); String patient = in1.nextLine().toLowerCase(); // System.out.println("Enter virus dna"); String virus = in1.nextLine().toLowerCase(); int l = virus.length(); int i = 0; int count = 0; if (patient.length() &gt; 100000 || virus.length() &gt; 100000) { throw new Exception("Input length out of bounds"); } for (i = 0; i &lt; patient.length() - virus.length(); i++) { String sub = patient.substring(i, i + l); count = 0; for (int j = 0; j &lt; sub.length(); j++) { if (virus.charAt(j) != sub.charAt(j)) { count++; } } if (count == 0 || count == 1) { System.out.print(i + " "); } } System.out.println(); } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39738193
has answer: http://stackoverflow.com/a/25619203
linked to: http://stackoverflow.com/q/13811020
has comment: http://stackoverflow.com/comment/39737892
has comment: http://stackoverflow.com/comment/39738053
answer count: 4
has answer: http://stackoverflow.com/a/25464886

http://stackoverflow.com/q/25467734
has title: JXTreeTable scroll upon adding new node?
has body: I have a JXTreeTable with an add button. The button works as expected: it adds a new node to the end, with values that (for the purpose of testing) are hard-coded into my program. The line: modelSupport.fireChildAdded(new TreePath(root), noOfChildren-1, dataNode); tells the JXTreeTable to recognise the update made to the TreeTableModel, and to refresh accordingly. I then execute: treeTable.changeSelection(treeTable.getRowCount()-1, 0, false, false); to automatically select this new node. This works as expected, BUT I also expected it to automatically scroll to bring this new node into sight, which it does not. Instead, it scrolls to show only the penultimate node, leaving the new node hidden just slightly beyond view. I've also tried using tricks to programmatically scroll to the final record. However, this code: JScrollBar vertical = scrollPane.getVerticalScrollBar(); vertical.setValue(vertical.getMaximum()); revealed the same problem. Bizarrely, if I attach either of the above two blocks of code to a "Scroll to Bottom" button, and press this button manually after adding the new node, it all works fine! Please can anyone isolate the cause of this bug, or offer a fix/workaround?
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/31013610
tagged with: jxtreetable
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25611321
type: UnansweredQuestion
tagged with: swingx
tagged with: swing

http://stackoverflow.com/comment/39811301
comment on: http://stackoverflow.com/q/25486349
type: Comment
type: QuestionComment
has text: See the answer here: http://stackoverflow.com/questions/25343987/android-maven-project-in-eclipse-with-apklib/25426885#25426885
score: 0

http://stackoverflow.com/q/25516187
type: Question
has body: I have a CardScrollView with four Cards and when the user does a tap, it shows up a menu with an option saying : "Delete card". Then when the user does a tap again, it has to delete the current card and goes to the next card. This is easy to understand if we see the "Take a picture" app, when you take a picture is a card and then you tap for see the menu and select "Delete". It deletes the image and jumps to the next picture. Not sure how it's working in the Take a picture app so I'm not able to recreate the same effect in my app. I'm using a List for holding the cards.
upvote count: 0
type: UnansweredQuestion
tagged with: android
score: -1
has answer: http://stackoverflow.com/a/25558992
has title: Remove Card from CardScrollView
tagged with: google-glass
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/39840459
has text: Proposed answer is for different question. This one is around how to get '25th' as day.
score: 0
comment on: http://stackoverflow.com/q/25520007
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25476756
possible better answer: http://stackoverflow.com/a/25476785
has comment: http://stackoverflow.com/comment/39760112
has answer: http://stackoverflow.com/a/25476785
favorite count: 0
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/6531950
tagged with: network-programming
tagged with: multithreading
tagged with: android
has body: I need to continously broadcast UDP packets from a Android application, so I created a class that derives from TimerTask. When I try to update a UI element from within my TimerTask, the app crashes which tells me that it runs on a separate thread. However, when I'm trying to send a UDP packet, the app crashes because of a NetworkOnMainThreadException. // simplified public class UdpDiscoveryTask extends TimerTask { private final DatagramSocket _socket; public UdpDiscoverytAsk() { _socket = new DatagramSocket(PORT); } @Override public void run() { DatagramPacket packet = new DatagramPacket("Hello".getBytes().....); _socket.send(packet); } }
has title: NetworkOnMainThreadException in TimerTask
type: AnsweredQuestion
tagged with: udp
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39759980
tagged with: java
has answer: http://stackoverflow.com/a/25476790
accepted answer: http://stackoverflow.com/a/25476790

http://stackoverflow.com/comment/39775412
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25484321
type: Comment
has text: GMT simply doesn't know the concept of daylight savings.

http://stackoverflow.com/a/25437957
downvote count: 0
answers question: http://stackoverflow.com/q/25437925
has body: Beyond revalidate();ing the pane, you also need to repaint(); it. Thus your mousePressed method should become: public void mousePressed(MouseEvent e) { clickPanel CP = new clickPanel(); hasAnImage.add(CP); revalidate(); repaint(); } For further reading: http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#repaint()
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/25488821
type: Question
possible better answer: http://stackoverflow.com/a/25488916
has title: Java - Using scanner to read multiple items on the same line
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25488916
has body: I'm trying to load in a text file that is formatted like so: int String int int String int int String int What I want to do is to read the three values and put them into a constructor My usual approach to a problem like this would be to simply do int t = infile.nextInt(); String d = infile.nextLine(); int p = infile.nextInt(); Entry e = new Entry(t,d,p); However, this only works if t,d and p are on separate lines because of nextInt() and nextLine() My question is, how do I proceed to read in the 3 values from the same line, and then move on to the next line?
accepted answer: http://stackoverflow.com/a/25488873
has answer: http://stackoverflow.com/a/25488873
has comment: http://stackoverflow.com/comment/39782200
type: AnsweredQuestion
tagged with: java
tagged with: java.util.scanner

jcomponent
type: Tag
tag name: jcomponent
tags question: http://stackoverflow.com/q/25419072
tags question: http://stackoverflow.com/q/25476564
tags question: http://stackoverflow.com/q/25536324

http://stackoverflow.com/q/25550021
score: 1
upvote count: 1
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/25550498
has answer: http://stackoverflow.com/a/25550200
type: Question
possible better answer: http://stackoverflow.com/a/25550132
downvote count: 0
accepted answer: http://stackoverflow.com/a/25550242
has answer: http://stackoverflow.com/a/25550132
has title: Word occurrence method not counting
has answer: http://stackoverflow.com/a/25550242
has body: I have a method that should count the occurrence of a word in a sentence and return the results. For some reason it's not counting. The code always returns 0. Here's the code. public static int countOccurance (String word, String sentence) { int count = 0; for (int i = 0; i != sentence.length()-word.length()-2; i++) { if (sentence.substring(i, i+word.length()-1).equalsIgnoreCase(word)) { count++; } } return count; } Can anyone tell me what's wrong with my method?
has answer: http://stackoverflow.com/a/25550136
has comment: http://stackoverflow.com/comment/39895230
has answer: http://stackoverflow.com/a/25550238
has answer: http://stackoverflow.com/a/25550198
has comment: http://stackoverflow.com/comment/39895115
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25503881
has answer: http://stackoverflow.com/a/25505299
has body: I have this code: static JFrame inputFrame = new JFrame(); static JTextField myTextfield = new JTextField(); static JButton myButton = new JButton("Hi!"); private static void inputGUI() { inputFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); inputFrame.setTitle("The INPUT"); inputFrame.setLayout(new FlowLayout()); inputFrame.setSize(1366,768); inputFrame.setVisible(true); inputFrame.add(myTextField); inputFrame.add(myButton); myButton.setEnabled(false); myTextField.addActionListener(myListener); } static ActionListener myListener = new ActionListener(){ public void actionPerformed(ActionEvent e){ if(e.getSource()==inputFrame){ //What Do I put here? } } } What I want to do is this: When I type something in myTextField without pressing enter, the button,myButton is enabled( e.g. myButton.setEnabled(true);).
type: AnsweredQuestion
score: 0
tagged with: validation
tagged with: java
has comment: http://stackoverflow.com/comment/39813480
has title: Java JTextField ActionListener check if the field has an input
answer count: 3
has answer: http://stackoverflow.com/a/25504940
has answer: http://stackoverflow.com/a/25504025
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/39810128
tagged with: actionlistener
linked to: http://stackoverflow.com/q/17132452
type: Question
possible better answer: http://stackoverflow.com/a/25504025
tagged with: input
accepted answer: http://stackoverflow.com/a/25505299

http://stackoverflow.com/comment/39848269
type: AnswerComment
has text: The same exception! :(
type: Comment
comment on: http://stackoverflow.com/a/25524443
score: 0

http://stackoverflow.com/comment/39909344
score: 0
has text: ... I think part of the confusion stems from the fact that Swing uses MVC at "multiple layers". trashgod and udalmik already mentioned this in their answers, but as an example: A `JTable` contains a `TableModel`. The `JTable` is a listener for the `TableModel`, and this is one incarnation of MVC. However, for *you* and your application, you may consider the `JTable` as the *view* (that shows data of *your* domain model). Apart from that, I can hardly say more than what was already said in all the other questions and answers about MVC here on stackoverflow. It seems to be an endless story.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25502552

http://stackoverflow.com/q/25444226
upvote count: 31
score: 31
type: AnsweredQuestion
tagged with: java
downvote count: 0
accepted answer: http://stackoverflow.com/a/25444320
has body: I want to know performance and efficiency of SparseArray and ArrayList and which one is better to use. I can't understand when to use SparseArray and when ArrayList ?
has answer: http://stackoverflow.com/a/25444320
favorite count: 0
has answer: http://stackoverflow.com/a/25444314
type: Question
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/25444314
has title: Difference between SparseArray Vs ArrayList?

http://stackoverflow.com/comment/39731728
score: 1
type: Comment
type: AnswerComment
has text: Please look at my code. Thread 2 once started is waiting on synchronized() because other thread currently running getCount() has sleep. I'm calling t.interrupt() on waiting thread, not sleeping thread.
comment on: http://stackoverflow.com/a/25461502

http://stackoverflow.com/q/25548103
has title: Highlight Imageview area according to Coordinate Android
tagged with: android
has answer: http://stackoverflow.com/a/25548682
type: UnansweredQuestion
score: 1
has body: I have one image in Image view. I want highlight image view area highlight on touchlistener according to coordinate (x1,y1) and (x2,y2). I want like this output. (source: sharedapk.com) this is image and highlight arabic ayat.
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
tagged with: graphics
tagged with: android-layout

http://stackoverflow.com/comment/39896268
score: 0
type: AnswerComment
has text: Do you want code for file upload??? Refer this link. [file-upload-example-in-servlet-and-jsp](http://javarevisited.blogspot.in/2013/07/ile-upload-example-in-servlet-and-jsp-java-web-tutorial-example.html)
comment on: http://stackoverflow.com/a/25448815
type: Comment

http://stackoverflow.com/comment/39694910
comment on: http://stackoverflow.com/a/25441747
type: Comment
type: AnswerComment
has text: I have tried that and it is working but not for `_id`. It is a good answer as long as you are querying the DB by anything other than _id. Id's are handled differently. Example in mongo shell: `db.somecollection.find({ 'nestedObject._id' : "magicId"})` is returning nothing, while `db.somecollection.find({ 'nestedObject._id' : ObjectId("magicId") })` is doing ok. I have tried to add `ObjectId(?0)` to `@Query` but then I got JSON parsing exception from java. Still, thanks for fast reply :)
score: 0

dart-pub
tags question: http://stackoverflow.com/q/25444923
tag name: dart-pub
type: Tag

http://stackoverflow.com/comment/39704882
has text: actually when I use your code there is a red line under mapper.readValue(reader, typeRef); and it suggested me to configure the build path. and after I searched I realized that I need to add a jar file from Jackson. and after I added it the error still existed so I was thinking maybe there is another dependancy to this jar file
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25446531

http://stackoverflow.com/comment/39709237
type: Comment
type: QuestionComment
has text: Thanks a lot man. Will definitely go through the link.
comment on: http://stackoverflow.com/q/25447528
score: 0

http://stackoverflow.com/comment/39875623
type: Comment
type: QuestionComment
has text: question about floating point precision has been asked thousands times here.
comment on: http://stackoverflow.com/q/25539222
score: 0

http://stackoverflow.com/q/25511727
has title: Frequency detection for guitar tuning
type: Question
score: 3
has comment: http://stackoverflow.com/comment/39825574
tagged with: frequency
has comment: http://stackoverflow.com/comment/39825492
tagged with: android
possible better answer: http://stackoverflow.com/a/25511987
has comment: http://stackoverflow.com/comment/39825353
tagged with: frequency-analysis
accepted answer: http://stackoverflow.com/a/25661186
has comment: http://stackoverflow.com/comment/39846044
tagged with: audio
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39825381
has answer: http://stackoverflow.com/a/25661186
answer count: 2
upvote count: 3
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39826557
has answer: http://stackoverflow.com/a/25511987
has body: I am planning to implement a mobile guitar tuner app. I did an initial research and found out some commonly used methods for pitch detection such as fast Fourier transformation , autocorrelation ,etc. I have also found out that FFT is not a very good mechanism to detect frequency. Since there are 2 parts in this project which is detecting the frequency of a guitar string and matching that frequency with the frequency which the string should be in,i thought of using an already implemented class library for detecting the frequency of a string. I currently have no idea how tough this project will be, so my question is which part of the project is tougher? Is it matching the 2 frequencies or detecting a frequency of a string ? Also is there a way to use the FFT but at the same time get the accurate frequency of the string. Thank you for your time.
has comment: http://stackoverflow.com/comment/39825445
favorite count: 0

http://stackoverflow.com/comment/120202006
score: 0
type: AnswerComment
has text: This should be the accepted answer. And yes, whoever decided to make JsonObject and JsonArray immutable (and rely on Builder pattern) in Jakarta EE JSON spec clearly did not think about such use cases... which is a pity.
comment on: http://stackoverflow.com/a/59631618
type: Comment

http://stackoverflow.com/q/25497312
tagged with: android
has body: I am trying to lock selected apps before opening them for a particular amount of time. After tons of research and failed implementations. I finally ended up getting my service class to somewhat work with my LockScreen activity. The big problem is that it locks my very own app in the process too. Here is my Service class ( I placed comments for your convenience and to help understand. The relevant part is towards the end of the code.): package com.alimuzaffar.android.childlock; import android.app.ActivityManager; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.IBinder; import android.util.Log; import java.io.File; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.Timer; import java.util.TimerTask; public class HeartBeat extends Service { private static final String TAG = HeartBeat.class.getSimpleName(); public Timer TIMER; String CURRENT_PACKAGE_NAME; private static Set&lt;AccessGranted&gt; mAccessGrantedList = new HashSet&lt;AccessGranted&gt;(); private Set&lt;String&gt; mLockedApps = new HashSet&lt;String&gt;(); private long lastModified = 0; private BroadcastReceiver mScreenStateReceiver; private BroadcastReceiver mAccessGrantedReceiver; private File mLockedAppsFile; @Override public IBinder onBind(Intent arg0) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { startService(new Intent(this, HeartBeat.class)); // Log.i("LocalService", "Received start id " + startId + ": " + // intent); // We want this service to continue running until it is explicitly // stopped, so return sticky. if (TIMER == null) { TIMER = new Timer(true); TIMER.scheduleAtFixedRate(new LockAppsTimerTask(), 1000, 250); mScreenStateReceiver = new BroadcastReceiver() { private boolean screenOff; @Override public void onReceive(Context context, Intent intent) { if (intent.getAction(…
tagged with: android-intent
answer count: 0
tagged with: java
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/44542559
has title: Blocked my own app with Service Class
favorite count: 0
type: Question
tagged with: android-service
tagged with: android-service-binding
has comment: http://stackoverflow.com/comment/39798610
type: UnansweredQuestion

http://stackoverflow.com/a/25443401
has comment: http://stackoverflow.com/comment/39729807
accepted answer of: http://stackoverflow.com/q/25442784
type: Answer
has comment: http://stackoverflow.com/comment/39772863
has comment: http://stackoverflow.com/comment/39772492
answers question: http://stackoverflow.com/q/25442784
score: 0
has comment: http://stackoverflow.com/comment/39706901
has comment: http://stackoverflow.com/comment/39771598
has body: Use iterator tag: Iterator will iterate over a value. An iterable value can be any of: java.util.Collection, java.util.Iterator, java.util.Enumeration, java.util.Map, or an array. The code: &lt;s:iterator value="list"/&gt; Price: &lt;s:property value="price"/&gt;&lt;br&gt; &lt;/s:iterator&gt;
has comment: http://stackoverflow.com/comment/39772131
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39701135
has comment: http://stackoverflow.com/comment/39701217
has comment: http://stackoverflow.com/comment/39771107
has comment: http://stackoverflow.com/comment/39772721

cpu-architecture
tags question: http://stackoverflow.com/q/25522793
tag name: cpu-architecture
type: Tag

http://stackoverflow.com/q/25540734
tagged with: android-emulator
type: Question
has comment: http://stackoverflow.com/comment/39878389
answer count: 2
has body: I created a simple file write/read app in Eclipse and have successfully tested that it could read what it wrote. The structure is fairly simple. I use FileOutputStream to write a samplefile.txt using openFileOutput and a FileInputStream using openFileInput to read it back. The only minor thing is that I don't know where is the file on my physical hard drive? Can anybody point me to where I could find the file in Windows?
has title: Where to find the created file in Android emulator in Windows
type: UnansweredQuestion
downvote count: 0
tagged with: file
upvote count: 1
has answer: http://stackoverflow.com/a/25540932
favorite count: 0
has answer: http://stackoverflow.com/a/25540877
score: 1
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39878451
tagged with: eclipse

http://stackoverflow.com/comment/39729873
type: Comment
type: QuestionComment
has text: HashMap associate a Key and a Value. There is two objects here. And List has only one dimension. So how do you want these two objects become one?
score: 0
comment on: http://stackoverflow.com/q/25460409

http://stackoverflow.com/a/25459399
answers question: http://stackoverflow.com/q/25459278
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: That is the Java ternary operator. It is similar to ternary operators in other languages. In this case: return &lt;boolean expression&gt; ? &lt;if true&gt; : &lt;if false&gt;; You have posted a recursive algorithm to calculate the sum of digits in an integer. Two equivalent methods are posted below: public int sumOfDigitsIf(int num) { if (num == 0) { return 0; } else { return num % 10 + sumOfDigitsIf(num / 10); } } public int sumOfDigitsLoop(int num) { // useful to examine if you aren't used to recursive algorithms int value = 0; while (num &gt; 0) { value += num % 10; num /= 10; } return value; }

http://stackoverflow.com/q/25446337
favorite count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: how to get specific value from json file in java
has answer: http://stackoverflow.com/a/25446531
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25446619
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has body: I have a json file like this: { "list": [ { "ID" : "1", "value" : "value is one" } { "ID" : "2", "value" : "value is two" } { "ID" : "3", "value" : "value is three" } { "ID" : "4", "value" : "value is four" } ] } what I want to do is read the josn file and returns the message based on the ID i specify. So for example if (this.list.containsKey("1")) { return this.list.get(messageTitle); } That's what I tried but it returns all the values and ID. JSONParser parser = new JSONParser(); try { Object obj = parser.parse(new FileReader("jsonFile.json")); JSONObject jsonObject = (JSONObject) obj; // loop array JSONArray msg = (JSONArray) jsonObject.get("list"); Iterator&lt;String&gt; iterator = msg.iterator(); while (iterator.hasNext()) { System.out.println(iterator.next()); } }

http://stackoverflow.com/comment/39869413
score: 0
type: QuestionComment
has text: @Leo : It should work in the server side.
comment on: http://stackoverflow.com/q/25535604
type: Comment

http://stackoverflow.com/q/25539347
has comment: http://stackoverflow.com/comment/39876150
type: Question
has comment: http://stackoverflow.com/comment/39876156
tagged with: android
has answer: http://stackoverflow.com/a/25539587
accepted answer: http://stackoverflow.com/a/25539587
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39875989
tagged with: onclicklistener
has title: Android table row onClickListener
has body: I am having some problems when trying to trigger events on table layout in Android. These are the codes I used to populate the table layout dynamically: private void BuildTable() { try { DatabaseAdapter mDbHelper = new DatabaseAdapter(Category.this); mDbHelper.open(); CategoryController cc = new CategoryController(mDbHelper.open()); Cursor mCur = mDb.rawQuery(cc.getAllCat(), null); if (mCur.getCount() != 0) { if (mCur.moveToFirst()) { // Setting table header TableRow row = new TableRow(this); row.setLayoutParams(new TableLayout.LayoutParams( TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); do { int cols = mCur.getColumnCount(); row = new TableRow(this); for (int j = 1; j &lt; cols; j++) { // Dynamically load data fetch from database // into table layout TextView tv = new TextView(this); tv.setLayoutParams(new TableRow.LayoutParams( TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tv.setPadding(5, 5, 10, 5); tv.setGravity(Gravity.LEFT); tv.setText(mCur.getString(j)); row.addView(tv); row.setId(j); } row.setClickable(true); row.setOnClickListener(tablerowOnClickListener); table_layout.addView(row); } while (mCur.moveToNext()); } } } catch (SQLException mSQLException) { throw mSQLException; } } And here is my table row onClickListener: private OnClickListener tablerowOnClickListener = new OnClickListener() { public void onClick(View v) { //Highlight selected row v.setBackgroundColor(getResources().getColor(android.R.color.holo_red_light)); final int k = v.getId(); Toast.makeText(Category.this, Integer.toString(k), Toast.LENGTH_SHORT).show(); } }; My problem is when I highlighted certain row and I select another row again, the previous highlighted row remains the same highlighted background color. I wonder how to solve it? Thanks in advance.
tagged with: sql
tagged with: java
answer count: 1
tagged with: mysql

http://stackoverflow.com/q/25462475
type: UnansweredQuestion
has body: Is there any way to provide a custom Image and handler for the home button, which is the left button in the action bar having the application icon?
tagged with: android
upvote count: 1
score: 0
has title: Android custom home button
tagged with: java
answer count: 1
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25462622

http://stackoverflow.com/a/25420952
upvote count: 6
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/39803836
answers question: http://stackoverflow.com/q/25420136
has body: I agree with the answer from Rod_Algonquin, but there is another way to do it. Just write your own class wrapping your array and implement a custom equals and hashCode method and let them return Arrays.equals() and Arrays.hashCode(). With this approach you can store your objects in a List and do contains checks on the list directly. List&lt;ArrayWrapper&gt; list = new ArrayList&lt;ArrayWrapper&gt;(); list.add(new ArrayWrapper(new String[]{"test", "123"})); list.add(new ArrayWrapper(new String[]{"abc", "def"})); list.add(new ArrayWrapper(new String[]{"789", "cgf"})); String[] arrayToSearchFor = {"test", "123"}; ArrayWrapper wrapperToSearchFor = new ArrayWrapper(arrayToSearchFor); System.out.println(list.contains(wrapperToSearchFor)); String[] arrayToSearchFor2 = {"hello", "123"}; ArrayWrapper wrapperToSearchFor2 = new ArrayWrapper(arrayToSearchFor2); System.out.println(list.contains(wrapperToSearchFor2)); class ArrayWrapper { private String[] array; public ArrayWrapper(String[] array) { this.array = array; } public String[] getArray() { return array; } @Override public int hashCode() { return Arrays.hashCode(array); } @Override public boolean equals(Object obj) { if (!(obj instanceof ArrayWrapper)) { return false; } return Arrays.equals(array, ((ArrayWrapper) obj).getArray()); } } this will print true false
type: Answer
has comment: http://stackoverflow.com/comment/39742002

http://stackoverflow.com/comment/39741909
has text: Maybe you should take a look at this question: http://stackoverflow.com/questions/4791654/taskbar-icon-with-lwjgl?rq=1
type: Comment
comment on: http://stackoverflow.com/q/25466586
type: QuestionComment
score: 0

restore
tag name: restore
type: Tag
tags question: http://stackoverflow.com/q/25526286

http://stackoverflow.com/comment/39872487
type: AnswerComment
has text: @BigbyWolf Is the single quote really relevant to uniquely identify the element? If you show the XML file you are querying, perhaps we can find another expression that returns the same node.
type: Comment
comment on: http://stackoverflow.com/a/25536187
score: 0

http://stackoverflow.com/comment/39821872
score: 0
type: Comment
type: QuestionComment
has text: Off topic: Nice surname
comment on: http://stackoverflow.com/q/25509290

http://stackoverflow.com/a/25418339
answers question: http://stackoverflow.com/q/25418116
type: Answer
downvote count: 0
score: 5
upvote count: 5
has body: You can try with this. InetAddress addr = InetAddress.getByName(clientIp); String host = addr.getHostName(); System.out.println(host); Converting an IP address to host name

http://stackoverflow.com/q/25399199
has body: I want to write program that returns the power set of a set. My initial method signature is this: private static Set&lt;Set&lt;Integer&gt;&gt; generate(Set&lt;Integer&gt; s) Firstly, I have question about the method signature: about the type of the paramether in the method - should it be Set&lt;Integer&gt; s or I have to be more specific and write something like HashSet&lt;Integer&gt; s? Second, what should be the return type of my method? Can I write as a return type Set&lt;Set&lt;Integer&gt;&gt; or this is not a good practice, and I have to be more specific, i.e. to write something like HashSet&lt;HashSet&lt;Integer&gt;&gt;? Another thing that is not quite clear for me: If I leave my method signature like this: private static Set&lt;Set&lt;Integer&gt;&gt; generate(Set&lt;Integer&gt; s) then I want to return some set of sets which will be the result. So I wrote something like this: Set&lt;Set&lt;Integer&gt;&gt; res = new HashSet&lt;HashSet&lt;Integer&gt;&gt;(); but the compiler complains. Why I can not create res like this way, and what is the best choice for returning the result in this question. And what are the ways to represent set of sets in Java?
answer count: 2
downvote count: 0
upvote count: 1
tagged with: set
has answer: http://stackoverflow.com/a/25399463
accepted answer: http://stackoverflow.com/a/25399463
has title: Confusion with representing set of sets in Java?
favorite count: 0
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25399262
possible better answer: http://stackoverflow.com/a/25399262
has comment: http://stackoverflow.com/comment/39615540

http://stackoverflow.com/q/25421066
has title: Android basic TTS engine from audio file
tagged with: android
accepted answer: http://stackoverflow.com/a/25523089
tagged with: java
tagged with: io
answer count: 1
has body: I have an mp3 file hello.mp3. I am wrapping the mp3 into FileInputStream and converting the input stream to bytes, then pushing the bytes to SynthesisCallback.audioAvailable(bytes,offset,length) but this results to just noise.The file hello.mp3 plays just fine if I load it to my Android Music play. Why is this not working when I push bytes from the file to SnthesisCallback? I have pasted my code below. This is where I generate the Audio stream from mp3 file: class AudioStream { InputStream stream; int length; } private AudioStream getAudioStream(String text) throws IOException { // TODO parse text, and generate audio file. File hello = new File(Environment.getExternalStorageDirectory(), "hello.mp3"); AudioStream astream = new AudioStream(); astream.length = hello.length(); astream.stream = new FileInputStream(hello); return astream; } This is my Inputstream to byte[] method. public byte[] inputStreamToByteArray(AudioStream inStream) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[inStream.length]; int bytesRead; while ((bytesRead = inStream.stream.read(buffer)) &gt; 0) { baos.write(buffer, 0, bytesRead); } return baos.toByteArray(); } This is my onSynthesizeText method in my TextToSpeechService class. @Override protected synchronized void onSynthesizeText(SynthesisRequest request, SynthesisCallback callback) { // TODO load language and other checks. // At this point, we have loaded the language callback.start(16000, AudioFormat.ENCODING_PCM_16BIT, 1 /* Number of channels. */); final String text = request.getText().toLowerCase(); try { Log.i(TAG, "Getting audio stream for text "+text); AudioStream aStream = getAudioStream(text); byte[] bytes = inputStreamToByteArray(aStream); final int maxBufferSize = callback.getMaxBufferSize(); int offset = 0; while (offset &lt; aStream.length) { int bytesToWrite = Math.min(maxBufferSize, aStream.length - offset); callback.audioAvailable(bytes, offset, bytesToWrite); offset +=…
has answer: http://stackoverflow.com/a/25523089
type: Question
upvote count: 4
tagged with: text-to-speech
downvote count: 0
score: 4
favorite count: 0
tagged with: audio
type: AnsweredQuestion

http://stackoverflow.com/a/25421844
has comment: http://stackoverflow.com/comment/39658069
type: Answer
upvote count: 1
has body: Package name means directory structure inside which .class file will be placed by compiler. If two java files with same package name but different package(don't know how) will be compiled, they will be placed in same directory. And protected fields will be accessible. In short, you cannot have same package name for different package, java will treat them as same package.
has comment: http://stackoverflow.com/comment/39657675
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25421776

http://stackoverflow.com/comment/39812023
type: QuestionComment
has text: @day_dreamer this is from my application, controllers in different packages `return "redirect:/app/grid/loadColumnConfig";` where `grid` is my `@RequestMapping(value = "grid")` at controller level, and `loadColumnConfig` is at method level. `app` is in my `web.xml`, ` /app/* `
type: Comment
comment on: http://stackoverflow.com/q/25501931
score: 0

http://stackoverflow.com/q/25508465
tagged with: swing
has title: How to overload tab key besides transferring focus
score: 0
has comment: http://stackoverflow.com/comment/39820258
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39820354
has body: So i try to design a component (only have access to this component), and when the user hit tab key depends on the value of a variable x, the component should behave differently. Let's say if x is 1, transfer the focus to next component (what tab normally does). If x is 2, do something else (this component consists of 3 smaller component, the "something else" here refers to transfer focus between those 3 smaller component). Currently I accomplished then case for x = 2 i used a key listener to do this, but now if x = 1 and I hit tab key, the focus won't transfer to the next component. So how can I add some new functionality to tab key while still keep its old functionality?
type: Question
has answer: http://stackoverflow.com/a/25509999
type: UnansweredQuestion

http://stackoverflow.com/comment/39618952
type: QuestionComment
has text: Simple way is create custom class and override hashcode and equals method.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25401007

navigation-drawer
tags question: http://stackoverflow.com/q/25405087
type: Tag
tags question: http://stackoverflow.com/q/25534806
tags question: http://stackoverflow.com/q/25410416
tags question: http://stackoverflow.com/q/25405953
tags question: http://stackoverflow.com/q/25518395
tag name: navigation-drawer

http://stackoverflow.com/a/25415593
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25415370
has body: Use a StringBuilder to build your string, then convert to String for the constructor ... StringBuilder audioSampleData = new StringBuilder(); for (int i = 0; i &lt; numberOfLines; i++) { audioSampleData.append(req.getReader().readLine()); } Text textAudioSampleData = new Text(audioSampleData.toString());
type: Answer
downvote count: 0

http://stackoverflow.com/comment/39836638
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25517675
has text: Your code is confusing. Where is there a MouseListener? What is it being added to? Why compare if MOUSE_CLICKED == BUTTON1. They'll never be equal as far as I understand these constants.

http://stackoverflow.com/comment/39646522
type: QuestionComment
comment on: http://stackoverflow.com/q/25415370
score: 0
has text: Because the string I would be concatenating in the for loop would be far too long (limit 500 chars).
type: Comment

http://stackoverflow.com/a/25494665
has comment: http://stackoverflow.com/comment/40385695
type: Answer
accepted answer of: http://stackoverflow.com/q/25494391
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25494391
has body: Simply, class com.gefanuc.proficyrtip.server.iFixWeb_Stub is missing. That class is not related to Tomcat (nor included), so a JAR must be missing from your current classpath.

http://stackoverflow.com/a/25442779
has comment: http://stackoverflow.com/comment/39716893
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39717952
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25428983
score: 2
answers question: http://stackoverflow.com/q/25428983
type: Answer
has body: This post is not an answer to your original question but the response to your last comment. Relational databases are based on the relation between entities. The relations may be one to one, one to many and so on. In your case the item is an entity which can have many common attributes shared accross all product types such as price, producer, supplier, quantity, gender etc. Shoe in this case is only a product type attribute of that entity. This approach will only help you to eliminate the problem you are experiencing now because you don’t need to worry which table to query as there going to be only one items table. Normalization helps to establish relations, so for example if a feature color depends only on itemID then it goes in the same table. If the color is an entity itself, for example an itemID describes only a model which is available in different colors, then you need to have an individual colors table and an intermediary table which will link an itemID with different colors called composite key. Again you don’t have to worry about which table to choose programmatically because the colors for both shoes and shirts will be in the same table. You only need to LEFT JOIN that table in case an shoes can have a color and shirts not. As you probably know in this case the LEFT JOIN will always return an item and if there is no color associated with it will return null for color column. Same applies to other attributes such as size, style, producer, quantity, etc. Please note that when you have producer then it goes to an individual table as the relation between items and producer is likely to be many to one (many items can have the same producer) and the ID of that must be referenced in item table. Also a producer can have many different contact numbers, and then the contact info goes to individual table as well. This approach allows you to build a singe query retrieving items of you interest and all required attributes. For example you have a product description pag…
upvote count: 2

http://stackoverflow.com/q/25401655
favorite count: 0
type: Question
tagged with: hierarchy
type: UnansweredQuestion
downvote count: 0
upvote count: 1
has title: Is there any way to exit a named loop (or otherwise) from an class further up in the hierarchy?
has body: I have this layout of abstract class: public abstract class AbstractMapper{ protected abstract void doMap(); protected String mapCode(final String code){ if(code.length &gt; 5){ //continue mainLoop from mapper } return code; } } and this implementation of a mapper (one of many): public class Mapper1{ @Override public void doMap(){ mainLoop: for(LoopVar var: LoopVars){ String code = var.getCode(); code = mapCode(code); //finish mapping } } I have mainLoop in ever implemented mapper, and in a lot of the mappers I call mapCode. However I'd like to continue the mainLoop every time my code length isn't what I want. I know I can simply add in an additional check in every implemented mapper but there are a lot of mappers, ideally I'd like to do it all cleanly in the method of the abstract class (and I'd rather not have to name my loop either but mapCode is usually sitting inside a nested loop). Any help would be appreciated. Thanks
score: 1
tagged with: java
answer count: 1
tagged with: loops
has answer: http://stackoverflow.com/a/25401858

http://stackoverflow.com/a/25414397
has comment: http://stackoverflow.com/comment/39645284
answers question: http://stackoverflow.com/q/25414310
score: 0
has comment: http://stackoverflow.com/comment/39647774
has body: You need to create a controller class. In the scene builder, you need to click controller in the scene builder (bottom left) and then type the name of the controller class you will make. Then, click "View" and then click "Sample controller skeleton." Copy this into a java class of the same name as the one you set in the controller pane.
has comment: http://stackoverflow.com/comment/39648049
type: Answer
has comment: http://stackoverflow.com/comment/39660994
has comment: http://stackoverflow.com/comment/39649812

http://stackoverflow.com/comment/39603856
has text: The SwingWorker should be feeding a model, which should provide update notifications to interested parties, this means that both the ui and your recorder and listen in to changes. Alternatively, you could have a proxy model which actually did the recording and slide it in and out as required...but that's up to you...
comment on: http://stackoverflow.com/q/25392239
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/a/30471811
type: Answer
has body: NIO.2 introduced asynchronous i/o. Asynchronous I/O is an approach to non-blocking i/o that is not supported by NIO. NIO: selectors / reactor pattern NIO.2: completion handlers / proactor pattern Thus when on Windows, NIO.2 uses I/O Completion Ports, which should boost performance. Except, nobody knows, because nobody uses Windows on the server side, and if they do, they probably do so because they are heavily invested in .net, and for that reason will most likely not consider using Java.
score: 67
has comment: http://stackoverflow.com/comment/97307125
upvote count: 68
answers question: http://stackoverflow.com/q/25537675
downvote count: 1
has comment: http://stackoverflow.com/comment/71752991
has comment: http://stackoverflow.com/comment/90736522

http://stackoverflow.com/comment/39716524
comment on: http://stackoverflow.com/q/25451420
score: 1
has text: It's totally unclear what you're asking. If you want to access a local variable by it's string name, you can't. (This question comes up about every 2 weeks.) If you want to create an instance of a class named by a string, that's simply a matter of doing newInstance on the Class object retrieved by Class.forName.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25572403
answers question: http://stackoverflow.com/q/25527986
has body: Seems like you accidentally added a wrong import! You need to import: import java.util.Iterator; Instead of: import javax.swing.text.html.HTMLDocument.Iterator; because the class HTMLDocument.Iterator is not used at all in the libgdx drop tutorial
type: Answer
has comment: http://stackoverflow.com/comment/40643062
accepted answer of: http://stackoverflow.com/q/25527986
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/39804224
type: Comment
type: QuestionComment
has text: @TGRHavoc but they read and write on the same threads.
comment on: http://stackoverflow.com/q/25500501
score: 0

http://stackoverflow.com/comment/39829471
score: 0
comment on: http://stackoverflow.com/q/25512543
type: Comment
type: QuestionComment
has text: @user2357112 Also note that OP gets the error when they comment out the overriden `clone` method in `AA` (which is in the same package).

http://stackoverflow.com/a/25422582
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/54996630
has comment: http://stackoverflow.com/comment/39664838
accepted answer of: http://stackoverflow.com/q/25422235
type: Answer
has body: To update any component visibility by checkbox click, you can use 'AjaxCheckBox', for example: //somewhere in the class create model variable: boolean checkBoxValue = true; //this is your hideable component Label someComponent; ... //and add PropertyModel for checkbox: AjaxCheckBox checkBox = new AjaxCheckBox("checkBox", new PropertyModel(this, "checkBoxValue")) { @Override protected void onUpdate(AjaxRequestTarget target) { //if checkbox is checked, then our component is shown someComponent.setVisible(checkBoxValue); target.add(someComponent); } }; ... //this is your component to update someComponent = new Label("someComponent", "some text"); //this method allows you to hide/show component with ajax updates. someComponent.setOutputMarkupPlaceholderTag ( true ); To gain checkBox value after submiting - you can check your checkBoxValue value. UPDATE Actually you could override your hideable component method onConfigure() to set its visibility according to 'checkBoxValue' (this is just another way to gain this, may be more preferred): someComponent = new Label("someComponent", "some text") { @Override protected void onConfigure() { setVisible ( checkBoxValue ); } }; If you do like this, then you could delete someComponent.setVisible(checkBoxValue); code from AjaxCheckBox#onUpdate() method UPDATE 2 Component WebMarkupContainer allows you to wrap some components. And when it is hiding - then they are really removes from markup. But markup for container will be exists with style display:hidden anyway. Create container somewhere like: WebMarkupContainer container = new WebMarkupContainer ( "cont" ); //we will hide this container, so we can replace someComponent.setOutputMarkupPlaceholderTag ( true ); by this container.setOutputMarkupPlaceholderTag ( true ); Add container to the form: form.add(container); Add our someComponent to this container: container.add(someComponent); And in AjaxCheckBox#onUpdate() method update container with ajax: protected void onUpdate(AjaxReque…
has comment: http://stackoverflow.com/comment/39666616
answers question: http://stackoverflow.com/q/25422235
score: 14
upvote count: 14
downvote count: 0
has comment: http://stackoverflow.com/comment/39665578

http://stackoverflow.com/q/25437812
has body: My current project is composed of two modules, one android and another one that can be used as standalone desktop java. I'd like to run this second module by itself and be able to debug it without going through a device. I don't want to have a secondary IntelliJ installation to swap between one or the other. Is there any way in AS to attach the debugger to a java gradle task? apply plugin: "java" sourceCompatibility = 1.6 sourceSets.main.java.srcDirs = [ "src/" ] project.ext.mainClassName = "com.project.Desktop.Launcher" project.ext.assetsDir = new File("../android/assets"); task run(dependsOn: classes, type: JavaExec) { main = project.mainClassName classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = project.assetsDir ignoreExitValue = true } task dist(type: Jar) { from files(sourceSets.main.output.classesDir) from files(sourceSets.main.output.resourcesDir) from {configurations.compile.collect {zipTree(it)}} from files(project.assetsDir); manifest { attributes 'Main-Class': project.mainClassName } } dist.dependsOn classes eclipse { project { name = appName + "-desktop" linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets' } } task afterEclipseImport(description: "Post processing after project generation", group: "IDE") { doLast { def classpath = new XmlParser().parse(file(".classpath")) new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]); def writer = new FileWriter(file(".classpath")) def printer = new XmlNodePrinter(new PrintWriter(writer)) printer.setPreserveWhitespace(true) printer.print(classpath) } }
has comment: http://stackoverflow.com/comment/39712850
answer count: 1
accepted answer: http://stackoverflow.com/a/26769987
has title: Debugging a gradle-based Java project on Android Studio?
has comment: http://stackoverflow.com/comment/39687632
has answer: http://stackoverflow.com/a/26769987
downvote count: 1
upvote count: 13
has comment: http://stackoverflow.com/comment/39705935
has comment: http://stackoverflow.com/comment/39706181
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39705375
has comment: http://stackoverflow.com/comment/39712142
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39706035
tagged with: gradle
favorite count: 0
type: Question
tagged with: android-studio
score: 12

http://stackoverflow.com/a/25423510
has comment: http://stackoverflow.com/comment/39660695
has body: OpenSessionInViewFilter Now when you are using OpenSessionInViewFilter, by default the session's flush mode is set to NEVER. So when you try to save something in your action using hibenate and commit it, it wont be reflected in your database. To solve this you need to flush the session in your action class or extend OpenSessionInViewFilter and override closeSession(Session session, SessionFactory sessionFactory). Now it is also possible that you are maintaining a single transaction for per request. In your action you edit the attributes of a object and update it using session.update(object). But it is not yet commited as some other processing is remaining. At the same time, some other request is invoking a action which tries to retrieve the object which you were updating. Since the object is not yet commited the other request will get the old object. To solve this you need to begin a transaction before you load object and commit the transaction after you update the object. So that as soon as the object is saved/updated it is commited. With this there can be many transaction in single user request but only one session. The OpenSessionInView pattern only guarantees that the session is open during one single thread execution. When the page has been rendered and has been returned to the browser, the session gets closed by the filter. So subsequent requests (e.g. navigation request) require another new session which will be opened by the OpenSessionInViewFilter. But as the "old" person object is not connected to the "new" session, it is considered as disconnected object which's references cannot be loaded lazily.
downvote count: 1
has comment: http://stackoverflow.com/comment/39661043
type: Answer
score: -1
answers question: http://stackoverflow.com/q/25411593
upvote count: 0

http://stackoverflow.com/comment/56295319
has text: Thanks for pointing this old question back, just for sake of history, there is now a rule template in SonarQube to detect any method call you specify and raise an issue accordingly.
type: Comment
comment on: http://stackoverflow.com/a/25536297
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39622812
comment on: http://stackoverflow.com/q/25403291
type: Comment
type: QuestionComment
score: 2
has text: You could use your own appender (maybe just a wrapper) and check the thread that calls it. You'd tell the appender which threads' messages to forward, e.g. by passing the thread or its id to the appender's constructor.

http://stackoverflow.com/comment/39624971
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25403492
has text: Sorry, this is stil not working. It always sets another star which I never clicked :( Edit: got a working solution now (see above), but still gave you upvote for your ideas and help! :) thank you
score: 0

http://stackoverflow.com/q/25472127
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/25472363
linked to: http://stackoverflow.com/q/2036970
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39751845
linked to: http://stackoverflow.com/q/27581
has comment: http://stackoverflow.com/comment/39751480
tagged with: java
has body: I'm having trouble shuffling a two dimensional array in Java. There are 10 base cards. This is the array: String[][] Cards = new String[][] { {"CardType1","CardName1","CardProperties"}, {"CardType1","CardName2","CardProperties"}, {"CardType1","CardName3","CardProperties"}, {"CardType2","CardName4","CardProperties"}, {"CardType2","CardName5","CardProperties"}, {"CardType2","CardName6","CardProperties"}, {"CardType2","CardName7","CardProperties"}, {"CardType3","CardName8","CardProperties"}, {"CardType3","CardName9","CardProperties"}, {"CardType3","CardName10","CardProperties"} }; Each card must replicate itself 4 times to complete a deck with 40 cards and then shuffle it. How can I use Java to do this?
has comment: http://stackoverflow.com/comment/39751447
linked to: http://stackoverflow.com/q/3718383
type: Question
score: 0
tagged with: shuffle
accepted answer: http://stackoverflow.com/a/25472363
has title: Repeat Values in array and shuffle it

http://stackoverflow.com/a/26918953
score: 0
answers question: http://stackoverflow.com/q/25455470
type: Answer
has body: I tried many solutions, but no one help. Then a moved tools.jar from "Idea_home"/jre/lib to "Idea_home"/lib and 64-bit IDEA properly launched. (also you may copy tools.jar from "JDK"/lib patch)

http://stackoverflow.com/comment/39825617
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25499687
has text: Have you tried reading in the file from the parent and just inheriting the property in all children? (use parent tag in child poms) Apologies if I can't provide more detail. I'm just kind of putting together different solutions I've done in the past, but never all done at once.
type: Comment

http://stackoverflow.com/q/25396082
linked to: http://stackoverflow.com/q/3143567
has comment: http://stackoverflow.com/comment/39610235
has body: I am using Linux Mint, Apache ANT and a command line. I am trying to write a game using LWJGL and am also developing a personal utility library at the same time. I am trying to create a runnable jar file of this game. Using ANT I have created a jar file with all of my classes for the game and a manifest specifying the main class to run and a classpath. My problem is that when I run the game using java -cp library.jar -jar game.jar I get a class not found error on a class from library.jar. If I run the game main class by going java -cp bin:library.jar game.MainClass The game runs fine, but the jar won't work. I have expanded the jar file and read the manifest, the class files are all there with the right directory structure (no bin directory, starts with game) and the manifest seems fine. I've tried including the current directory into the classpath (.:library.jar) and I have tried giving a full path to the jar rather than a local path. Besides actually expanding the entire library.jar into my game.jar how can I fix this? I can give more specific directory information if necessary.
has comment: http://stackoverflow.com/comment/39644867
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39610394
tagged with: ant
has title: Setting the classpath for a jar file to search for some other jars
has comment: http://stackoverflow.com/comment/39610247
has comment: http://stackoverflow.com/comment/39610207
answer count: 0
score: 0
tagged with: java
tagged with: jar
tagged with: classpath
type: Question

http://stackoverflow.com/a/25433207
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/25432610
has comment: http://stackoverflow.com/comment/39679334
upvote count: 5
has comment: http://stackoverflow.com/comment/39679821
type: Answer
has body: Ok .. the problem is within the design of your already existing code (which you can't change). Having public interface Test&lt;T extends MyInterface&gt; and then public class TestImpl implements Test&lt;MyInterfaceImpl&gt; is wrong. TestImpl is implementing Test with MyInterfaceImpl whereas the original Test interface only expects an object that extends MyInterface and not implement it. There will be a type confusion at runtime when executing the code. Not only does the following line throw a ClassCastException test.someMethod(new MyInterfaceImpl()); but also test.someMethod(); by itself throws an exception. So let's say if you factory called this method passing no argument, you would still get an exception as the original designed is flawed. In a normal situation test.someMethod(); should not throw an exception to begin with. You will need to talk to the appropriate party to put a fix to this serious issue. Below is a sample solution: The method someMethod(MyInterface...) belongs to the raw type Test. References to generic type Test&lt;T&gt; should be parameterized. This means you should Test&lt;MyInterfaceImpl&gt; test to avoid getting this error with only the new operator. Test&lt;MyInterfaceImpl&gt; test ... test.someMethod(new MyInterfaceImpl()); The above code will work with no problem.

http://stackoverflow.com/comment/39811126
score: 0
comment on: http://stackoverflow.com/a/25504364
has text: The answer was understandable and it worked. I was wondering, how can I set the selection foreground or maybe the default blue on every selection for the entire row ?
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25391077
tagged with: java
has body: I'm trying to open and modify an XML file in MATLAB using XPath. Here the code I have written so far: import javax.xml.xpath.* doc = xmlread(which('myXMLfile.xml')); factory = XPathFactory.newInstance(); xpath = factory.newXPath(); expr = xpath.compile('/data//parameter[@name=''MYPARAMETER'']/double'); nodeList = expr.evaluate(doc,XPathConstants.NODESET); disp(char(nodeList.item(0).getFirstChild.getNodeValue)) nodeList.item(0).setNodeValue('0.03') And my XML file : ... 0.05 ... The disp line correctly display in the MATLAB command window the value, which here is 0.05. The script doesn't throw an error. However, the 0.03 value is not set in the XML file. What am I doing wrong and why is the value not written to the file with the setNodeValue command? EDIT As proposed, it might not be saved because it is just modified in memory. I added the following lines to my code: factory = javax.xml.transform.TransformerFactory.newInstance(); transformer = factory.newTransformer(); writer = java.io.StringWriter(); result = javax.xml.transform.stream.StreamResult(writer); source = javax.xml.transform.dom.DOMSource(doc); transformer.transform(source, result); I'm getting no errors, but the XML file is still not modified. Edit 2 import javax.xml.xpath.* import javax.xml.transform.* import javax.xml.transform.dom.*; import javax.xml.transform.stream.*; doc = xmlread(which('ImagingSensor.vpar')); factory = XPathFactory.newInstance(); xpath = factory.newXPath(); expr = xpath.compile('/data//parameter[@name=''FOV'']/double'); nodeList = expr.evaluate(doc,XPathConstants.NODESET); disp(char(nodeList.item(0).getFirstChild.getNodeValue)) nodeList.item(0).getFirstChild.setNodeValue('0.03') With nodeList.item(0).getFirstChild.setNodeValue('0.03') the value is correctly changed (but still not saved to file). When using nodeList.item(0).setNodeValue('0.03'), it didn't change the value correctly.
tagged with: http://stackoverflow.com/tag/xml
type: Question
tagged with: xpath
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4561734
answer count: 1
has answer: http://stackoverflow.com/a/25395595
tagged with: matlab
score: 0
has title: Modify an XML file with XPath in MATLAB

http://stackoverflow.com/q/25475055
tagged with: android
tagged with: java
tagged with: unsatisfiedlinkerror
accepted answer: http://stackoverflow.com/a/25566866
has comment: http://stackoverflow.com/comment/63692807
has comment: http://stackoverflow.com/comment/39822041
has comment: http://stackoverflow.com/comment/63650749
has comment: http://stackoverflow.com/comment/63678861
has body: I have an android project where I use native code to do stuff with SIP (using libosip2 and libeXosip2). My native code is compiled together with the libraries' sources into one module. The code compiles just fine and the generated library has all the symbols I expect it to have, but when I try to load the generated library I get the following error: E/eXosip.loadLibrary(9210): java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1307]: 1941 cannot locate 'srand'... My Application.mk looks like this: APP_STL := gnustl_shared APP_ABI := armeabi-v7a APP_CPPFLAGS += -fexceptions I did check for uncaught dependencies using ndk-depends, which gives me libeXosip_jni.so libstdc++.so liblog.so libgnustl_shared.so libm.so libdl.so libc.so Adding a loadLibrary("gnustl_shared") does not help (which is the only one of the mentioned libraries also found in "libs/armeabi-v7/"). My Android.mk: LOCAL_PATH := $(call my-dir) $(shell (cd $(LOCAL_PATH); sh extract_stuff.sh; cd $(OLDPWD))) include $(CLEAR_VARS) OSIP := libosip2-4.1.0 EXOSIP := libeXosip2-4.1.0 LOCAL_MODULE := eXosip LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(OSIP)/include \ $(LOCAL_PATH)/$(EXOSIP)/include LOCAL_SRC_FILES := $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/$(OSIP)/src/osipparser2/*.c)) \ $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/$(OSIP)/src/osip2/*.c)) \ $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/$(EXOSIP)/src/*.c)) LOCAL_CFLAGS += -DHAVE_FCNTL_H \ -DHAVE_SYS_TIME_H \ -DHAVE_STRUCT_TIMEVAL \ -DHAVE_SYS_SELECT_H \ -DHAVE_PTHREAD \ -DHAVE_SEMAPHORE_H \ -DENABLE_TRACE \ -DOSIP_MT include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := eXosip_jni LOCAL_STATIC_LIBRARIES := eXosip LOCAL_LDLIBS := -llog LOCAL_C_INCLUDES := BackendData.h \ $(LOCAL_PATH)/$(EXOSIP)/include \ $(LOCAL_PATH)/$(OSIP)/include LOCAL_SRC_FILES := eXosip.cpp \ eXosipCall.cpp include $(BUILD_SHARED_LIBRARY) C/C++ is not my fortitude, so if someone could enlighten me I'd be really gratef…
possible better answer: http://stackoverflow.com/a/26522110
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26522110
has answer: http://stackoverflow.com/a/32892327
has answer: http://stackoverflow.com/a/26152003
has comment: http://stackoverflow.com/comment/63690849
upvote count: 14
has answer: http://stackoverflow.com/a/36261999
has answer: http://stackoverflow.com/a/25492139
downvote count: 0
tagged with: sip
answer count: 7
has title: Android NDK: load_library: cannot locate srand
has comment: http://stackoverflow.com/comment/39786327
has answer: http://stackoverflow.com/a/25566866
tagged with: android-ndk
favorite count: 0
type: Question
score: 14
has comment: http://stackoverflow.com/comment/63687333
has answer: http://stackoverflow.com/a/38147478
has comment: http://stackoverflow.com/comment/63698053
has comment: http://stackoverflow.com/comment/39794206

http://stackoverflow.com/a/28871248
type: Answer
has body: I parsed the soap message by using SAX parser. import java.io.StringReader; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class ParseInBoundSoapMessage { private static InBoundSoapMessage inBoundSoapMessage=null; public static InBoundSoapMessage getInBoundSoapMessage(String xml) { try { inBoundSoapMessage=new InBoundSoapMessage(); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); SAXParser saxParser = factory.newSAXParser(); DefaultHandler handler = new DefaultHandler() { boolean ischargeBoxIdentityPresent = false; boolean isAddressPresent = false; boolean isFromPresent=false; boolean isActionPresent=false; boolean isMessageID=false; boolean isRelatesTo=false; public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (localName.equals("chargeBoxIdentity")) { ischargeBoxIdentityPresent = true; } if (localName.equals("From")) { isFromPresent = true; } if (localName.equals("Address")) { isAddressPresent = true; } if(localName.equals("Action")){ isActionPresent=true; } if(localName.equals("MessageID")){ isMessageID=true; } if(localName.equals("RelatesTo")){ isRelatesTo=true; } } public void characters(char ch[], int start, int length) throws SAXException { if (ischargeBoxIdentityPresent) { inBoundSoapMessage.setChargeBoxIdentity(new String(ch, start, length)); ischargeBoxIdentityPresent = false; } if(isAddressPresent &amp;&amp; isFromPresent){ inBoundSoapMessage.setAddressInFrom(new String(ch, start, length)); isAddressPresent = false; isFromPresent=false; } if(isActionPresent){ inBoundSoapMessage.setAction(new String(ch, start, length)); isActionPresent=false; } if(isMessageID){ inBoundSoapMessage.setMessageId(new String(ch, start, length)); isMessageID=false; } if(isRelatesTo){ inBoundSoapMess…
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25480233
answers question: http://stackoverflow.com/q/25480233

http://stackoverflow.com/comment/39673933
has text: This seems like it would have been the right thing to do. Thanks
comment on: http://stackoverflow.com/q/25430369
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25450901
tagged with: android
tagged with: overriding
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39713284
has body: I can't build my app because I've got this error: Error:(117, 5) error: method does not override or implement a method from a supertype. I'm trying to do a class that extends from AppWidgetProvider and I can't override onEnable method @Override public void onEnable(Context context) { Log.e(LOGTAG, "Se ha activado onEnable"); super.onEnabled(context); AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.add(Calendar.SECOND, 1); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 10000 , createClockTickIntent(context)); }
upvote count: 1
score: 1
tagged with: java
has title: Error: method onEnable does not override or implement a method from a supertype
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25451198
type: UnansweredQuestion

http://stackoverflow.com/a/25534146
has body: your problem is it is returning a url encoded string this is to avoid some issues with passing So what next try something like this String result = java.net.URLDecoder.decode(PrintWriter, "UTF-8"); tell me how it goes for you
has comment: http://stackoverflow.com/comment/39866461
score: 2
answers question: http://stackoverflow.com/q/25534041
has comment: http://stackoverflow.com/comment/39866379
upvote count: 2
has comment: http://stackoverflow.com/comment/39867008
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25534041
type: Answer

http://stackoverflow.com/a/25513465
score: 1
answers question: http://stackoverflow.com/q/25513428
type: Answer
has body: add this line android:layout_below="@+id/editText5" in here. &lt;Button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:fontFamily="sans-serif-light" android:background="?android:selectableItemBackground" android:text="Salva"/&gt;
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/25421054
score: 0
tagged with: eclipse-rap
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25421695
tagged with: eclipse-plugin
type: Question
has title: How to show other view from same view class?
has body: I need to open multiple view from a same view class with different data. For more detail. I have TreeViewer with six TreeParent. Now, when I select one parent my application will show a view and if I click other one that will not show anymore. Now I want show view for each tree item I clicked. Any suggestion? My current code: viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { // TODO Auto-generated method stub ITreeSelection iTreeSelection = (ITreeSelection) viewer .getSelection(); Object firstElement = iTreeSelection.getFirstElement(); try { IWorkbenchWindow iWorkbenchWindow = PlatformUI .getWorkbench().getActiveWorkbenchWindow(); View.setTree(firstElement); iWorkbenchWindow.getActivePage().showView(View.ID); } catch (Exception e) { // TODO: handle exception } } });`
has answer: http://stackoverflow.com/a/25421695
type: AnsweredQuestion

http://stackoverflow.com/q/25393514
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39605483
has comment: http://stackoverflow.com/comment/39605400
downvote count: 8
duplicate of: http://stackoverflow.com/q/157944
tagged with: arrays
has comment: http://stackoverflow.com/comment/39605458
tagged with: arraylist
has title: How to transfer class data from a Array to a ArrayList
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39605749
score: -5
has comment: http://stackoverflow.com/comment/39605410
has comment: http://stackoverflow.com/comment/39605418
has body: Let me introduce you to the components of my problem. A Array called cards that has been created in the main method. A class called Card that has 2 class variables, suit and number. A ArrayList called ph (stands for playerHand) in a public class called Hand and finally a static public variable called counter. So now let me explain my dilemma. In the main method the Array cards contains 52 card objects each with their own data. In the hand class I have a method called draw(). Here is some of the code inside the hand class. ArrayList&lt;Card&gt; ph = new ArrayList&lt;Card&gt;(); public static int cc = 0; void draw() { ph.add(new Card()); ph.get(cc).num = cards[cc].num; ph.get(cc).suit = cards[cc].suit; cc = cc + 1; } However I have the following error on the 2 lines before cc = cc + 1. "cards cannot be resolved to a variable" How do I transfer the data between the Array and the ArrayList? EDIT: This is different from the post this is marked as a duplicate of because here the array is in a different class so that solution wouldn't work.
has comment: http://stackoverflow.com/comment/39608637
upvote count: 3
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25393622
linked to: http://stackoverflow.com/q/157944
has answer: http://stackoverflow.com/a/25393622

http://stackoverflow.com/q/25502308
type: AnsweredQuestion
tagged with: list
downvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/25502439
has title: Sort objects in List by String (dd/mm/yyyy)?
tagged with: java
has comment: http://stackoverflow.com/comment/39807386
has comment: http://stackoverflow.com/comment/102858621
has comment: http://stackoverflow.com/comment/39808122
possible better answer: http://stackoverflow.com/a/25502513
tagged with: eclipse
has answer: http://stackoverflow.com/a/25502730
type: Question
upvote count: 0
accepted answer: http://stackoverflow.com/a/25502439
score: -3
has answer: http://stackoverflow.com/a/25502513
tagged with: string
tagged with: sorting
favorite count: 0
has body: Can someone help me with this? I can't find any example.. I've created a Java Class called Subtaks with multiple fields. And i'm trying to sort a list of Subtasks. Firt I'm sorting the list alphabetically with one field called status; but if this field is the same i'm trying to sort it by another String field that containt a date with this format: String resolutionDate = "18/09/2014" I've implemented this method to sort it: @Override public int compareTo(Subtask o) { if (this.status.equals(o.status)) return o.resolutiondate.compareTo(this.resolutiondate); else return this.status.compareTo(o.status); }

http://stackoverflow.com/comment/39722505
has text: Looks cool. I would try moving the character a bit towards the center of the circle so the end of the rope is where his hands would be and not in his head. I'd also try rotating the character so he's always perpendicular to the rope. If you want to go further you can play around with things like elasticity and having the rope bend.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25456447
type: QuestionComment

http://stackoverflow.com/comment/39786858
type: QuestionComment
has text: Using like `new RegisterUser().Register(user)`, and I have another annotation `@EnableAutoConfiguration` which would cover all these class, not very sure it's correct.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25491057

http://stackoverflow.com/a/27250874
answers question: http://stackoverflow.com/q/25447418
score: 0
has body: I had the same problem with glassfish 4.1 embedded. If you have a own library in your classpath. This lib has a java class that has annotation @Stateless. Then you get the exception. Try to put all your beans in your ejb-project. Example: common-project entity-project ejb-project web-project common-project is a normal java-project that contains: Utils.java @Stateless //&lt;- Here is the problem&lt;br&gt; class Utils {...}
type: Answer

http://stackoverflow.com/q/25456083
upvote count: 1
tagged with: collision
type: AnsweredQuestion
tagged with: physics-engine
score: 1
tagged with: java
answer count: 1
has title: Collision Detection Operations using a Vector3f in Java
has body: I want to start doing collision detection calculations in Java using my Vector3f Class. However, the assignment statement for centerDistance (see code below) gives off the error: The operator - is undefined for the argument type (Vector3f). I guess at my skill level, I just can't quite figure out what the issue is. Does anyone out there maybe have a clue? public class BoundingSphere { private Vector3f m_center; private float m_radius; public BoundingSphere(Vector3f center, float radius) { this.m_center = center; this.m_radius = radius; } public IntersectData IntersectBoundingSphere(BoundingSphere other) { float radiusDistance = m_radius + other.m_radius; float centerDistance = (other.getM_center() - m_center).length(); float distance = centerDistance - radiusDistance; return IntersectData(centerDistance &lt; radiusDistance, distance); } public Vector3f getM_center() { return m_center; } public void setM_center(Vector3f m_center) { this.m_center = m_center; } public float getM_radius() { return m_radius; } public void setM_radius(float m_radius) { this.m_radius = m_radius; } }
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25456198
has answer: http://stackoverflow.com/a/25456198
downvote count: 0

bitset
tags question: http://stackoverflow.com/q/25524888
type: Tag
tag name: bitset

http://stackoverflow.com/a/25545533
has body: Your problem is not related to your usage of primitive types, but your treatment of arrays. Fix your code by adding a copy of your current array and it will work properly: steps.add(Arrays.copyOf(current));
answers question: http://stackoverflow.com/q/25545473
type: Answer
type: AcceptedAnswer
downvote count: 0
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/25545473

http://stackoverflow.com/comment/39857378
score: 2
comment on: http://stackoverflow.com/q/25529487
type: Comment
type: QuestionComment
has text: Please try to post formatted code only. Please put a little more effort into your question, telling us more about where you're stuck, what your code does or does not do. A little effort will go a long way towards helping us help you.

http://stackoverflow.com/comment/39758625
comment on: http://stackoverflow.com/a/25475833
score: 0
has text: thanks for your response. ActivityName is referring to the ActivityName column in Parse and there seems to be information in it.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39873380
has text: Output returned from backend should be in JSON format not in text
score: 1
comment on: http://stackoverflow.com/q/25537634
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39636919
type: Comment
comment on: http://stackoverflow.com/q/25410379
score: 0
has text: Where is your `hibernate.cfg.xml` located?
type: QuestionComment

crash
tags question: http://stackoverflow.com/q/25456705
type: Tag
tag name: crash
tags question: http://stackoverflow.com/q/25447060
tags question: http://stackoverflow.com/q/25406681
tags question: http://stackoverflow.com/q/25515907
tags question: http://stackoverflow.com/q/25464147

http://stackoverflow.com/q/25499025
has answer: http://stackoverflow.com/a/25499211
type: AnsweredQuestion
score: 3
tagged with: rest
answer count: 3
upvote count: 3
has title: REST WebService and concurrency in java
accepted answer: http://stackoverflow.com/a/25503754
tagged with: java
has answer: http://stackoverflow.com/a/25503754
tagged with: concurrency
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25499205
has body: I'm going to write a simple REST webservice for downloading files from server( a simple GET method) The question is: Do I have to handle concurrency in this situation or the web server is going to do that?
downvote count: 0
tagged with: web-services
possible better answer: http://stackoverflow.com/a/25499211

http://stackoverflow.com/q/25538220
has comment: http://stackoverflow.com/comment/39873821
has comment: http://stackoverflow.com/comment/39873943
has title: Java regex - lost last letter
tagged with: regex
has comment: http://stackoverflow.com/comment/39873809
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25539283
accepted answer: http://stackoverflow.com/a/25539283
score: 0
has comment: http://stackoverflow.com/comment/39873924
has comment: http://stackoverflow.com/comment/39873950
tagged with: java
has comment: http://stackoverflow.com/comment/39873949
answer count: 1
has comment: http://stackoverflow.com/comment/39873984
has comment: http://stackoverflow.com/comment/39874279
upvote count: 1
downvote count: 1
has body: I have the following Pattern that works with all of my cases: Pattern.compile("((?:[A-Z](?:\\.|(?:(?:\\w|-)[A-Z]))+)\\s*){2,}"); The problem is that sometimes, the very last letter gets lost. The cases are: "By VERA RAMIREZ, MOLLIE RILER and GEORGE SHAW BROWN" "By LORA D. WOODARD test CEO and President" "By ANN-ROSE ABRAHAM, Credit.com" Anyone has an idea how to fix this?
favorite count: 0
type: Question

http://stackoverflow.com/comment/39664648
type: QuestionComment
comment on: http://stackoverflow.com/q/25425755
has text: You'd probably need to use two expressions, especially for finding comments spanning multiple lines, i.e. between `/*` and `*/`. Note that applying a regular expression to a non-regular domain (such as almost every language is) will always be an approximation only.
score: 0
type: Comment

if-statement
tags question: http://stackoverflow.com/q/25396091
tags question: http://stackoverflow.com/q/25537090
tags question: http://stackoverflow.com/q/25411193
tags question: http://stackoverflow.com/q/25478624
tag name: if-statement
type: Tag
tags question: http://stackoverflow.com/q/25459255
tags question: http://stackoverflow.com/q/25502025
tags question: http://stackoverflow.com/q/25505725
tags question: http://stackoverflow.com/q/25450071
tags question: http://stackoverflow.com/q/25470879
tags question: http://stackoverflow.com/q/25533622
tags question: http://stackoverflow.com/q/25534425
tags question: http://stackoverflow.com/q/25390281
tags question: http://stackoverflow.com/q/25414107
tags question: http://stackoverflow.com/q/25526734
tags question: http://stackoverflow.com/q/25445500

http://stackoverflow.com/a/25540169
has body: Found the error. The problem ended up being that I need to create a new scanner class.
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/25540068
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25540068

http://stackoverflow.com/q/25394572
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39608007
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39608501
tagged with: tomcat
has title: Tomcat Array Index out of bounds exception
score: 0
answer count: 0
has body: I am seeing the following error when I try to start tomcat. Seems like it runs okay with eclipse, but it doesn't run in Netbeans. I have tried setting maxHttpHeaderSize=8192 and maxPostSize="-1". But that didn't seem to help. I think my response body is the culprit here and not the header size. Is there a way to configure the size of the response body ? I am running Tomcat 6.0.41 on JDK 1.7 on Windows. I have Compared the server.xml files on Eclipse and Netbeans and there doesn't seem to be any obvious difference between them. Also, the JVM arguments are similar. I know I am probably being vague here, but I don't know where to start with debugging this issue. So, any help is appreciated. Aug 19, 2014 6:21:30 PM org.apache.coyote.http11.Http11AprProcessor process SEVERE: Error processing request java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.apache.coyote.http11.InternalAprOutputBuffer.write(InternalAprOutputBuffer.java:661) at org.apache.coyote.http11.InternalAprOutputBuffer.sendStatus(InternalAprOutputBuffer.java:427) at org.apache.coyote.http11.Http11AprProcessor.prepareResponse(Http11AprProcessor.java:1779) at org.apache.coyote.http11.Http11AprProcessor.action(Http11AprProcessor.java:1019) at org.apache.coyote.Response.action(Response.java:186) at org.apache.coyote.Response.sendHeaders(Response.java:382) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:314) at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:274) at org.apache.catalina.connector.Response.finishResponse(Response.java:493) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:317) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1774) at java.lang.Thread.run(Thread.java:745) Aug 19, 201…

http://stackoverflow.com/comment/39678050
score: 0
comment on: http://stackoverflow.com/q/25432610
has text: @TomG no my test object is an instance of TestImpl bean
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39713474
type: Comment
type: QuestionComment
has text: List .v. Set has little to do with JPA2. It is about what you need in your application. JPA2 handles both
score: 0
comment on: http://stackoverflow.com/q/25451250

http://stackoverflow.com/a/25446774
upvote count: 2
has body: Why You Are Getting Null The XML you are unmarshalling does not match the XML Schema that you generated the object model from. &lt;ns2:ID entry-method="manual"&gt; 123456789012345678 &lt;ns2:ID2&gt;123456789012345678&lt;/ns2:ID2&gt; &lt;/ns2:ID&gt; The Problem When an element has both text and element it is said to have mixed content. Your XML schema does not currently account for this. The Solution Change the definition of the complex type corresponding to the ID element to have mixed="true". Then regenerate your JAXB model. Why You Won't Like The Solution Since a type with mixed content scattered among the child elements you are going to get a very different JAXB model. Essentially the class for ID is going to have one List property that contains all the content. This is necessary to be able to find trip the XML.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25438381
type: Answer

http://stackoverflow.com/a/25440594
has comment: http://stackoverflow.com/comment/39692158
has body: Because the cast to int happens before the multiplication and as Math.random() generates a number between 0 (inclusive) and 1 (exclusive), it is rounded to 0.
has comment: http://stackoverflow.com/comment/39692207
type: Answer
answers question: http://stackoverflow.com/q/25440562
downvote count: 0
upvote count: 1
score: 1

http://stackoverflow.com/comment/39873163
has text: You should use the complete name of the class, which is `hello.hello`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25537857
score: 7

64-bit
tags question: http://stackoverflow.com/q/25396395
tag name: 64-bit
type: Tag

http://stackoverflow.com/q/25538918
tagged with: iso
type: Question
has body: Keep getting a ParseException when I try to parse a ISO 8601 formatted String into a Java Date type. String myDateString = "2014-07-04T22:59:36Z"; TimeZone timeZone = TimeZone.getTimeZone("UTC"); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'", Locale.US); dateFormat.setTimeZone(timeZone); Date formattedDate = dateFormat.parse(myDateString); Keeps returning a ParseException: Unparseable date: "2014-07-04T22:59:36Z" What am I possibly doing wrong?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/25539035
tagged with: date
answer count: 2
has comment: http://stackoverflow.com/comment/39875357
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/50208156
downvote count: 0
linked to: http://stackoverflow.com/q/31090946
has title: Receiving ParseException with String containing ISO 8601 Formatted Date using Java 1.6
has answer: http://stackoverflow.com/a/43083433
favorite count: 0
upvote count: 1

http://stackoverflow.com/q/25474108
has body: I'm writing an aplication for Android and I need to add "sleep time" period in my program. I don't know how to implement this. I have a sevice in my program and service must be switched off during certain periods of time (eg 22:00 - 7:00). Advise whether there is any ready solution for this kind of problem? I'm interested in is how to set this time period, thank you. Sorry for my English.
type: AnsweredQuestion
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25508477
has answer: http://stackoverflow.com/a/25474132
possible better answer: http://stackoverflow.com/a/25474132
has comment: http://stackoverflow.com/comment/39754961
type: Question
has title: How to add time period in Android program?
has comment: http://stackoverflow.com/comment/39819207
has answer: http://stackoverflow.com/a/25508477
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39755157

http://stackoverflow.com/comment/39825493
comment on: http://stackoverflow.com/a/25474798
has text: I'm going to agree java should be used first, but once you have understood the concepts, then you can get into using autoit with it.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25504123
has body: MVC pattern it is a common paradigm, so there is no differences between pragramming languages in general. However the implementation and some terminologies sometimes look different. In Java Swing it is often to see two following approaches: 1. Classic MVC Controller - Listens user interface actions, performs corresponding Model updates. Can listen actions from different Views. Model - Represents the state and the domain logic, methods to modify the state. Notifies listeners about the model updates (several Views can listen the updates). Model is independent and knows nothing about the listeners and their logic. View - Responsible for user interface, UI elements layout, also listens Model updates and update the graphic inteface if required. Has some knowledge about the model, in example shown below it knows how to process list of "items". Design of some simple "To Do" app can look like: 2. MVP (Model View Presenter) Controller acts as a Mediator between the View and the Model. View become very thin and knows nothing about the Model and interact with Controller only. Controller listens both View and Model and perform corresponding actions. Swing itself adds some confusion because it uses MVC pattern for its UI components. Each UI control has a Model and View. It makes easier to design new UI components, however in a "big picture" of the whole Application design - UI controls stay on the View layer.
answers question: http://stackoverflow.com/q/25502552
downvote count: 0
upvote count: 21
has comment: http://stackoverflow.com/comment/78789378
has comment: http://stackoverflow.com/comment/39908045
score: 21
type: Answer
has comment: http://stackoverflow.com/comment/78863722

http://stackoverflow.com/q/25505014
has answer: http://stackoverflow.com/a/25506738
type: AnsweredQuestion
score: 0
tagged with: android
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25506738
has body: I tried to load an TiledMap from the sdcard. In TmxMapLoader.java is says... * Loads the {@link TiledMap} from the given file. The file is resolved via the {@link FileHandleResolver} set in the * constructor of this class. By default it will resolve to an internal file. So, how can I change the default value to external? Thank you
has title: LibGdx TmxMapLoader load external files
tagged with: libgdx
answer count: 1

http://stackoverflow.com/comment/39764453
type: QuestionComment
has text: try `Interger.parseInt(ar.getrookic().trim()) == 66`
score: 0
comment on: http://stackoverflow.com/q/25479146
type: Comment

http://stackoverflow.com/a/25543347
has comment: http://stackoverflow.com/comment/56854915
type: Answer
has body: A good way to make software better testable (especially software that communicates to external stuff) is to use dependency injection. I love Guice and it is directly supported by camel. (all this stuff will burden you with learning about dependency injection but it will pay very soon i can assure you) In this scenario you would just inject "Endpoint"s. You pre-configure the endpoints like this (would be placed in "module"). @Provides @Named("FileEndpoint") private Endpoint fromFileEndpoint() { FileEndpoint fileEndpoint = getContext().getEndpoint("file:" + somFolder, FileEndpoint.class); fileEndpoint.setMove(".done"); fileEndpoint.setRecursive(true); fileEndpoint.setDoneFileName(FtpRoutes.DONE_FILE_NAME); ... return fileEndpoint; } Your RouteBuilder just inject the endpoint: @Inject private MyRoutes(@Named("FileEndpoint") final Endpoint fileEndpoint) { this.fileEndpoint = fileEndpoint; } @Override public void configure() throws Exception { from(fileEndpoint).... } To easily test such an route you inject another endpoint for test not FileEndpoint but "direct:something". A very easy way to do this is "Jukito", it combines Guice with Mockito. A test would look like this: @RunWith(JukitoRunner.class) public class OcsFtpTest extends CamelTestSupport { public static class TestModule extends JukitoModule { @Override protected void configureTest() { bind(CamelContext.class).to(DefaultCamelContext.class).in(TestSingleton.class); } @Provides @Named("FileEndpoint") private Endpoint testEndpoint() { DirectEndpoint fileEndpoint = getContext().getEndpoint("direct:a", DirectEndpoint.class); return fileEndpoint; } } @Inject private MyRoutes testObject; @Test .... } Now the "testObject" will get the direct endpoint instead of the file endpoint.This works with all kinds of Endpoints and generally with all Interfaces/ abstract classes and Apis that heavily rely on Interfaces (camel excels here!).
has comment: http://stackoverflow.com/comment/56854646
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25463356
score: 1

http://stackoverflow.com/comment/39762096
score: 0
type: QuestionComment
has text: what have you got so far?
type: Comment
comment on: http://stackoverflow.com/q/25473306

http://stackoverflow.com/a/40414103
has body: If Calculator run first, and waiting in doInBackground(). I think that your NotationChanger can not enter doInBackground(). In my experience, all AsyncTask use only one thread to work.
score: 0
answers question: http://stackoverflow.com/q/25431743
type: Answer

http://stackoverflow.com/a/25529322
has body: If you are using a ListFragment, you can do something like this: @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mListView = getListView(); SetClicklListener(mListView); } public void SetClicklListener(ListView listView){ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { //Here you can catch the clicked item } }); }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25528769

http://stackoverflow.com/a/59993790
downvote count: 0
upvote count: 1
score: 1
has body: https://stackoverflow.com/a/59993761/5016494 This may help @DataProvider public Object[][] combinedDataProvider() { return Stream.of(dp1(), dp2()) .flatMap(Arrays::stream) .toArray(Object[][]::new); }
type: Answer
answers question: http://stackoverflow.com/q/25549443

http://stackoverflow.com/comment/39798614
type: Comment
has text: @RyanRamsden Personally, I don't think it's a threading issue as the `Canvas` solution basically throws that out the window (piping the update directly to the hardware). One thing you might try (for ALL the examples) is adding `Toolkit.getDefaultToolkit().sync();` after you've updated the screen buffer...
type: QuestionComment
comment on: http://stackoverflow.com/q/25496911
score: 0

http://stackoverflow.com/comment/39859987
type: QuestionComment
score: 0
has text: That'S what javadoc is for. I think using ambigous names is, when in doubt, better than trying to use unambigous ones that get so complicated nobody gets them anymore at all. I mean, once you read the javadoc, I guess you can remember what the method does fopr the rest of the time.
comment on: http://stackoverflow.com/q/25526220
type: Comment

http://stackoverflow.com/comment/39609642
has text: which methods have you found so far, and where is the code to show you've already started working on solving this problem before asking your question on stackoverflow?
comment on: http://stackoverflow.com/q/25395797
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/25503833
has body: I am writing a program with a series of different interfaces. Each interface is stored in a seperate class extending JPanel, and to swap between interfaces I set the content pane of a JFrame to the required JPanel. So my question is: where is the best place to declare the JFrame? Should it be in a completely seperate class? Should it be be in the class containing the first interface to be loaded? Should I create a new class extending JFrame? Is there some convention which I should be following? It seems a little excessive to pass the JFrame as an argument to each panel. Thanks in advance.
has answer: http://stackoverflow.com/a/25504944
tagged with: java
has title: Best place to declare JFrame variable
answer count: 1
has comment: http://stackoverflow.com/comment/39810619
type: Question
tagged with: jframe
tagged with: jpanel
tagged with: swing
has comment: http://stackoverflow.com/comment/39812421
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25504944
has comment: http://stackoverflow.com/comment/39810165

http://stackoverflow.com/comment/39812189
type: Comment
type: QuestionComment
has text: how will i convert it into json format
score: 0
comment on: http://stackoverflow.com/q/25504999

http://stackoverflow.com/comment/39659703
type: AnswerComment
has text: You can also put the "bottom" code in an `else` block or throw a `ServletException`.
comment on: http://stackoverflow.com/a/25421803
type: Comment
score: 0

http://stackoverflow.com/comment/39702134
has text: Concatenating `String` in a loop? Why?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25446189
type: Comment

http://stackoverflow.com/comment/39737137
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25462503
type: AnswerComment
has text: Can you try a telnet on the port 3306 and the ip 10.6.12.247 from your client? That is 'telnet 10.6.12.247 3306' and please check your firewall configuration?

http://stackoverflow.com/comment/39802736
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25499373
has text: @Divya I thought problem is in your server only. Is your domain is perfectly fine: example.com?
type: Comment

http://stackoverflow.com/q/25497599
upvote count: 2
type: UnansweredQuestion
tagged with: java-native-interface
downvote count: 0
has title: Fatal error when using jni
has body: I'm trying to use jni to call java methods from c++. actually more of a callback (java -> c++ -> java) I've checked the c++ program for errors by testing it in .exe (c++ -> java) The program works perfect in visual studio. but fails and crashes when I convert it to dll and use it in java. I think it's related to jvm.dll because I had to include it to my visual studio project. c++: #include &lt;stdio.h&gt; #include &lt;jni.h&gt; #include &lt;string.h&gt; #include "Inter.h" JNIEnv* create_vm(JavaVM ** jvm) { JNIEnv *env; JavaVMInitArgs vm_args; JavaVMOption options; options.optionString = "-Djava.class.path=C:\\Users\\SolidSnake\\workspace\\Test\\bin"; //Path to the java source code vm_args.version = JNI_VERSION_1_8; vm_args.nOptions = 1; vm_args.options = &amp;options; vm_args.ignoreUnrecognized = 0; int ret = JNI_CreateJavaVM(jvm, (void**)&amp;env, &amp;vm_args); if(ret &lt; 0) printf("\nUnable to Launch JVM\n"); return env; } void callMethod() { JNIEnv *env; JavaVM * jvm; env = create_vm(&amp;jvm); jclass m; jmethodID test; m = env-&gt;FindClass("Main"); test = env-&gt;GetStaticMethodID(m,"callbackFromC","()V"); env-&gt;CallStaticVoidMethod(m,test); } java: public final class Main { public native int callToC(); public static void callbackFromC() { System.out.println("Hello from C!"); } public static void main(String[] args) { System.loadLibrary("Test"); new Main().callToC(); } } crash: # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007f9aed32ff8, pid=4016, tid=8228 # # JRE version: Java(TM) SE Runtime Environment (8.0_11-b12) (build 1.8.0_11-b12) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.11-b03 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [Test.dll+0x1a08] JNIEnv_::FindClass+0x28 # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows Here's how the program goes (j:callToC) -> (c:callMethod) -> (j:callbackFromC)
tagged with: c++
score: 2
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/26522377
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/39800520
type: Question
has comment: http://stackoverflow.com/comment/39799077

http://stackoverflow.com/a/25466342
has comment: http://stackoverflow.com/comment/39767633
has comment: http://stackoverflow.com/comment/39755656
has comment: http://stackoverflow.com/comment/39752021
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25464336
has body: This is where Sockets get complicated. They work fine on a closed network, but once they get separated by a Network Address Translator (router) you need to look for other methods. Routers block all incoming traffic/connections unless the router is specifically port-fowarded or the incoming traffic is an answer to it's own request (e.g getting a webpage) In order to allow your router to accept the connection you need to configure it to do so. The alternative is to use a method called "hole-punching". This is a technique used by software like Skype. The technique varies, and is largely unofficial, but the general concept behind it is: Computer A want's to access Computer B Computer A and Computer B are unaware of each other's location, but both know of an official super node. The super node holds a list of all connected users. Once Computer A and Computer B retrieves each others location from the super node. Computer A sends request to computer B, creating a hole in it's router where it's awaiting a response. Computer B doesn't get the request, it's own router blocks the request, but it knows Computer A wants to access it by talking to the super node. Computer B sends a new packet of data back to Computer A through the hole in the router, making it think that it's received it's response. Computer B now has a hole, and the connection is reversed to make it 2 way. Both computers are now connected. Hole-punching is one of the only ways to connect to clients together, although it does require a third "super node". Hole-punching is an unofficial solution, and unfortunately flawed. Not all routers support hole-punching, meaning there is no concrete way to connect clients. There is another option, using a STUN or ICE server. There is very little documentation online, but I understand that it works as a relay to connect of the two clients. I myself have posted a question about STUN servers and clients. There is a long going fight between security and connectivity, and until i…
has comment: http://stackoverflow.com/comment/39751909
has comment: http://stackoverflow.com/comment/39755829
has comment: http://stackoverflow.com/comment/39751930

http://stackoverflow.com/comment/39794302
has text: @komali_2: please see the link I provided in my answer above.
type: Comment
comment on: http://stackoverflow.com/a/25494874
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39707086
comment on: http://stackoverflow.com/q/25448587
score: 1
has text: Then make it throw an exception when it faces a severe IO failure.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25520742
type: Answer
score: 5
downvote count: 0
has body: Without seeing the code for the service, you are checking if SinchClient is started as soon as your service starts (onServiceConnected). Chances are that the SinchClient does not have time to start properly in the short time span between the service is launched and your activity connects to the service. I would suggest that you add an interface to the service, which exposes something like onSinchClientStarted that is called when the SinchClient in your service has actually started (and you got the onClientStarted callback in the service).
answers question: http://stackoverflow.com/q/25517408
has comment: http://stackoverflow.com/comment/39845059
upvote count: 5

http://stackoverflow.com/a/25440583
has body: RuntimeExceptions don't have to be declared in the method signature, and if you want to remove the try/catch blocks as well - you can do it: @Transactional(readOnly = false) @Override public String save(StagingDocument stagingData) { String enrichObjectId = null; EnrichDocument document = getEnrichDocument(stagingData); EnrichDocument enrichPayload = enrichStagingDocumentRepository .save(document); enrichObjectId = enrichPayload.getId().toString(); return enrichObjectId; } When there's no try/catch - the exception doesn't get "handled" it is rather getting cascaded until either a higher level handles it or until the highest level exists the program (with the RuntimeException).
answers question: http://stackoverflow.com/q/25440498
score: 0
type: Answer

http://stackoverflow.com/a/25405729
downvote count: 0
has body: Unless you have a strong reason to do so do not use new when you want Spring to wire beans to an object. And avoid tying domain classes to Spring. IMHO, you'd better use a custom builder bean : public class ABuilder { @Autowired private MyService myService; public A getA(String param1, String param2) { A a = new A(param1, param2); a.setMyDTO(myService.getConfiguration()); a.setMailhost(myDTO.getMailhost()); return a; } } and modify ServiceOne accordingly : //-------------------ServiceOne-------------- @Autowired ABuilder aBuilder; @Service("serviceOne") public class ServiceOneImpl implements ServiceOne { @Override public void myMethod() { ClassA obj = aBuilder.getA(arg1, arg2); obj.doSometing(); } } That way,A (or MyClass or ClassA) can have no explicit dependancies on Spring and will be injected with other beans through its builder. Of course, that is not real code (incoherences in parameters and naming), but yours was not either ...
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39629390
type: Answer
answers question: http://stackoverflow.com/q/25402441

http://stackoverflow.com/a/25491674
answers question: http://stackoverflow.com/q/25491556
type: Answer
score: 0
has body: Actually, all you should need to do now is add JQuery to your webpage, and use JQUery.get. Once you get the html from the servlet, use jquery or javascript to set the text in your tab. BTW, you might want to set other details on the servlet output stream, like file type, length etc. Just a thought

http://stackoverflow.com/q/25447528
type: Question
has answer: http://stackoverflow.com/a/25447699
answer count: 2
has comment: http://stackoverflow.com/comment/39706407
has comment: http://stackoverflow.com/comment/39709237
has comment: http://stackoverflow.com/comment/39705333
has body: I am starting fresh with android and not able to figure out how to get an http json response back in a Fragment. In my activity I am easily able to do so using callback function but it seems difficult to accomplish the same in Fragment. Any help would really appreciated. //SaleFragment.java public class SaleFragment extends Fragment{ public static final String ARG_CLIENT_NUMBER = "client_number"; private ListView salesListView; private View rootView; public SaleFragment() { // Empty constructor required for fragment subclasses } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_sale, container, false); int i = getArguments().getInt(ARG_CLIENT_NUMBER); try{ SaleStackJSON sale_json = new SaleStackJSON(); sale_json.execute("http://test.url/getJson"); //url to retrieve json // do processing on the result (I do not know how to retrieve them here after the request) }catch(Exception e){ // resultView.setText(e.getMessage()); } return rootView; } My JSON class is as follows: // SaleStackJSON.java public class SaleStackJSON extends AsyncTask&lt;String, Void, String&gt;{ InputStream is = null; String result = ""; JSONArray jArray = null; String error_text=""; JSONObject j = null; TextView resultView; @Override protected String doInBackground(String... urls) { // Download JSON data from URL try { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(urls[0]); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { Log.e("log_tag", "Error in http connection " + e.toString()); } try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); setResult(sb.toString()); // this.jArray = new JSON…
possible better answer: http://stackoverflow.com/a/25447699
has comment: http://stackoverflow.com/comment/39705582
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25448214
has comment: http://stackoverflow.com/comment/39705208
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25448214
has title: Get Async task result in a callback in an Fragment
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39706051

http://stackoverflow.com/comment/39632070
comment on: http://stackoverflow.com/a/25407911
score: 0
has text: Finding the shortest `S-*-*-*-D` requires exploring all possible solutions. With up to 15 Gs there are up to 1307674368000 alternatives.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39802752
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25499239
score: 0
has text: so use the correct Matrix then

http://stackoverflow.com/q/25428936
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39670856
has title: Eclipse Template Default Value with Dot
tagged with: eclipse
tagged with: eclipse-templates
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39671464
has comment: http://stackoverflow.com/comment/39671332
type: UnansweredQuestion
has body: I want to have a default value in a String with a dot. I can't save my template when I put in the dot, though. Is it possible to get the dot into the string? System.out.println("${related.string}"); So I want to have related.string as one string, which means when I get in with the cursor it should behave as one, so if I type something, it should vanish all. I get the error: Template has incomplete variables. Type '$$' to enter the dollar character. in the UI.
score: 4
upvote count: 4
answer count: 0

http://stackoverflow.com/a/25516011
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25515860
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25515860
type: Answer
score: 2
has body: The crux of this question has nothing to do with reflection, but rather covariance/contravariance. It's effectively: Why can't I assign a Set&lt;? extends Something&gt; to a Set&lt;?&gt;? And the answer is that if you had a Set&lt;?&gt; then the compiler would let you add an object of any type (say X) to that set, and someone trying to retrieve that value from the original Set&lt;? extends Something&gt; would get a runtime error when it turned out that your X does not extend Something. The principle can be demonstrated even more simply like this: Set&lt;Dog&gt; dogs = getDogs(); Set&lt;Pet&gt; pets = dogs; // the compiler will complain here pets.add(new Cat("Fluffy")); // to avoid letting this happen for(Dog dog : dogs) // which would cause an exception here { ... } Since you (presumably) know that you're not planning to add anything to this set, however, it's probably safe to tell the compiler you know what you're doing through a little explicit casting: Set&lt;Class&lt;?&gt;&gt; implTypes= (Set&lt;Class&lt;?&gt;&gt;)(Set&lt;?&gt;)reflections.getSubTypesOf(type);
upvote count: 2

http://stackoverflow.com/q/25513446
favorite count: 0
has body: I have been using Volley as my solution to download, cache, and display images on Android with the NetworkImageView. So far, everything this has worked quite well. However, on this particular project I need to retrieve images behind HTTPS. I have researched and tried to do this on my own for a few days but the information I have come upon has been quite confusing and I am in dire need of clarification. I have been using the following thread to try and implement this. Volley NetworkImageView using https However the answer there isn't well explained and I don't quite understand the concept at play. I am looking for is an explanation of What I need to extra to load images from behind HTTPs using Volley and Why.
type: Question
has comment: http://stackoverflow.com/comment/39828895
linked to: http://stackoverflow.com/q/23133465
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39828816
has title: Loading HTTPS images in Android using Volley
type: UnansweredQuestion
tagged with: https
has comment: http://stackoverflow.com/comment/39828548
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/39829919
downvote count: 0
tagged with: httpclient
answer count: 0

http://stackoverflow.com/q/25404502
tagged with: java
has title: XJC error while processing NIEM 3.0 schemas
tagged with: jaxb
tagged with: xsd
type: Question
duplicate of: http://stackoverflow.com/q/13610217
has body: XJC error while processing NIEM 3.0 schemas I am running a xjc.exe specifying the NIEM schema folder. It have a number of xsds and some conflict is happening. parsing a schema... [ERROR] 'href' is already defined line 16 of file:/C:/Users/xxxx/xx/Projects/xxxx/NIEM/niem/external/have/1.0/xlinks.xsd [ERROR] (related to above error) the first definition appears here line 14 of file:/C:/Users/xxxx/xx/Projects/xxxx/niem/external/ogc/xlink/1.0.0/xlinks.xsd
answer count: 0
type: UnansweredQuestion
score: 1
downvote count: 0
tagged with: xsd-validation
upvote count: 1
favorite count: 0
tagged with: xjc

http://stackoverflow.com/q/25406294
has comment: http://stackoverflow.com/comment/39628995
has comment: http://stackoverflow.com/comment/39632510
has comment: http://stackoverflow.com/comment/39705429
score: 3
upvote count: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39640182
has title: Can't disable IntelliJ Inspector "Unused declaration" inspection type
has comment: http://stackoverflow.com/comment/43935492
has comment: http://stackoverflow.com/comment/39631821
has body: I'm running IntelliJ IDEA 13.1.4 Ultimate under the 30 day trial. I have many many public methods in classes that aren't presently being called and I don't want the "unused declaration" to be searched for during inspections. I've disabled it by unchecking it in the inspections preferences and re-run the inspector, but it still finds these problems. I've re-enabled it and re-disabled it and re-run the inspector mandy times. I've tried restarting intellij too. Is there another setting I need to switch off to disable these, or is this a bug? Can anybody else turn this off with this version?
favorite count: 0
type: Question
answer count: 0
type: UnansweredQuestion
tagged with: intellij-idea

http://stackoverflow.com/comment/39745269
type: AnswerComment
comment on: http://stackoverflow.com/a/25468855
has text: I rubbed your back :)
type: Comment
score: 0

http://stackoverflow.com/comment/39786053
type: AnswerComment
score: 0
type: Comment
has text: @Aleksander well enter the url manually and check what's the output in the browser. It seems it's either showing you an error or there's some html code that can't be parsed by JSON (namely ).
comment on: http://stackoverflow.com/a/25490383

http://stackoverflow.com/comment/39627558
comment on: http://stackoverflow.com/q/25405449
has text: @user3363969 - No, the thread will *Terminate* when *run* completes.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39812935
type: AnswerComment
has text: Thanks :D I just wrote a test application that reads from the command line and outputs it. It uses 13 threads that are spawned by Java.
score: 0
comment on: http://stackoverflow.com/a/25503180
type: Comment

http://stackoverflow.com/comment/39786170
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25490766
type: Comment
has text: Lol yea sorry about that I'll fix my code.

http://stackoverflow.com/a/25421241
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39656582
downvote count: 0
upvote count: 1
has body: There is nothing wrong. Your document is not null: it is printed as: [#document: null] If it would be null, this would be printed: null By the way, why don't you load properties via Properties.loadFromXML()? Properties p = new Properties(); try (InputStream in = BACENGPropertiesFile.class.getResourceAsStream(filename)) { p.loadFromXML(in); }
has comment: http://stackoverflow.com/comment/39660515
has comment: http://stackoverflow.com/comment/39656670
accepted answer of: http://stackoverflow.com/q/25421095
type: Answer
answers question: http://stackoverflow.com/q/25421095

http://stackoverflow.com/q/25422155
has answer: http://stackoverflow.com/a/25422960
has title: infinite while loop using bufferedreader
has comment: http://stackoverflow.com/comment/39658397
has comment: http://stackoverflow.com/comment/39687522
type: Question
has comment: http://stackoverflow.com/comment/39692379
type: AnsweredQuestion
tagged with: android
tagged with: java
answer count: 3
possible better answer: http://stackoverflow.com/a/25422334
linked to: http://stackoverflow.com/q/3359692
downvote count: 1
has answer: http://stackoverflow.com/a/25422334
score: -1
has comment: http://stackoverflow.com/comment/39659392
favorite count: 0
linked to: http://stackoverflow.com/q/804951
has body: I am having a code to store the log files to a SD card in android. The following is the code. process = Runtime.getRuntime().exec("logcat "+ LOG_TAG +":D *:S"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream())); StringBuilder log = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { //do something over here } It is running an infinite loop. Any help.
upvote count: 0
accepted answer: http://stackoverflow.com/a/25424718
has comment: http://stackoverflow.com/comment/39660346
has comment: http://stackoverflow.com/comment/39660377
has comment: http://stackoverflow.com/comment/39662731
has answer: http://stackoverflow.com/a/25424718

http://stackoverflow.com/q/25520385
favorite count: 0
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/39841079
has title: Difference in C# and Java in accessing static variables and methods
has comment: http://stackoverflow.com/comment/39841987
accepted answer: http://stackoverflow.com/a/25520470
has comment: http://stackoverflow.com/comment/39841161
has comment: http://stackoverflow.com/comment/39841095
has comment: http://stackoverflow.com/comment/39841209
tagged with: static-members
possible better answer: http://stackoverflow.com/a/25520504
has comment: http://stackoverflow.com/comment/39841358
type: AnsweredQuestion
has body: In Java, static methods and variables can be accessed through object reference, like in the program below, which is working absolutely fine: //StaticDemo.java class StaticVerifier{ private int a,b; public StaticVerifier(int a,int b){ this.a = a; this.b = b; System.out.println("Values are "+this.a+" "+this.b); } public static void takeAway(){ System.out.println("This is a static method..."); } } public class StaticDemo{ public static void main(String[] args){ StaticVerifier sv = new StaticVerifier(3,4); sv.takeAway(); } } But when I tried the same code converted in C# its not allowing the object to access the static method and giving compile time error. See the code and associated error below: //StaticDemo.cs using System; public class StaticVerifier{ private int a,b; public StaticVerifier(int a,int b){ this.a = a; this.b = b; Console.WriteLine("Values are "+this.a+" "+this.b); } public static void takeAway(){ Console.WriteLine("This is a static method..."); } } public class StaticDemo{ public static void Main(string[] args){ StaticVerifier sv = new StaticVerifier(3,4); sv.takeAway(); // here, unable to access static methods, but can use classname rather than objectname ! } } Errors: StaticDemo.cs(17,3): error CS0176: Member 'StaticVerifier.takeAway()' cannot be accessed with an instance reference; qualify it with a type name instead StaticDemo.cs(10,21): (Location of symbol related to previous error) Can anybody tell me why C# don't have this accessibility and Java has, though both are based on object oriented paradigm?(I mostly mean "why the vendors had made it so?")
linked to: http://stackoverflow.com/q/610458
answer count: 3
has answer: http://stackoverflow.com/a/25520504
has answer: http://stackoverflow.com/a/25520463
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39842044
downvote count: 0
has answer: http://stackoverflow.com/a/25520470

http://stackoverflow.com/q/25457423
has comment: http://stackoverflow.com/comment/39724218
has title: Access Variable via Bytecode
has comment: http://stackoverflow.com/comment/39725349
has comment: http://stackoverflow.com/comment/39724256
type: Question
has comment: http://stackoverflow.com/comment/39724290
has comment: http://stackoverflow.com/comment/39724226
has comment: http://stackoverflow.com/comment/39724238
has comment: http://stackoverflow.com/comment/39724344
tagged with: bytecode
has comment: http://stackoverflow.com/comment/39724337
has comment: http://stackoverflow.com/comment/39724557
has body: I need to access a variable in bytecode. I have figured out how to do this with local variables (using ILOAD), but I can't seem to get it to work with values that are outside of the method I am working in. Is there an Opcode that loads a variable inside of a class but outide of a method? This works when the variable is inside of the method: if (currentNode.getOpcode() == RETURN) { InsnList toInject = new InsnList(); toInject.add(new TypeInsnNode(NEW, "timeTraveler/mechanics/LivingPlaceBlockEvent")); toInject.add(new InsnNode(DUP)); toInject.add(new VarInsnNode(ALOAD, 5)); toInject.add(new VarInsnNode(ALOAD, 6)); toInject.add(new VarInsnNode(ILOAD, 2)); toInject.add(new VarInsnNode(ILOAD, 3)); toInject.add(new VarInsnNode(ILOAD, 4)); toInject.add(new MethodInsnNode(INVOKESPECIAL, "timeTraveler/mechanics/LivingPlaceBlockEvent", "&lt;init&gt;", "(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;III)V")); toInject.add(new VarInsnNode(ASTORE, 7)); toInject.add(new FieldInsnNode(GETSTATIC, "net/minecraftforge/common/MinecraftForge", "EVENT_BUS", "Lnet/minecraftforge/event/EventBus;")); toInject.add(new VarInsnNode(ALOAD, 7)); toInject.add(new MethodInsnNode(INVOKEVIRTUAL, "net/minecraftforge/event/EventBus", "post", "(Lnet/minecraftforge/event/Event;)Z")); toInject.add(new InsnNode(POP)); m.instructions.insertBefore(currentNode, toInject); }
has comment: http://stackoverflow.com/comment/39724283
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25457624
accepted answer: http://stackoverflow.com/a/25457624
tagged with: java
answer count: 1

http://stackoverflow.com/a/25532492
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25531640
has comment: http://stackoverflow.com/comment/39863767
type: Answer
answers question: http://stackoverflow.com/q/25531640
has body: You can write a Chrome App, which can access UDP and other networking APIs (datagrams). Unfortunately, a URL-based web app cannot access UDP. As mentioned in another answer, the browser can do HTTP(S), Web Sockets, and WebRTC data channels.

http://stackoverflow.com/comment/39742443
comment on: http://stackoverflow.com/q/25466586
type: Comment
type: QuestionComment
score: 0
has text: byte[] imageBytes = ((DataBufferByte) image.getData().getDataBuffer()).getData(); Just tried that, it didn't work.

http://stackoverflow.com/comment/39812770
score: 0
comment on: http://stackoverflow.com/a/25505127
type: Comment
type: AnswerComment
has text: then do upvote and accept my answer, it will encourage me to give more answers to the needy :)

http://stackoverflow.com/comment/39667740
score: 0
type: AnswerComment
has text: yeah, I just had to add the execution word in the point cut. I agree on the package thing, didn't mean to say about the package.
type: Comment
comment on: http://stackoverflow.com/a/25423508

http://stackoverflow.com/comment/39854156
comment on: http://stackoverflow.com/q/25527463
has text: You are not creating an EntityManager you are creating an EntityManagerFACTORY, very big diference betwen these 2. Can you provide the code to see where you are making your entity manager factory?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39802650
has text: @Divya Then there may be some configuration issue, as per my thought its the problem in server side. Have you declared Internet permission in manifest file?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25499253
type: Comment

http://stackoverflow.com/q/25547163
score: 1
upvote count: 1
has title: Heap space in android application
favorite count: 0
has body: I have an application which uses a SurfaceView to draw an animation as fast as possible. It is almost perfect except that, from time to time, the animation freezes for a short period of time. This short time lasts approximately 10 ms, which it is not so much, but is large enough to be noticeable by the user. I have seen that these freezes are caused by changes in the heap space, which are triggered by the garbage collector. Adding the android:largeHeap="true" in my application's manifest hasn't solved the problem. Does anyone know how I could get rid of this annoying problem?
tagged with: heap-memory
type: Question
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/25548127
possible better answer: http://stackoverflow.com/a/25547219
has answer: http://stackoverflow.com/a/25547219
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25548127
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/39859933
type: Comment
has text: I have always wondered why language designers choose the leading zero to represent octal system. It's awfully confusing.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25530721

http://stackoverflow.com/q/25435207
has body: I am trying to build a program in java which uses Apache Commons CLI and I have gotten this error - it was working well until now. Does it mean Apache repository is down? If so, what is the best way to resolve this issue? Could not resolve all dependencies for configuration ':compile'. Could not resolve commons-cli:commons-cli:1.3-SNAPSHOT. Required by: :dpg-variant-store:0.1 Unable to load Maven meta-data from https://repository.apache.org/content/groups/snapshots/commons-cli/commons-cli/1.3-SNAPSHOT/maven-metadata.xml. Could not GET 'https://repository.apache.org/content/groups/snapshots/commons-cli/commons-cli/1.3-SNAPSHOT/maven-metadata.xml'. Received status code 503 from server: Service Temporarily Unavailable
accepted answer: http://stackoverflow.com/a/25435563
favorite count: 0
tagged with: apache-commons-cli
type: Question
has answer: http://stackoverflow.com/a/25435563
linked to: http://stackoverflow.com/q/25431856
has title: Apache repository down?
has comment: http://stackoverflow.com/comment/39683324
type: AnsweredQuestion
score: 0
upvote count: 2
tagged with: java
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/39683121
tagged with: gradle

http://stackoverflow.com/q/25457973
upvote count: 0
has comment: http://stackoverflow.com/comment/39725784
answer count: 2
type: UnansweredQuestion
has body: I have been browsing about this I am not finding the answer that suits my problem. But i would like on execute onPostExecute but it never gets called. I send in a timestamp, unixtime, to the server and I get a list in return (ArrayList). Then I want to work with that list in onPostExecute. I do get the list though. I send in Long I want to work with that list, I think. I want to return that list Thats why I do 'Long, ArrayList, ArrayList' Could use a little help, thanks! private class getMealsByDayConnection extends AsyncTask&lt;Long, ArrayList&lt;CalanderMeal&gt;, ArrayList&lt;CalanderMeal&gt;&gt; { protected ArrayList&lt;CalanderMeal&gt; doInBackground(Long... params) { CalendarService service = CalendarServiceFactory.getCalanderService(); try { return service.getMealsByDay(params[0]); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(ArrayList&lt;CalanderMeal&gt; result){ CalendarAdapter adapter = null; adapter.notifyDataSetChanged(); } }
downvote count: 1
has comment: http://stackoverflow.com/comment/39725302
has title: Android: AsyncTask - onPostExecute never gets called
favorite count: 0
has comment: http://stackoverflow.com/comment/39725773
tagged with: arraylist
has comment: http://stackoverflow.com/comment/39725360
has answer: http://stackoverflow.com/a/25458057
tagged with: android
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/39726823
has comment: http://stackoverflow.com/comment/39725489
has answer: http://stackoverflow.com/a/25458761
has comment: http://stackoverflow.com/comment/39725336
tagged with: android-asynctask
type: Question

http://stackoverflow.com/comment/39837535
type: QuestionComment
has text: Right. I see your point. My apologies and I will remove all my confusing comments.
score: 0
comment on: http://stackoverflow.com/q/25517868
type: Comment

http://stackoverflow.com/comment/39880070
type: QuestionComment
comment on: http://stackoverflow.com/q/25529120
score: 0
type: Comment
has text: @HuStmpHrrr- I am creating .so from C++ code and then I am trying to access function from it using Java Native Access(In java application).

http://stackoverflow.com/comment/39689806
score: 0
type: Comment
type: AnswerComment
has text: @Benji I get lots of good links when I google ARR IIS tomcat. For example, [How to configre ARR as reverse proxy for tomcat?](http://forums.iis.net/t/1154978.aspx?How+to+configre+ARR+as+reverse+proxy+for+tomcat+). It's a really easy UI and includes some advanced [rewriting capability](http://forums.iis.net/t/1169769.aspx) (matching hostnames is a trivial rule to define).
comment on: http://stackoverflow.com/a/25417827

http://stackoverflow.com/comment/39670645
has text: Remove this line and check `android:layout_weight="1"` its working fine if you use `LinearLayout`
score: 0
comment on: http://stackoverflow.com/q/25428877
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39689713
type: Comment
comment on: http://stackoverflow.com/a/25439021
type: AnswerComment
has text: I would like to +1 your answer for the bit about `Integer.compare` being dangerous, and in fact incorrect. But I am unable to do so, as I had already +1ed your answer before you added this part.
score: 1

http://stackoverflow.com/a/25472771
has body: You are using Apache Commons DBCP, which has a transitive dependency on Apache Commons Pool. You have a mismatch between the version of Commons Pool your DBCP dependency needs, and the actual version of Commons Pool on your classpath. Alternatively, you have two versions of Commons Pool on the classpath, the right one occurring later. If you are using Maven to build your project, then run mvn dependency:tree to diagnose the source of your problem.
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25472744

http://stackoverflow.com/a/25548634
has comment: http://stackoverflow.com/comment/39909933
has comment: http://stackoverflow.com/comment/39911266
score: 1
has comment: http://stackoverflow.com/comment/39905522
has body: You can use this answer to obtain a list of your entity classes: List&lt;ClassLoader&gt; classLoadersList = new LinkedList&lt;ClassLoader&gt;(); classLoadersList.add(ClasspathHelper.contextClassLoader()); classLoadersList.add(ClasspathHelper.staticClassLoader()); reflections = new Reflections( new ConfigurationBuilder() .setScanners(new SubTypesScanner(false), new ResourcesScanner()) .setUrls( ClasspathHelper.forClassLoader(classLoadersList .toArray(new ClassLoader[0]))) .filterInputsBy( new FilterBuilder().include(FilterBuilder .prefix("me.business.model")))); And get your DDL with: ClassPathResource cpr = new ClassPathResource("db/schema.sql"); schemaContent = new String(FileCopyUtils.copyToByteArray(cpr .getInputStream())).toLowerCase(); And get the sequence for each class witH; private String getSequenceName(Class&lt;?&gt; clazz) { for (Field f : clazz.getDeclaredFields()) { if (f.isAnnotationPresent(SequenceGenerator.class)) { SequenceGenerator sg = f.getAnnotation(SequenceGenerator.class); return sg.sequenceName(); } } return null; } The test is simple: Set&lt;Class&lt;?&gt;&gt; entities = reflections.getSubTypesOf(Object.class); for (Class&lt;?&gt; clazz : entities) { String name = getSequenceName(clazz); if (name == null) continue; if (!schemaContent.contains(name.toLowerCase())) { fail("The clazz " + clazz.getSimpleName() + " has a sequence called: " + name + " and it doesn't exits"); } } You can see it here If you want to see if it works, change the sequence name in one of your entitites and run the test.
has comment: http://stackoverflow.com/comment/39905182
has comment: http://stackoverflow.com/comment/39913154
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/39909487
has comment: http://stackoverflow.com/comment/39905427
answers question: http://stackoverflow.com/q/25537533
has comment: http://stackoverflow.com/comment/39905234

http://stackoverflow.com/comment/39894588
type: QuestionComment
has text: @ConnorWright Depends, when *do* you want one of the other strings to appear?
score: 0
comment on: http://stackoverflow.com/q/25549733
type: Comment

http://stackoverflow.com/comment/39628856
comment on: http://stackoverflow.com/a/25406354
score: 0
has text: Thanks for the links! will have a look into them now!
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39746900
has text: jar folder - C:\Program Files\PostgreSQL\9.3\lib
type: Comment
comment on: http://stackoverflow.com/a/25469179
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39805849
has text: Have you upgraded Java ? There is eclipse.ini file ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25501292
score: 0

http://stackoverflow.com/q/25505165
type: UnansweredQuestion
tagged with: maze
score: 0
tagged with: matrix
has title: Find minimal path through a maze via check points
tagged with: java
answer count: 1
has body: I'm trying to find minimal path from starting point 'S' to goal 'G' through all check points'@'. Although i heard Best First Search is efficient,I used Breadth First Search using a queue. I'm creating new Mazestate object for each possible path from every point and adding it to queue. But when i alter the value at a position in one object of queue,its value is changed in all other objects also(Atleast that is what i'm thinking is happening). Please tell me where i'm going wrong. I think there is something wrong with 'maze1' or 'temp.maze2' Sorry for shabby code. class ortry1 { static int w,h; static int sx,sy,gx,gy; static int anos=0; public static char[][] maze3=null; static boolean goalfound=false; static Queue&lt;Mazestate&gt; statequeue=new LinkedList&lt;&gt;(); public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); Scanner scan=new Scanner(System.in); w=(int)scan.nextInt(); h=(int)scan.nextInt(); maze3=new char[h][w]; String tempo=null; for(int i=0;i&lt;h;i++) { tempo=br.readLine(); maze3[i]=tempo.toCharArray(); if(tempo.indexOf('S')!=-1) { sx=i;sy=tempo.indexOf('S'); } if(tempo.indexOf('G')!=-1) { gx=i;gy=tempo.indexOf('G'); } for(int k=0;k&lt;w;k++) { if(maze3[i][k]=='@') { anos++; } } } statequeue.add(new Mazestate(maze3,sx, sy, 0, 0)); ortry1 o=new ortry1(); while(!goalfound) { o.populatequeue(); } } private void populatequeue() { if (statequeue.peek()!=null) { Mazestate temp=statequeue.poll(); char[][] maze1=temp.maze2.clone(); int curx=temp.curx; int cury=temp.cury; int atscrossed=temp.atscrossed; int stepcount=temp.stepcount; System.out.println(atscrossed+" "+stepcount); if(maze1[curx][cury]=='.'){maze1[curx][cury]='1';} else if(maze1[curx][cury]=='1'){maze1[curx][cury]='2';} else if(maze1[curx][cury]=='2'){maze1[curx][cury]='3';} else if(maze1[curx][cury]=='3'){maze1[curx][cury]='4';} else if(maze1[curx][cury]=='@'){maze1[curx][cury]='1';} else if(maze1[curx][cury]=='S'){maze1[…
has answer: http://stackoverflow.com/a/25505353
type: Question

http://stackoverflow.com/comment/39781590
has text: I guess? API documentation suggests that it is so. It would be consistent with the examples given in docs. `I think your best choice (and time saver choice) is to change your parameters name` - I have no control over the backend.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25488507

http://stackoverflow.com/a/25527381
score: 0
answers question: http://stackoverflow.com/q/25523950
has body: do you execute this as a single unit of code in a main method as standalone program? You should be aware of a "cold" jvm, which can result in strong startup performance impact. Similar you (I) dont know about the source code of java.sql.Statement.java. We dont know if there might be lazy intialization of members at any time on executing the query. You do some processing before you measure time, you can use different query to prevent cashing.
type: Answer

http://stackoverflow.com/comment/39741603
type: AnswerComment
has text: Ah, looking good! I was so close... I just hadn't yet figured out the `Collectors.toMap(...)` part, yet. Ooh, and I see what you're doing in the second example, getting the max value and then feeding that back into the lookup. Nice!
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25466744

http://stackoverflow.com/comment/39774927
type: Comment
type: QuestionComment
has text: How is this a diamond?
score: 4
comment on: http://stackoverflow.com/q/25485091

http://stackoverflow.com/q/25404348
tagged with: getter-setter
has comment: http://stackoverflow.com/comment/39625020
has answer: http://stackoverflow.com/a/25405611
tagged with: java
has answer: http://stackoverflow.com/a/25404730
answer count: 6
upvote count: 2
has comment: http://stackoverflow.com/comment/39624893
downvote count: 0
has comment: http://stackoverflow.com/comment/39625176
has answer: http://stackoverflow.com/a/25404489
has answer: http://stackoverflow.com/a/25404472
has body: how to use getter setter in two different class Class A{ int a = 10; GetterAndSetter gs = new GetterAndSetter(); gs.setValue(a); } Class GetterAndSetter { int a ; public void setValue(int a){ this.a = a; } public int getValue(){ return a; } } class B { int c; GetterAndSetter gs = new GetterAndSetter(); c = gs.getValue(); } While printing c it gives null. And tell me if it is valid or not.
accepted answer: http://stackoverflow.com/a/25404472
has title: How to use getters and setters in two different classes
has answer: http://stackoverflow.com/a/25404379
favorite count: 0
type: Question
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25404467
possible better answer: http://stackoverflow.com/a/25404467

http://stackoverflow.com/comment/39671212
type: AnswerComment
comment on: http://stackoverflow.com/a/25429167
has text: To the type of question that is asked, this seems like a fine type of answer.
score: 0
type: Comment

http://stackoverflow.com/comment/39813461
has text: @BranislavLazic oh I completely forget that :/
comment on: http://stackoverflow.com/a/25504940
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25533622
has comment: http://stackoverflow.com/comment/39864927
tagged with: string
has comment: http://stackoverflow.com/comment/39865019
has answer: http://stackoverflow.com/a/25533866
type: Question
has comment: http://stackoverflow.com/comment/39865052
tagged with: if-statement
has comment: http://stackoverflow.com/comment/39865057
has comment: http://stackoverflow.com/comment/39864972
has body: For some reason, I feel like this snippet of code should be easy, but it repeats the "would you like to..." message every time I enter 'y' or 'yes'. thanks for your help! EDIT: Answered by @Keir-Simmons. The rLoop() method was fine; roundNum was being reassigned incorrectly, causing the for-loop before the method to be skipped entirely. Edited with correct code. public static void main(String[] args) { int roundNum = numOfRounds(); boolean repeat = true; while (repeat) { for (int i = 0; i &lt; roundNum; i++){ //other printing code } repeat = rLoop(); //roundNum = 0; //wrong roundNum = numOfRounds(); //right } if (!repeat) { gameSummary(wallet, wagered, totalWinnings); } } private static boolean rLoop() { String input; boolean repeat = false; Scanner keyboard = new Scanner(System.in); System.out.println("Would you like to play again?"); System.out.printf("Either [Y]es or any other key to exit."); input = keyboard.nextLine(); if (input.equalsIgnoreCase("y") || input.equalsIgnoreCase("yes")) repeat = true; else repeat = false; return repeat; }
accepted answer: http://stackoverflow.com/a/25533695
has answer: http://stackoverflow.com/a/25533695
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39865043
tagged with: boolean
score: 0
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/39864962
has title: unable to: receive user input "yes" or "y", flip boolean to true
possible better answer: http://stackoverflow.com/a/25533866

http://stackoverflow.com/comment/39825932
score: 0
comment on: http://stackoverflow.com/a/25452663
type: Comment
type: AnswerComment
has text: @JavaP As discussed I feel by calling get(2,TimeUnit.SECONDS) on Future you will be waiting for 2 seconds for first thread and after looping te seconds future you would be waiting for 2 more seconds and so on which would lead to inconsistent wait times for different thread task futures. So the ideal way is to wait on the executor task for given period of time which is giving all thread future tasks equal chance and the calling shutdownNow() as described in the above answer point 2.

http://stackoverflow.com/comment/39817091
has text: I think I can confirm my suppose: After adding "Thread.sleep(10)" before "System.out.println(xxxx)" in each function, the output is correct. So it should be a trace issue. Thanks for your answer, it 's quite useful.
comment on: http://stackoverflow.com/a/25496979
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39638125
comment on: http://stackoverflow.com/q/25410007
type: Comment
type: QuestionComment
has text: I have: postgresql-9.3-1102.jdbc4.jar and spring-jdbc-4.0.6.RELEASE.jar in my classpath as the two that look relevant. Are there more that I need?
score: 0

http://stackoverflow.com/comment/39799772
comment on: http://stackoverflow.com/a/25498099
score: 2
type: AnswerComment
type: Comment
has text: OP is already using the builder pattern. He wants to prevent the case where someone calls, to use your example, `new Foo.Builder().objectToSet(someObject).objectToSet(someOtherObject).build();`.

http://stackoverflow.com/comment/39669314
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25427716
has text: @Voo - *You can't prove that something works by testing with concurrent code, you can only prove that it's broken that way* - perfect. :)

http://stackoverflow.com/a/25448723
score: 4
upvote count: 4
type: AcceptedAnswer
has body: "The users are used to type "space bar" to finish an operation like payment in a cashier." Personally, I would just use an ActionListener so that the Enter key triggers the event. It just seems more natural. import java.awt.event.*; import javax.swing.*; public class TestTextField { public static void main(String[] args) { final JTextField field = new JTextField(15); field.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { System.out.println("Enter Pressed: " + field.getText()); } }); JOptionPane.showMessageDialog(null, field); } } If you want to use Space, you can bind the key the field using Key Bindings import java.awt.event.ActionEvent; import javax.swing.*; public class TestTextField { public static void main(String[] args) { final JTextField field = new JTextField(15); InputMap imap = field.getInputMap(JComponent.WHEN_FOCUSED); imap.put(KeyStroke.getKeyStroke("SPACE"), "spaceAction"); ActionMap amap = field.getActionMap(); amap.put("spaceAction", new AbstractAction(){ public void actionPerformed(ActionEvent e) { System.out.println("Space Pressed: " + field.getText()); } }); JOptionPane.showMessageDialog(null, field); } } You could even go as far as using a DocumentListener to listen for changes in the underlying document of the text field, and check the last character entered was a space (but this seems like a bit much - Just some info for you to learn the workings for text components :-) Pick your flavor. I like the first.
downvote count: 0
has comment: http://stackoverflow.com/comment/39707329
accepted answer of: http://stackoverflow.com/q/25447485
type: Answer
answers question: http://stackoverflow.com/q/25447485

http://stackoverflow.com/q/25392664
score: 1
has body: I need to generate PDF from my application using PdfDocument class introduced in API 19. I don't want to use any 3rd party library. Here is what I have done PdfDocument document = new PdfDocument(); PdfDocument.PageInfo pageInfo = new PdfDocument.PageInfo.Builder(300, 300, 1).create(); PdfDocument.Page page = document.startPage(pageInfo); View content = findViewById(R.id.testText); content.draw(page.getCanvas()); document.finishPage(page); String fullPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/AppName"; File dir = new File(fullPath); File file = new File(fullPath, "TripReport.PDF"); if (!dir.exists()) dir.mkdirs(); if (file.exists()) file.delete(); file.createNewFile(); FileOutputStream os = new FileOutputStream(file); document.writeTo(os); document.close(); os.flush(); os.close(); Can anyone please suggest what I am doing wrong?
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/39866747
tagged with: pdf-generation
has comment: http://stackoverflow.com/comment/39605623
type: Question
has answer: http://stackoverflow.com/a/30207799
has comment: http://stackoverflow.com/comment/39603725
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39603838
answer count: 1
has comment: http://stackoverflow.com/comment/39603736
has title: Generate PDF in Android without any 3rd party Library
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39603935

http://stackoverflow.com/comment/80614126
has text: The pom of ojdbc7 states: _"These files are optional and used for specific functionality"_. I would even exclude all of those _optional_ dependencies, since they provide other META-INF/services as well.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/41970292
type: Comment

http://stackoverflow.com/q/25464147
has comment: http://stackoverflow.com/comment/39736638
score: 2
has title: The strangest Android crash occurring to about 20 users of my app
linked to: http://stackoverflow.com/q/11055037
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39738635
tagged with: java
linked to: http://stackoverflow.com/q/10259421
downvote count: 0
has comment: http://stackoverflow.com/comment/39736606
has comment: http://stackoverflow.com/comment/39736649
has comment: http://stackoverflow.com/comment/39736640
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39737175
tagged with: debugging
tagged with: crash
type: UnansweredQuestion
tagged with: android
has body: I've been getting crash reports recently about a crash that is occurring to 20 out of about 200,000 users. java.lang.NullPointerException at android.app.ContextImpl.openFileOutput(ContextImpl.java:429) at android.content.ContextWrapper.openFileOutput(ContextWrapper.java:158) at android.content.ContextWrapper.openFileOutput(ContextWrapper.java:158) at nor.b(Unknown Source) at nor.a(Unknown Source) at ogl.f(Unknown Source) at ogl.b(Unknown Source) at ogl.a(Unknown Source) at ofb.g(Unknown Source) at ohz.g(Unknown Source) at oiq.run(Unknown Source) This crash is obviously not part of my code, and I couldn't even find any classes with those 3-letter package names. It's occurring on Android 2.3.3, 2.3.4, 2.3.7, 4.0.4 and 4.0.9. These are the libraries that are used in my project, is it possible that one of them has caused it? BugSense Google Maps API v2 Google Play Services Jackson Android Support Library ActionBarSherlock I really have no idea how to prevent this crash from occurring, I tried searching Google for these class names but found no results. My application is not pro-guarded. Thanks, Elad

http://stackoverflow.com/q/25516235
tagged with: jtable
linked to: http://stackoverflow.com/q/25487472
has comment: http://stackoverflow.com/comment/39834209
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39834212
downvote count: 3
tagged with: swing
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39834196
type: Question
has comment: http://stackoverflow.com/comment/39834360
has title: Recreate table java issue
has answer: http://stackoverflow.com/a/25516391
has comment: http://stackoverflow.com/comment/39834127
type: UnansweredQuestion
has body: I am having trouble on repopulating my table every time please() gets called. It keeps adding to the existing rows and that's not what I want. I want to repopulate the table base off my model2. Can you someone help me on recreating the table every time please() gets called. My error is where the model2.addRow(please) is called... import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; public class TableTimeChange { String rowdata[] = new String[8]; Date[] date123 = new Date[8]; Date[] date1234 = new Date[8]; String[] ddd = new String[8]; static Calendar time1 = Calendar.getInstance(); static Calendar time2 = Calendar.getInstance(); Calendar time3[] = new Calendar[8]; Calendar cal8 = Calendar.getInstance(); Date date = new Date(); DefaultTableModel model2 = new DefaultTableModel(); static int count = 0; static boolean state = true; private SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss"); private JTable table = new JTable(getTableModel()); public TableTimeChange() { table.setPreferredScrollableViewportSize(table.getPreferredSize()); JFrame frame = new JFrame(); frame.add(new JScrollPane(table)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); Timer timer = new Timer(1000, new TimerListener()); timer.start(); frame.setVisible(true); Calendar cal1 = new GregorianCalendar(); cal1.add(Calendar.SECOND, 5); date = cal1.getTime(); cal8.setTime(date); } private TableModel getTableModel() { String[] cols = {"Time", "Is Seconds Even", "tttt"}; Object[][] data = {{getNewRow()},…
has comment: http://stackoverflow.com/comment/39834244
score: -3
has comment: http://stackoverflow.com/comment/39834193
has comment: http://stackoverflow.com/comment/39834111

http://stackoverflow.com/comment/39853981
type: Comment
type: QuestionComment
score: 0
has text: getWidth() and getHeight() are certainly the more natural way to ask for the size of the image, but I pass around the corresponding Graphics2D objects to draw on them, so I do not know the image object then, and have to ask for the size as described above
comment on: http://stackoverflow.com/q/25527205

http://stackoverflow.com/comment/39764380
has text: If you put something other than number for `text`, the app will throw `NumberFormatException` since it tries to parse text, not a number. Refer to the updated answer for the example.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25478968

http://stackoverflow.com/q/25513524
type: UnansweredQuestion
tagged with: android
has title: Can you pin parse files/ images to the local datastore?
score: 0
tagged with: java
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/25513603
has body: If not what is a good way to cache images locally? -- Note: I am coding for Android.
tagged with: parse-platform

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/25465401

http://stackoverflow.com/comment/39747715
comment on: http://stackoverflow.com/q/25470126
type: QuestionComment
has text: i am getting the above error in my console
score: 0
type: Comment

http://stackoverflow.com/a/25517178
answers question: http://stackoverflow.com/q/25517141
has body: You need an operator in the middle of your operations Your code seems to indicate you want to multiply so try the code below instead... System.out.println((num1/dem1)*(num2/dem2));
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/39845765
score: 0
has text: Why do you want to return a java class?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25523036

http://stackoverflow.com/comment/39768429
score: 0
type: Comment
type: QuestionComment
has text: Yes the json is valid
comment on: http://stackoverflow.com/q/25479875

http://stackoverflow.com/comment/58268354
type: Comment
has text: This problem happened to be, although I was loading things before checking the cache. I forgot I had to specify this when building! Thank you!
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/33167221

http://stackoverflow.com/a/25481447
answers question: http://stackoverflow.com/q/25481402
type: Answer
has body: http://en.wikipedia.org/wiki/MyBatis / iBatis uses XML for queries. Whether it fits is up-to-you.
score: 0

http://stackoverflow.com/q/25540813
type: UnansweredQuestion
tagged with: android
tagged with: pagination
has comment: http://stackoverflow.com/comment/39879259
has comment: http://stackoverflow.com/comment/39878548
has comment: http://stackoverflow.com/comment/39878651
has comment: http://stackoverflow.com/comment/39878864
tagged with: listview
has body: I want to use pagination for a listview in android.I am loading 10 values at a time from a web service.But the problem is that the group of 10 values keep repeating.I have used an array list called ice_data for the adapter of the listview.The code: public class VideoActivity extends Activity { private ConnectionDetector cd; public HttpResponse video_respons; public String video_string_response1; public ArrayList&lt;NameValuePair&gt; nameValuePairs_Video; ArrayList&lt;Ice_data&gt; ice_list; String URL="http://footballultimate.com/icebucket/index.php/api/getVideo"; String URL1="http://footballultimate.com/icebucket/index.php/api/getVideoByLimit"; JSONObject jsonobj; JSONArray jsonarr; Ice_data iceobj; CustomIceAdapter ciadp; ListView list; int start = 1; int limit = 10; boolean loadingMore = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video); ice_list=new ArrayList&lt;Ice_data&gt;(); // GEt all Data for Video cd = new ConnectionDetector(VideoActivity.this); Config.isInternetPresent = cd.isConnectingToInternet(); if (!Config.isInternetPresent) { AlertDialog.Builder builder = new AlertDialog.Builder(VideoActivity.this); // Shuld be fail icon builder.setIcon(R.drawable.ic_launcher); builder.setMessage("Connection Not Available !" + "\n" + "Please enable your Internet Connection"); builder.setTitle("INTERNET CONNECTION"); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } else { new GetVideos().execute(); } // Get all Data for Video list= (ListView) findViewById(R.id.videoList); list.setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView arg0, int arg1) { // TODO Auto-generated method stub } @Override public void onScroll(AbsListView arg0…
has comment: http://stackoverflow.com/comment/39878755
answer count: 0
score: 0
tagged with: java
has title: Using pagination for listview in android
has comment: http://stackoverflow.com/comment/39878503
has comment: http://stackoverflow.com/comment/39878993
has comment: http://stackoverflow.com/comment/39878413
type: Question
has comment: http://stackoverflow.com/comment/39880251

http://stackoverflow.com/a/29588566
has comment: http://stackoverflow.com/comment/50798934
answers question: http://stackoverflow.com/q/25414352
score: 33
upvote count: 34
has comment: http://stackoverflow.com/comment/57597505
has comment: http://stackoverflow.com/comment/96940750
has body: I believe I've solved it. The request intent: Intent intent; if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT){ intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); }else{ intent = new Intent(Intent.ACTION_GET_CONTENT); } intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent, getResources().getString(R.string.form_pick_photos)), REQUEST_PICK_PHOTO); and onActivityResult ... // kitkat fixed (broke) content access; to keep the URIs valid over restarts need to persist access permission if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) { final int takeFlags = data.getFlags() &amp; Intent.FLAG_GRANT_READ_URI_PERMISSION; ContentResolver resolver = getActivity().getContentResolver(); for (Uri uri : images) { resolver.takePersistableUriPermission(uri, takeFlags); } } ... I haven't tested this pre-kitkat, my phone is running 5.1, can anyone verify this on older phones?
has comment: http://stackoverflow.com/comment/52827433
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/73613319
has comment: http://stackoverflow.com/comment/50800208
downvote count: 1
has comment: http://stackoverflow.com/comment/96981051
has comment: http://stackoverflow.com/comment/73612725
accepted answer of: http://stackoverflow.com/q/25414352
has comment: http://stackoverflow.com/comment/56483928
has comment: http://stackoverflow.com/comment/56480305
type: Answer

http://stackoverflow.com/q/25492986
has body: Working with Spring Data Neo4j (using simple mapping mode), I occasionally come across NotInTransactionException's being thrown inside methods that are annotated with @Transactional, and have found myself pulling out more hairs than I can afford to lose trying to diagnose these exceptions. For example, the following method: @Service public class FooService { @Autowired Neo4jTemplate template; //GraphPersisted is an interface containing a single method: Long getId() //ModelNode is an empty interface implemented by my @NodeEntity classes @Transactional public &lt;T extends ModelNode&gt; T getNode(GraphPersisted g, Class&lt;T&gt; clazz){ return template.repositoryFor(clazz).findOne(g.getId()); //NotInTransactionException!! } } is throwing the following: Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: nested exception is org.neo4j.graphdb.NotInTransactionException at org.springframework.data.neo4j.support.Neo4jExceptionTranslator.translateExceptionIfPossible(Neo4jExceptionTranslator.java:51) at org.springframework.data.neo4j.support.Neo4jTemplate.translateExceptionIfPossible(Neo4jTemplate.java:447) at org.springframework.data.neo4j.support.Neo4jTemplate.getNode(Neo4jTemplate.java:481) at org.springframework.data.neo4j.repository.NodeGraphRepositoryImpl.getById(NodeGraphRepositoryImpl.java:33) at org.springframework.data.neo4j.repository.NodeGraphRepositoryImpl.getById(NodeGraphRepositoryImpl.java:24) at org.springframework.data.neo4j.repository.AbstractGraphRepository.findOne(AbstractGraphRepository.java:127) at org.springframework.data.neo4j.repository.AbstractGraphRepository.findOne(AbstractGraphRepository.java:51) at net.mypkg.myapp.core.FooService.getNode(FooService.java:28) at net.mypkg.myapp.citizenry.BarService.getCitNode(BarService.java:136) at net.mypkg.myapp.citizenry.BarService.loadCitizens(BarService.java:81) at net.mypkg.myapp.citizenry.BarService$$FastClassBySpringCGLIB$$792b7a4e.invoke(&lt;generated&gt;) at org.springframework.cglib…
has answer: http://stackoverflow.com/a/25496686
possible better answer: http://stackoverflow.com/a/25496686
favorite count: 0
type: Question
tagged with: spring-data-neo4j
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25538413
tagged with: spring
has comment: http://stackoverflow.com/comment/39961316
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39812141
has title: Diagnosing transactional exceptions in Spring Data
score: 1
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39795640
tagged with: spring-data
accepted answer: http://stackoverflow.com/a/25538413
has comment: http://stackoverflow.com/comment/39795899

http://stackoverflow.com/q/25391682
tagged with: sparql
has comment: http://stackoverflow.com/comment/39610712
tagged with: jena-rules
has comment: http://stackoverflow.com/comment/39934106
has comment: http://stackoverflow.com/comment/39815054
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39835944
linked to: http://stackoverflow.com/q/12139978
linked to: http://stackoverflow.com/q/23255124
has title: Create function and call it from Jena Rule
linked to: http://stackoverflow.com/q/23268298
has comment: http://stackoverflow.com/comment/39603643
tagged with: http://stackoverflow.com/tag/rdf
has comment: http://stackoverflow.com/comment/39603801
has comment: http://stackoverflow.com/comment/39603616
type: Question
has comment: http://stackoverflow.com/comment/39605366
has body: I have created a function that perform some calculations between nodes. I would like to call this function from Jena rule? Is this possible? I found that built-in function can be called from jena rule, but I would like to call my own function. How can I write a builtin function?
tagged with: jena
has comment: http://stackoverflow.com/comment/39854301
answer count: 0
has comment: http://stackoverflow.com/comment/39834359
type: UnansweredQuestion

http://stackoverflow.com/q/25449138
score: 0
has title: Java Array Questions
tagged with: java
answer count: 6
has answer: http://stackoverflow.com/a/25449369
has answer: http://stackoverflow.com/a/25449350
has answer: http://stackoverflow.com/a/25449176
has answer: http://stackoverflow.com/a/25449189
has answer: http://stackoverflow.com/a/25449225
has answer: http://stackoverflow.com/a/25449179
type: UnansweredQuestion
tagged with: arrays
has body: So this is just a basic question. I was working with arrays in Java, figured out what I needed to do for my little assignment. I decided to play around with the array and see what would happen if I print out my array. I was very confused about the result I got with this code: public class array_output{ public static void main(String[] args){ int[] anArray = new int[10]; for(int p = 0; p &lt; 10; p++){ anArray[p] = p; //System.out.print(anArray[p] + " "); p++; } System.out.println (java.util.Arrays.toString(anArray)); } } So the original intension was to just make an array "0, 2, 4, 6, 8". I decided to put my System.out.print outside of the for loop and print it out. The output I have got was [0, 0, 2, 0, 4, 0, 6, 0, 8, 0] Actually when I am writing this I thought that it is putting a "0" in place of the numbers that are not there between 0-9 like 0 is false and if the number shows it's in the array, not sure though. If anyone could explain to me if that's what is happening here, and maybe explain how to print the values of the array outside of the for loop, I would greatly appreciate it
type: Question

http://stackoverflow.com/comment/87490273
has text: @loganathan in my file i have these entries but still getting org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25401489

http://stackoverflow.com/a/25548062
has body: you can call it by editing your main method to call the MyTextPane() subclass instead of JTextPane() I.e. public static void main(String[] args) { //add your jframe here JFrame frame=new JFrame(); //add component MyTextPane pane1=new MyTextPane(); pane1.setText("text here"); frame.add(pane1); frame.pack(); frame1.setVisible(true); }
type: Answer
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25535277

http://stackoverflow.com/comment/39675818
type: QuestionComment
comment on: http://stackoverflow.com/q/25431477
has text: What time zone are you interested in? (Imagine two values which are 9pm and 11pm in your time zone, but 11pm and 1am in mine...)
score: 0
type: Comment

http://stackoverflow.com/comment/39605844
comment on: http://stackoverflow.com/q/25393600
has text: @dudeprgm Unity is giving me an error for a null pointer exception, but the plugin itself IS being found. I've a feeling that the reason this isn't launching is because I need to know the actual name of the activity to launch. I'm running a few more tests to see if I can launch Google's camera or gallery, which are more easily integrated.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/54824828
has text: I'm not sure what you what to show with you example with `Foo`, but it is actually possible to instantiate `Foo` in a context with type parameters (which can have each other as bounds). Either with implicit type parameters which the compiler uses when doing type inference: `Foo<?, ?> foo = new Foo<>();`. Or in a method with type parameters: `<F extends BaseFoo<F, B>, B extends BaseBar<F, B>> void m() { Foo<F, B> foo = new Foo<F, B>(); }`
type: AnswerComment
comment on: http://stackoverflow.com/a/25459158
score: 0
type: Comment

http://stackoverflow.com/comment/39740245
type: Comment
type: QuestionComment
has text: @HovercraftFullOfEels - I understand, it's the same concept I had to undergo with my JTables. Since it would originally accept `Object[][]` I had to create my own model to accept List<Student> to retrieve the required fields. The only part I didn't quite get is the order and ordered map. 1) Why would it be an issue. 2) Why would an ordered map be required instead of let's say `List<String>`?
comment on: http://stackoverflow.com/q/25466032
score: 0

http://stackoverflow.com/a/25458789
type: Answer
answers question: http://stackoverflow.com/q/25456694
score: 0
type: AcceptedAnswer
has body: &lt;link&gt; is a void element.It has no closing tag. try this: &lt;link rel="stylesheet" type'text/css" href="../assets/css/styles_main.css"&gt;
accepted answer of: http://stackoverflow.com/q/25456694

http://stackoverflow.com/comment/39810187
type: Comment
type: AnswerComment
has text: So there is the main thread, the client acceptor thread and at least six connection pool threads. Also JDBC uses Log4J wich might spawn threads. Is the thread amount still strange?
score: 0
comment on: http://stackoverflow.com/a/25503180

http://stackoverflow.com/comment/39648770
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25416605
type: QuestionComment
has text: You're better off serializing data into formats suitable for network communication, like JSON/XML, while avoiding byte order, endianness, etc., otherwise, your approach will get messy!

http://stackoverflow.com/q/25520025
linked to: http://stackoverflow.com/q/23751905
upvote count: 2
has comment: http://stackoverflow.com/comment/39840721
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39840707
has comment: http://stackoverflow.com/comment/39840640
has comment: http://stackoverflow.com/comment/39840452
has comment: http://stackoverflow.com/comment/39840613
favorite count: 0
has title: Google Drive error on import
type: Question
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25520115
has answer: http://stackoverflow.com/a/25520115
has body: I have followed the tutorial provided by Google. But I am experiencing error on the following imports: import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.drive.Drive; import com.google.android.gms.drive.DriveApi.ContentsResult; import com.google.android.gms.drive.MetadataChangeSet; I have already added Drive API and google_play_services library in my project. And Target SDK is 4.0 compiled with google APIs 4.0. And this is my Manifest. Please help. &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.googledrivetest" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.example.googledrivetest.MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; &lt;/application&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt; &lt;uses-permission android:name="android.permission.USE_CREDENTIALS" /&gt;
score: 2
tagged with: google-drive-api
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39840371

http://stackoverflow.com/comment/39613202
has text: @ Subhrajyoti Majumder - I did - And I did not get an answer. Do you mind answering it.
comment on: http://stackoverflow.com/q/25397879
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39869691
comment on: http://stackoverflow.com/q/25536031
type: Comment
type: QuestionComment
has text: check those other tools licenses to be sure
score: 0

http://stackoverflow.com/comment/39743461
comment on: http://stackoverflow.com/a/25467229
type: Comment
type: AnswerComment
has text: You have any idea please?
score: 0

http://stackoverflow.com/comment/39789702
type: Comment
comment on: http://stackoverflow.com/q/25492475
score: 0
type: QuestionComment
has text: @DziNeIT Generally yes.

http://stackoverflow.com/a/25433136
answers question: http://stackoverflow.com/q/25432988
type: Answer
has body: If I understand your question, then you will need to add an accessor (or getter) method to your abc class - List&lt;E&gt; returnthis = new ArrayList&lt;&gt;(); // &lt;-- note caps and diamond operator. public List&lt;E&gt; getList() { return returnthis; } Then you can abc&lt;Foo&gt; array = new abc&lt;&gt;(); // &lt;-- abc is generic List&lt;Foo&gt; foos = array.getList(); // &lt;-- like so Finally, abc is a very poor class name. It's nondescript and doesn't follow Java capitalization conventions.
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/25482558
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/39771757
has title: Integrate GreenDao with Retrofit
has answer: http://stackoverflow.com/a/40835275
answer count: 2
downvote count: 0
type: UnansweredQuestion
has body: I'm searching for a solution that allows me to getting work retrofit and GreenDao together. This is my code and does not work. Post is a class generated by greenDao generator EDIT: the run of this code returns me "retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $ " public static void test() { RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(BASE_URL) .build(); PostsInterface postsInterface = restAdapter.create(PostsInterface.class); Callback&lt;List&lt;Post&gt;&gt; callback = new Callback&lt;List&lt;Post&gt;&gt;() { @Override public void success(List&lt;Post&gt; posts, Response response) { Log.d(TAG, response.toString()); } @Override public void failure(RetrofitError error) { Log.d(TAG, error.toString()); } }; postsInterface.getPosts(0, 10, callback); } public interface PostsInterface { @GET("/posts") void getPosts(@Query("start") int limit, @Query("count") int offset, Callback&lt;List&lt;Post&gt;&gt; callback); }
tagged with: java
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39870260
tagged with: greendao
tagged with: retrofit
tagged with: android
has answer: http://stackoverflow.com/a/29971034

http://stackoverflow.com/a/25395595
has comment: http://stackoverflow.com/comment/39627989
score: 0
has comment: http://stackoverflow.com/comment/39628434
has body: Seems that you're modifying only the XML document object in memory. Try to save the object back to XML file at the end. Something like this maybe* : Transformer transformer = TransformerFactory.newInstance().newTransformer(); Result output = new StreamResult(new File("myXMLfile.xml")); Source input = new DOMSource(myDocument); transformer.transform(input, output); *) I'm not a Java guy, snippet taken from this thread : How to save parsed and changed DOM document in xml file?
has comment: http://stackoverflow.com/comment/39626469
has comment: http://stackoverflow.com/comment/39626750
answers question: http://stackoverflow.com/q/25391077
has comment: http://stackoverflow.com/comment/39878428
type: Answer

m2e
tags question: http://stackoverflow.com/q/25509493
type: Tag
tags question: http://stackoverflow.com/q/25495633
tag name: m2e
tags question: http://stackoverflow.com/q/25444252
tags question: http://stackoverflow.com/q/25546496

http://stackoverflow.com/a/25408632
has body: As for the first question, you could use multiple if-statements: int x = 1; //x starts a little to the right of 0 int y = 0; //y starts at 0 while (x &gt; 0 &amp;&amp; y &gt; 0){ if (x &lt; panel.getWidth() &amp;&amp; y == 0){ panel.drawNextPixel(x, y); x++; } else if (x == panel.getWidth() &amp;&amp; y != panel.getHeight()){ panel.drawNextPixel(x, y); y++; } else if (x &gt; 0 &amp;&amp; y == panel.getHeight()){ panel.drawNextPixel(x, y); x--; } else { panel.drawNextPixel(x, y); y--; } } This way, you check both the x and y coordinates when deciding which way you want to draw the pixels. It starts with x=1 and y=0, then moves to the right until x hits the border, then moves downward until y hits the border, then moves left until x hits 0, and finally moves upwards until y hits 0 and the while condition becomes false. As for the circle, you need to use trigonometry. Designate a point in the middle of the panel to draw the circle. Then designate a radius you want for the circle. int middle = 50; int radius = 20; Then, you use trigonometry: int deg = 0; while ( deg &lt;= 360 ) { x = middle + (int)(Math.cos(deg)*radius); y = middle + (int)(Math.sin(deg)*radius); panel.drawNextPixel(x, y); deg++; } That should do it.
score: 0
accepted answer of: http://stackoverflow.com/q/25408082
type: Answer
answers question: http://stackoverflow.com/q/25408082
type: AcceptedAnswer

http://stackoverflow.com/q/25420304
score: 1
favorite count: 0
tagged with: apache-httpclient-4.x
tagged with: rest
type: Question
type: UnansweredQuestion
has body: I wrote the following code to send HTTP PUT request with payload which contains JSON object . I used Apache HttpClient but can't figure out the error, can you please tell me what I'm doing wrong ? It gives this compilation error: Exception in thread "main" java.lang.RuntimeException: Stub! at org.apache.http.impl.client.AbstractHttpClient.(AbstractHttpClient.java:5) at org.apache.http.impl.client.DefaultHttpClient.(DefaultHttpClient.java:7) at Test.main(Test.java:26) public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub JSONObject keyArg = new JSONObject(); keyArg.put("name", "XYZ"); keyArg.put("email", "XYZ"); HttpClient httpClient = new DefaultHttpClient(); URI url = new URI("www.XYZ-SERVER.com"); HttpPut putRequest = new HttpPut(url); putRequest.addHeader("Content-Type", "application/json"); putRequest.addHeader("Content-Length", "LENGTH"); putRequest.addHeader("Key", "ad412f36a2eecbcd5c0e323e"); putRequest.setEntity((HttpEntity) keyArg); HttpResponse response = httpClient.execute(putRequest); }
has title: How to use HTTP PUT in java to send payload with custom header?
tagged with: put
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/39666886
upvote count: 1

connection-pooling
tags question: http://stackoverflow.com/q/25500735
tags question: http://stackoverflow.com/q/25396624
type: Tag
tags question: http://stackoverflow.com/q/25514270
tag name: connection-pooling

http://stackoverflow.com/comment/39695078
score: 0
type: Comment
has text: You can't use for-each to remove element. You will get ConcurrentModificationException. What you are doing here is wrong
type: AnswerComment
comment on: http://stackoverflow.com/a/25442172

http://stackoverflow.com/comment/39611104
comment on: http://stackoverflow.com/q/25396664
score: 1
has text: No. You cannot access arbitrary memory in Java. But, you can share memory between two JVMs. Use JNI and ipcs. Or sockets over loopback.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25506738
upvote count: 1
type: AcceptedAnswer
has body: You can provide custom FileHandleResolver in constructor: TiledMap map = new TmxMapLoader(new ExternalFileHandleResolver()).load("level1.tmx"); More info about FileHandleResolver: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/loaders/FileHandleResolver.html
score: 1
answers question: http://stackoverflow.com/q/25505014
type: Answer
accepted answer of: http://stackoverflow.com/q/25505014
downvote count: 0

http://stackoverflow.com/comment/39865356
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25533699
has text: I cannot, but yes, they have the same id. If I map them as separated entities, without extending the parent can I bypass this issue?
score: 0

http://stackoverflow.com/a/25466744
has comment: http://stackoverflow.com/comment/39741785
has body: You can create a Stream of the entries and collect it to a Map : Map&lt;String, Person&gt; oldestPeopleByName = names2PeopleAges.entrySet() .stream() .collect (Collectors.toMap(e-&gt;e.getKey(), e-&gt;e.getValue().lastEntry().getValue()) ); Now, without lastEntry : Map&lt;String, Person&gt; oldestPeopleByName = names2PeopleAges.entrySet() .stream() .collect (Collectors.toMap(e-&gt;e.getKey(), e-&gt;e.getValue().get(e.getValue().keySet().stream().max(Long::compareTo))) ); Here, instead of relying on lastEntry, we search for the max key in each of the internal Maps, and get the corresponding Person of the max key. I might have some silly typos, since I haven't actually tested it, by in principle it should work.
has comment: http://stackoverflow.com/comment/39741830
has comment: http://stackoverflow.com/comment/39741603
has comment: http://stackoverflow.com/comment/39741712
upvote count: 47
score: 47
answers question: http://stackoverflow.com/q/25466664
accepted answer of: http://stackoverflow.com/q/25466664
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/39749810
score: 0
has text: Although above scheme will work, adding a String object in the `ObjectOutputStream` as EJP suggests does probably not add *that* much overhead. I think he more or less moved in after reading the comments, but whatever.
type: QuestionComment
comment on: http://stackoverflow.com/q/25469241
type: Comment

http://stackoverflow.com/comment/39757027
type: AnswerComment
has text: I need to do it as a defense against the free distribution of my application, because android lvl does not fit.
comment on: http://stackoverflow.com/a/25474882
score: 0
type: Comment

http://stackoverflow.com/a/25476509
score: 0
has body: You may try this.Define two layout one will use full screen and in other define the layout width height and position you want.And define this code in the activity class. `@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { setContentView(R.layout.fullscreen); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { setContentView(R.layout.potrait); } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getConfiguration().orientation == 1) { setContentView(R.layout.landscape); } if (getResources().getConfiguration().orientation == 2) { setContentView(R.layout.potrait); } }`
answers question: http://stackoverflow.com/q/25475541
has comment: http://stackoverflow.com/comment/39763352
has comment: http://stackoverflow.com/comment/39759770
type: Answer

http://stackoverflow.com/a/25907633
score: 8
upvote count: 8
type: Answer
has body: In your linked post you can find the solution. The difference to your code is how the gallery intent is created: final Intent galleryIntent = new Intent(); galleryIntent.setType("image/*"); galleryIntent.setAction(Intent.ACTION_GET_CONTENT); Not with ACTION_PICK how you did but with ACTION_GET_CONTENT. It seems that if a single ACTION_PICK is in the list (a "container intent"), the system traverses it to display the content of the pick, but as soon you include the camera intent it can't traverse anymore (since there is one direct intent and one container intent). In the comment of this answer you find the difference between ACTION_PICK and ACTION_GET_CONTENT. There are some solutions available which recommend to use a custom dialog. But this dialog will not have the standards icons (see develper docs here). So I recommend to stay at your solution and just fix the hierarchie issue.
answers question: http://stackoverflow.com/q/25524617
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25524617

http://stackoverflow.com/comment/39660104
has text: Thanks.But the format of Json may vary every time so it is not possible to maintain a POJO
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25423259
type: Comment

http://stackoverflow.com/q/25547131
has title: Confusion with Graphics2d, canvas and shapes
tagged with: swing
type: AnsweredQuestion
upvote count: 3
score: 3
tagged with: graphics2d
tagged with: java
has comment: http://stackoverflow.com/comment/39889542
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25547167
possible better answer: http://stackoverflow.com/a/25547428
has answer: http://stackoverflow.com/a/25547167
has body: I am learning the basics of java games programming and I am confused about a few things. I know you use the "canvas" class to create a blank canvas and then use the paint method to create stuff. But what does Graphics2D? I have seen people using the grahpics2d class to create a canvas for example Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.BLACK); Now why did they use the grahpics2d and not the canvas? Also I have seen people creating shapes like a rectangle by using: Rectangle r = new Rectangle(); but some people have created them like: Shape shape = new Rectangle2D.Double(value1,valu2,valu3,valu4); What's the difference between these two? Thanks in advance. regards,
answer count: 2
has answer: http://stackoverflow.com/a/25547428
downvote count: 0

http://stackoverflow.com/q/25485908
tagged with: wifi
type: Question
has comment: http://stackoverflow.com/comment/39776484
tagged with: android
has answer: http://stackoverflow.com/a/25485980
has title: scan available wireless networks every 5 second java android
has body: I Want To Check For Available Wireless Networks Every 5 Second In My Phone. so i write This code for my app but this code check WIFI Networks every 15 second ! This Is a service , that scan WIFI Networks every 15 second and if founds a without password WIFI vibrates the phone an play a sound... How Can I Check Wireless Networks every 5 or 3 seconds ? package com.sirbl4ck.wififinder; import java.util.List; import android.annotation.SuppressLint; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.wifi.ScanResult; import android.net.wifi.WifiManager; import android.os.IBinder; import android.os.Vibrator; import android.os.PowerManager; import android.widget.Toast; import android.media.MediaPlayer; public class MyService extends Service { WifiManager mainWifiObj; WifiScanReceiver wifiReciever; PowerManager pm; PowerManager.WakeLock wl; public MyService() { } public IBinder onBind(Intent arg0) { return null; } @Override public void onCreate() { pm = (PowerManager) getSystemService(Context.POWER_SERVICE); wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"Log"); wl.acquire(); mainWifiObj = (WifiManager) getSystemService(Context.WIFI_SERVICE); wifiReciever = new WifiScanReceiver(); mainWifiObj.startScan(); registerReceiver(wifiReciever, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); Toast.makeText(this, "WIFI Finder Service Started", Toast.LENGTH_LONG).show(); } public void onDestroy() { wl.release(); Toast.makeText(this, "WIFI Finder Service Stoped", Toast.LENGTH_LONG).show(); } public void alert(){ final MediaPlayer als = MediaPlayer.create(this, R.raw.alertm); als.start(); } class WifiScanReceiver extends BroadcastReceiver { @SuppressLint("UseValueOf") Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); public void onReceive(Context c, Intent intent) { List&lt;ScanResult&gt; wifiScanList = mainWifiObj.g…
type: AnsweredQuestion
tagged with: network-scan
accepted answer: http://stackoverflow.com/a/25485980
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/a/25420429
has comment: http://stackoverflow.com/comment/39700019
answers question: http://stackoverflow.com/q/25392716
score: 0
has comment: http://stackoverflow.com/comment/39662254
has comment: http://stackoverflow.com/comment/39687283
has body: Almost all XML parsers assumes that the source always gives the bytes it wants when it asks. When there are not enough number of bytes in the source, it expects the source to block until it has the bytes. This design conflicts with the non-blocking source, such as Netty channel. To work around this impedence mismatch, you need to ensure that your ByteBuf contains a complete XML document. You can ensure that using XmlFrameDecoder. Once XmlFrameDecoder produces a ByteBuf with a complete XML document, you can feed it to your favorite parser by wrapping the buffer with ByteBufInputStream. For example: InputStream in = new ByteBufInputStream(buf); parser.parse(in, handler);
type: Answer

http://stackoverflow.com/q/25501941
has comment: http://stackoverflow.com/comment/39806912
has comment: http://stackoverflow.com/comment/39807140
type: AnsweredQuestion
score: 0
has body: I have found many answers on how to write/read a serialized class to a file, and have successfully implemented it into my Android app, I have however hit an issue with expanding the functionality of my app. For example if I have carClass: String make; String model; I then save that to my save file and whenever I load it the stored values are ok :) But when I then try to expand the class to include something else i.e. color: String make; String model; String color; When the app loads the file, it tries to cast the object into the new class, and as the loaded object does not have 'color' it fails to load the save file. How do I overcome this? At the moment every time I add new stuff to my app, user's save files are effectively invalid and they have to start again, which is not a good user experience!
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39806735
has title: Loading serialized class from file, when class has changed (Java/Android)
accepted answer: http://stackoverflow.com/a/25502046
has comment: http://stackoverflow.com/comment/39807073
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25502046

http://stackoverflow.com/comment/39812369
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25504426
has text: OK.. Is it possible for carrying repository operations to be done through Java.
score: 0

http://stackoverflow.com/comment/75295908
has text: Possible duplicate of [Namespace related error on creating SOAP Request](https://stackoverflow.com/questions/25479797/namespace-related-error-on-creating-soap-request)
comment on: http://stackoverflow.com/q/25527971
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/28208406
downvote count: 1
score: 6
type: Answer
answers question: http://stackoverflow.com/q/25454374
has comment: http://stackoverflow.com/comment/51583327
has body: This is because maven 1.5 is not compatible with eclipse juno. So we need to use maven 1.4 or 1.3 Steps to install maven 1.4 is below Click Help in eclipse Install New Software Url for the location of site is "http://download.eclipse.org/technology/m2e/releases" Uncheck the checkbox "Show only the latest versions of available software" if do not uncheck the checkbox it will only latest version and do not show maven 1.4. Select m2e and slf4j of 1.4 version and click next. Note: maven v 1.3 is compatible, correct url for juno: download.eclipse.org/technology/m2e/releases/1.3
upvote count: 7

http://stackoverflow.com/comment/39856893
has text: Oh my, wouldn't this be simple using JAXB...
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25529167
type: Comment

http://stackoverflow.com/a/25519568
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25519543
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25519543
has body: Here i have some navigation and code information shortcut for eclipse Ctrl+Alt+h Open Call Hierarchy Ctrl+u Find occurrences of expression in current file Ctrl+move over method Open Declaration or Implementation Ctrl+o Show code outline / structure F2 Open class, method, or variable information (tooltip text) F3 Open Declaration: Jump to Declaration of selected class, method, or parameter F4 Open Type Hierarchy window for selected item Ctrl+t Show / open Quick Type Hierarchy for selected item Ctrl+Shift+t Open Type in Hierarchy and for more short cut go HERE

http://stackoverflow.com/q/25544993
has title: Could not initialize class liquibase.sqlgenerator.core.LockDatabaseChangeLogGenerator
tagged with: junit
tagged with: liquibase
tagged with: maven-2
type: Question
has answer: http://stackoverflow.com/a/28738092
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25568498
tagged with: spring
has body: Getting this issue when I try to run maven test. Not sure what's causing the issue as these test ran before without issues. My dependencies are being managed by maven Caused by: java.lang.NoClassDefFoundError: Could not initialize class liquibase.sqlgenerator.core.LockDatabaseChangeLogGenerator at sun.reflect.GeneratedConstructorAccessor379.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at liquibase.sqlgenerator.SqlGeneratorFactory.&lt;init&gt;(SqlGeneratorFactory.java:39) at liquibase.sqlgenerator.SqlGeneratorFactory.getInstance(SqlGeneratorFactory.java:53) at liquibase.executor.AbstractExecutor.applyVisitors(AbstractExecutor.java:22) at liquibase.executor.jvm.JdbcExecutor.access$500(JdbcExecutor.java:35) at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:284) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:54) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:106) at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:96) at liquibase.lockservice.StandardLockService.init(StandardLockService.java:83) at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:182) at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:148) at liquibase.Liquibase.update(Liquibase.java:189) at liquibase.Liquibase.update(Liquibase.java:181) at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:342) at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:299) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
score: 0
tagged with: java

http://stackoverflow.com/a/25395424
accepted answer of: http://stackoverflow.com/q/25395212
has body: As EJP comments, this is nothing to do with InputStream / BufferedReader. What you are seeing is the behaviour of the Linux "tty" input drivers and a typical console command. What you are seeing is normal "line editing" or "line buffering". The input is only made available for Java to read (via the stdin file descriptor) when you press the &lt;Enter&gt; key. The output you are seeing prior to that is the character echoing from the "tty" drivers. (And notice that if you enter &lt;Backspace&gt; or whatever ... the characters get erased. When you type &lt;Enter&gt;, Java doesn't see the backspaces, etc. They have been edited out.) Input via the java.io.Console class behaves the same way. This is the same on Windows: the behaviour is portable. (This is a good thing ...) If you want your Java application to see the characters as they are typed, when they are typed, you will need to use 3rd-party libraries (or native code) to implement this. (In Linux, it entails switching the tty driver into "raw" mode ... and this functionality is non-portable, and not supported by standard Java SE.)
answers question: http://stackoverflow.com/q/25395212
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/25465754
tagged with: android
has answer: http://stackoverflow.com/a/27285652
has comment: http://stackoverflow.com/comment/40527223
has body: I downloaded the latest version, 1.7.1.1, added it as a module in Intellij, and added it as a dependency in my project. Building it against Android API 17. When building, the AmazonHttpClient and HttpClientFactory classes give a few compile errors. For example, in AmazonHTTPClient.java, SSLSocketFactory sf = new SSLSocketFactory( SSLContext.getDefault(), SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); is not an applicable constructor. Also, httpClient.setRedirectStrategy cannot be resolved, and the Scheme constructors have their parameters in the wrong order. Is this an Amazon issue or is something wrong on my end?
has title: AWS Android sdk 1.7.1.1 not compiling - issues with AmazonHttpClient and HttpClientFactory
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: intellij-idea
answer count: 1
linked to: http://stackoverflow.com/q/25894513
tagged with: amazon-web-services
type: Question
accepted answer: http://stackoverflow.com/a/27285652

http://stackoverflow.com/comment/39809208
comment on: http://stackoverflow.com/q/25426429
type: Comment
has text: Hi.. Please help me to find the solution..
score: 0
type: QuestionComment

http://stackoverflow.com/q/25424493
accepted answer: http://stackoverflow.com/a/25425059
downvote count: 0
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/39662570
has answer: http://stackoverflow.com/a/25425059
favorite count: 0
type: Question
tagged with: nullpointerexception
has body: I'm getting this error message when im starting my Java application: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at engine.Display.GamePanel.paintComponent(GamePanel.java:102) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JLayeredPane.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paintToOffscreen(Unknown Source) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) at javax.swing.RepaintManager.paint(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source) at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source) at sun.awt.SunGraphicsCallback.runComponents(Unknown Source) at java.awt.Container.paint(Unknown Source) at java.awt.Window.paint(Unknown Source) at javax.swing.RepaintManager$3.run(Unknown Source) at javax.swing.RepaintManager$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.access$1100(Unknown Source) at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$400(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java…
has answer: http://stackoverflow.com/a/25424935
has title: "AWT-EventQueue-0" NullpointerException inconsistent error message
tagged with: java
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/39662623
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25424935
answer count: 2
score: 1

http://stackoverflow.com/a/25545196
score: 0
has comment: http://stackoverflow.com/comment/40286838
has comment: http://stackoverflow.com/comment/40264501
answers question: http://stackoverflow.com/q/25406985
has comment: http://stackoverflow.com/comment/40287426
has comment: http://stackoverflow.com/comment/39989826
type: Answer
has comment: http://stackoverflow.com/comment/40026452
has comment: http://stackoverflow.com/comment/40066483
has body: The portletSession.APPLICATION_SCOPE mechanism makes it possible for portlets to share session data if they are within the same portlet application. If you have two portlets that are not in the same war they are not in the same portlet application and thus, the session data is not shared either. To solve this you need to put the two portlets into the same portlet application (same war, same portlet.xml but still two different portlets).
has comment: http://stackoverflow.com/comment/39995879

http://stackoverflow.com/comment/39651644
comment on: http://stackoverflow.com/a/25417571
type: AnswerComment
has text: what you mean <cough>bar.setBounds<cough>?
score: 0
type: Comment

http://stackoverflow.com/comment/39739187
type: QuestionComment
has text: Try `new File(MyClass.class.getResource(resource).getPath()).toURI()` or `new File(MyClass.class.getClassLoader().getResource(resource).getPath()).toURI()`
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25465542

point
type: Tag
tag name: point
tags question: http://stackoverflow.com/q/25390590
tags question: http://stackoverflow.com/q/25496349

http://stackoverflow.com/a/25403624
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25403314
type: Answer
has body: You create only one list in your code, so all elements will be added to this same list. Instead, create a new list for each new parentLineNo. if(!mapParentAndChildLines.containsKey(parentLineNo)){ // Create a new list to add in the map lsChildLine = new ArrayList(); lsChildLine.add(childLine); mapParentAndChildLines.put((parentLineNo), lsChildLine); }else{ lsChildLine = mapParentAndChildLines.get(parentLineNo); lsChildLine.add(childLine); // Unnecessary, the list is already in the map // mapParentAndChildLines.put((parentLineNo), lsChildLine); }
accepted answer of: http://stackoverflow.com/q/25403314
has comment: http://stackoverflow.com/comment/39623952

http://stackoverflow.com/comment/39626750
has text: You are right. I printed the value after updating it and it was still the same. But even with this change, it is still not saved. See my second edit.
type: Comment
comment on: http://stackoverflow.com/a/25395595
score: 0
type: AnswerComment

http://stackoverflow.com/q/25407097
has comment: http://stackoverflow.com/comment/39630682
score: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25407368
has comment: http://stackoverflow.com/comment/39630295
has comment: http://stackoverflow.com/comment/39630491
has answer: http://stackoverflow.com/a/25407262
type: Question
upvote count: 2
has body: I've asked before but received no helpful responses. I've got a method. I want to update the UI through the method. I've tried running the code on the UI thread, I've tried posting the code (.post[...]), I've tried creating threads but nothing works. Here's a simplified version of my code: int x; for(int i = 0; i &lt; times; i++){ if((i % 2) == 1){ x += (x / (x * 0.5)); } else { x += (x / (x * 0.25)); } while((System.currentTimeMillis() - t) &lt; 2000){ // wait } runOnUiThread(new Runnable(){ @Override public void run(){ btn.setText(x.toString()); } } } // The for loop won't update the UI until the entire method has finished. Like I said, creating a new thread/running on UI thread/posting doesn't help. How can I update the UI while a method is running? For some reason the UI will wait until the method has finished.
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39630364
has comment: http://stackoverflow.com/comment/39630372
has answer: http://stackoverflow.com/a/71282782
has title: Android - updating UI while running a task?
has answer: http://stackoverflow.com/a/25407380
answer count: 4
tagged with: java
tagged with: multithreading

http://stackoverflow.com/a/25474412
score: 1
downvote count: 0
type: Answer
upvote count: 1
has body: Looking to jira.codehaus.org/browse/EASYMOCK-108 they added Android support to run test with easymock as part of instrumental tests. My suggestions: silly - if you really don't need 3.2 stay on 3.1 if you use maven or gradle - examine dependencies for easymock and try exlude "dexmaker" another silly - use mockito
answers question: http://stackoverflow.com/q/25457144

http://stackoverflow.com/q/25471810
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25471929
tagged with: multithreading
has comment: http://stackoverflow.com/comment/39751250
has title: How do I solve this multitasking scenario with respect to long task interruption?
answer count: 4
has answer: http://stackoverflow.com/a/25472052
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25471939
score: 0
has comment: http://stackoverflow.com/comment/39750920
has body: Ok, I was asked this multi-threading question in an interview. The question was something like this public class Job { static boolean interruptTask = false; private static class Mytask extends Thread{ @Override public void run() { while(!interruptTask){ //do some time consuming thing until interruption like looping over millions of times } } } public static void main(String[] args) throws InterruptedException { Mytask t = new Mytask(); t.run(); Thread.sleep(1000); interruptTask=true; t.join(); System.out.println("end"); } } Question statement What is wrong with this code snippet and how will you fix it. I was able to identify the problem here. The problem in my opinion is that even when we make the interrupttask variable true in the main function, it does not interrupt the thread. The thread will keep on doing until its long time taking execution is not over. But I can't figure out the solution for this problem? I mean, we have tools like wait,notify for thread, but I don't those are somethings we can use here. What should be the approach to resolve this particular issue in this scenario? Can anyone help me figure out the solution of this problem? or some guidance regarding how should I go about for the solution?
linked to: http://stackoverflow.com/q/106591
has answer: http://stackoverflow.com/a/25471939
possible better answer: http://stackoverflow.com/a/25471867
tagged with: java
has comment: http://stackoverflow.com/comment/39750958
has comment: http://stackoverflow.com/comment/39750901
has answer: http://stackoverflow.com/a/25471867
upvote count: 1
has comment: http://stackoverflow.com/comment/39750999
downvote count: 1

aes
tag name: aes
tags question: http://stackoverflow.com/q/25505870
type: Tag

http://stackoverflow.com/a/25468004
has comment: http://stackoverflow.com/comment/39749621
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25466921
has comment: http://stackoverflow.com/comment/39752576
has comment: http://stackoverflow.com/comment/39753158
has body: Just make your ListView a TextView, then when you databind the TextView in Java, called the .setText() method on the TextView. Also, since you're setting the limit of your query to 1, you don't need to order your query. The line query.orderByDescending("Name");is unnecessary
downvote count: 0
score: 1

http://stackoverflow.com/comment/39827392
comment on: http://stackoverflow.com/a/25510965
type: Comment
score: 0
type: AnswerComment
has text: Sorry Mr. Roman C, I am new here.. i clicked on up arrow button. please check it once it accepted or not..

http://stackoverflow.com/q/25545712
tagged with: license-key
upvote count: 1
has comment: http://stackoverflow.com/comment/39973928
type: UnansweredQuestion
has title: Saxon-PE or Saxon-EE license not found
has body: We have a web application hosted on google app engine which main task is to do xslt processing using saxon. We obtained a license for the use of the saxon processor and placed the saxon-license.lic file next to the saxon9pe.jar file in the WEB-INF/lib directory. Everything is working great for years without any problems. But lately we sometimes are getting the following error: XPST0017 XPath syntax error at char 0 on line 23 in {saxon:parse($component)}: Cannot find a matching 1-argument function named {http://saxon.sf.net/}parse(). Saxon extension functions require a Saxon-PE or Saxon-EE license When I shut down the instance thats causing the problem, the error is solved and the app works for a few hours or days again. It's almost like google appengine is "loosing" the license file during the life span of an instance. Any idea what the underlying problem can be? Is there another way to pass the license file to the saxon server as a workaround? Thank you!
tagged with: xslt
has comment: http://stackoverflow.com/comment/39949803
has comment: http://stackoverflow.com/comment/39973848
has comment: http://stackoverflow.com/comment/40086161
has comment: http://stackoverflow.com/comment/40475138
tagged with: java
tagged with: saxon
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40063911
type: Question
tagged with: google-app-engine
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/39630618
type: Comment
has text: The other thing you could try is changing the package name, that way your not dealing with anything related the original app.
type: AnswerComment
comment on: http://stackoverflow.com/a/25407024
score: 0

http://stackoverflow.com/comment/39878286
comment on: http://stackoverflow.com/q/25540739
type: Comment
has text: an array of Foo interface
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39769621
type: AnswerComment
comment on: http://stackoverflow.com/a/25481962
has text: @PankajKumar Thank you so much! I'm gonna make this answer correct when the time expires. You are a hero!
type: Comment
score: 0

http://stackoverflow.com/comment/39691811
type: AnswerComment
score: 1
type: Comment
has text: from an FP perspective, mutating stuff and doing `list.add()` feels pretty wacky. From an OO perspective, while this example is clearly more readable than the OP's, it's still lagging far behind LINQ, where you would use `OfType<T>()` instead of that reflection thing.
comment on: http://stackoverflow.com/a/25439912

http://stackoverflow.com/a/25477533
upvote count: 2
has comment: http://stackoverflow.com/comment/39761804
has comment: http://stackoverflow.com/comment/39762006
has comment: http://stackoverflow.com/comment/39761562
has comment: http://stackoverflow.com/comment/39761666
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39761548
downvote count: 0
has comment: http://stackoverflow.com/comment/39794750
has comment: http://stackoverflow.com/comment/39761477
answers question: http://stackoverflow.com/q/25477428
has body: The variable toServer is null. While it is initialized in the constructor, the JFrame is made visible for the user prior to the initialization of toServer. What likely happens is that the Client instance cannot set up the connection to the server and new Socket("ip address of computer running server window", 8000) is blocked, and will eventually time out. However the UI is already running and a user can trigger requests already. When the connection to the server succeeds the NPE does not occur and everything works fine. A simple test would be to move the line setVisible(true); to after the initialization of toServer, in which case the Client Ui will only be shown when the connection succeeds and toServer is not null.

http://stackoverflow.com/a/25458695
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25458599
answers question: http://stackoverflow.com/q/25458599
has comment: http://stackoverflow.com/comment/39899598
score: 1
has body: First, please read Java naming conventions. You need to pass the reference of MainMenu to PersonalInfo in order to achieve what you need, here: button1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent a){ PersonalInfo objPI = new PersonalInfo(this); objPI.menu1(); button1.setEnabled(false); } }); And you need to add a constructor to PersonalInfo: private MainMenu m; public PersonalInfo(MainMenu m) { this.m = m; } Add a public method to MainMenu: public void enableMyButton() { button1.setEnabled(true); } Now you can add an event listener to PersonalInfo to enable the button of the MainMenu frame: frame1.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { this.m.enableMyButton(); } });
has comment: http://stackoverflow.com/comment/39729791
type: Answer
has comment: http://stackoverflow.com/comment/39755741

http://stackoverflow.com/comment/39744313
type: Comment
type: QuestionComment
score: 0
has text: Please provide a **complete** code example which reproduces the error exactly. The code you have given does not have a class or method which causes other compiler errors other than what you are asking about. Also, the code given does not match the code shown in the error message.
comment on: http://stackoverflow.com/q/25468325

http://stackoverflow.com/q/25447558
has comment: http://stackoverflow.com/comment/39705102
has answer: http://stackoverflow.com/a/25590804
has answer: http://stackoverflow.com/a/25463363
accepted answer: http://stackoverflow.com/a/25586807
has title: Java/Bukkit - Check if a player bumped into a wall
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25586807
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/39728704
has body: I'm making a Bukkit plugin and I want to run a piece of code when a player touches a wall(with his body, not with the cross hair!) So, I think that this is possible with a PlayerMoveEvent. The question is, how. A few notes: If the player looks at an other direction and he walks into a wall, I want to run the same code The player has to touch the wall with his body, not with his cross hair I really can't figure this out and I couldn't find this on the web. You guys are my last hope ;) Thanks in advance, Bram
tagged with: java
possible better answer: http://stackoverflow.com/a/25463363
tagged with: bukkit
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39704789

http://stackoverflow.com/q/25463606
type: UnansweredQuestion
tagged with: java
downvote count: 0
tagged with: square-tape
favorite count: 0
type: Question
has title: Dagger to Inject a retrofit's service in a tape Task
has comment: http://stackoverflow.com/comment/39737518
has body: I have a retrofit service : public interface MyService { @POST("/dosomething") String doSomething(@Part("param") MyType param); } and in a dagger module : @Provides @Singleton MyService provideService(RestAdapter restAdapter){ return restAdapter.create(MyMeService.class); } //note that restAdapter is also provided by that module. and in a Tape task i'm using that service, I tried : public class MyTask implements Task&lt;MyTask.Callback&gt; { //... omitted for brevity @Inject MyService mService; @Override public void execute(final Callback callback) { new Thread(new Runnable() { @Override public void run() { mService.doSomething(new MyType(...)); //... } } } but with this mService is always null. although MyTask is already added in module's @Module( injects = {...}). So i tried passing context in task's constructor and injecting my task with something like : MyApplication.get(context).inject(this); But still got mService always null. Also when injecting MyService instead in my activity and making it just a field in MyTask and then passing it already created. since MyTask is a Tape task (square's tape library) it fails (understandably) when serializing it with: Caused by: java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: MyService. Forgot to register a type adapter? So is there a way to inject retrofit service class correctly in a Tape Task ? I'm not sure i explained correctly .. i can provide additional information if needed. Thanks.
has comment: http://stackoverflow.com/comment/39737663
tagged with: android
tagged with: dagger
score: 2
tagged with: retrofit
answer count: 0
has comment: http://stackoverflow.com/comment/42281336
upvote count: 2

http://stackoverflow.com/comment/39747205
type: Comment
has text: Oh my. They **can** be under a path containing a space. BTW, your example shows that they are. The windows command prompt simply expects such space-containing paths to be surrounded by double quotes, since a space normally ends an argument and starts a new one. Why do you answer your own question instead of accepting the correct ones from people who have spent time helping you?
type: AnswerComment
comment on: http://stackoverflow.com/a/25469883
score: 2

http://stackoverflow.com/q/25482502
tagged with: android-intent
has comment: http://stackoverflow.com/comment/39771952
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39770661
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/39770531
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25482604
has comment: http://stackoverflow.com/comment/39770852
has answer: http://stackoverflow.com/a/25482849
tagged with: android-activity
accepted answer: http://stackoverflow.com/a/25482849
has title: Getting null pointer exception while getting image from another activity in android
has answer: http://stackoverflow.com/a/25482821
has answer: http://stackoverflow.com/a/25482604
favorite count: 0
type: Question
tagged with: android-layout
downvote count: 0
has body: I have made a Custom List View in android. And i want that Whenever list view click event called it goes into another activity and the data which is on that list will be displayed on new activity. Below code is my Like MainActivity(Here named as ListofWorkers) which have also Layout file. package com.example.dispatchmedemo; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.view.Menu; import java.util.ArrayList; import java.util.List; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Button; import android.widget.ListView; import android.widget.Toast; import com.example.dispatchmedemo.CustomListViewAdapter; import com.example.dispatchmedemo.RowItem; public class ListofWorkers extends Activity { public static final String[] name = new String[] { "ABC", "YZA", "ASDSA", "ASD", "ASD", "SDFS" }; public static final String[] landmarks = new String[] { "AFDDF", "ADF", "ADFD", "ADFAD", "ADFADF", "ADFAD" }; public static final String[] rates = new String[] { "100", "500", "300", "400", "120", "600" }; public static final Integer[] images = { R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher }; ListView listView; List&lt;RowItem&gt; rowItems; Button responseSubmit; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_listof_workers); rowItems = new ArrayList&lt;RowItem&gt;(); for (int i = 0; i &lt; name.length; i++) { RowItem item = new RowItem(images[i], name[i], landmarks[i], rates[i]); rowItems.add(item); } listView = (ListView) findViewById(R.id.list); CustomListViewAdapter adapter = new CustomListViewAdapter(this, R.lay…
tagged with: android
has comment: http://stackoverflow.com/comment/39770953
has comment: http://stackoverflow.com/comment/39770653

http://stackoverflow.com/q/25511062
score: -1
has title: Java Jframe is closing with all keyboard inputs
tagged with: keylistener
upvote count: 0
tagged with: keyevent
tagged with: java
has answer: http://stackoverflow.com/a/25511111
has answer: http://stackoverflow.com/a/25511687
linked to: http://stackoverflow.com/q/23486827
has answer: http://stackoverflow.com/a/25511128
accepted answer: http://stackoverflow.com/a/25511687
tagged with: swing
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/15290035
has comment: http://stackoverflow.com/comment/39824161
type: Question
type: AnsweredQuestion
has body: Jframe is closing to any input from keyboard just need it to close when user input escape key. Unable to find similar examples if known issue exist please provide link. package jframe_no_decoration; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.*; import javax.swing.*; import javax.swing.JFrame; import javax.swing.WindowConstants; public class Jframe_no_decoration { public static void main(String args[]) { int FrameWidth = 400; int FrameHeight = 350; JFrame frame = new JFrame (); frame.setResizable(false); frame.setBounds(0, 0, FrameWidth, FrameHeight); frame.setLocationRelativeTo(null); frame.setUndecorated(true); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setVisible(true); frame.getContentPane().setBackground(Color.black); frame.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if( e.getKeyCode() == KeyEvent.VK_ESCAPE); System.exit(0); } }); } } Jframe is closing to any input from keyboard just need it to close when user input escape key. Unable to find similar examples if known issue exist please provide link.
linked to: http://stackoverflow.com/q/21253405
has answer: http://stackoverflow.com/a/25511110
possible better answer: http://stackoverflow.com/a/25511110
tagged with: jframe
answer count: 5
has answer: http://stackoverflow.com/a/25518392
has comment: http://stackoverflow.com/comment/39824638

http://stackoverflow.com/comment/39712700
score: 0
has text: Following the api reference ljgw linked, an eventhandler not only should not return an object but **must** be a void, I would say.
comment on: http://stackoverflow.com/q/25444688
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39860132
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25530382
has text: "Access modifiers" in Java are a bit confusing and not especially "regular". There's `public`, `private`, `protected`, and "no modifier". `public` can be accessed from anywhere, `private` only from within the same class, `protected` from a subclass, and "no modifier" from any class in the same "package".
score: 1

http://stackoverflow.com/a/25550357
has body: You're setting the exampleString variable in the onClick method. When you call the new activity in the onClick method, you're in fact creating a new instance of Activity2. Why should this new instance have a value in exampleString if you never set it there? Inheritance is a good way to extend functionality and data from a super class to a sub class, but it by no means allows separate instances to share the same data. Since in your second instance you never set the exampleText, your log print-out shows null.
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/25550225
upvote count: 1
score: 0

http://stackoverflow.com/comment/39729082
score: 0
type: Comment
has text: Thought this would be the case. So essentially there is no way round it? I cannot use ColorProcessor in my application?
type: AnswerComment
comment on: http://stackoverflow.com/a/25459991

http://stackoverflow.com/a/45762228
score: 0
answers question: http://stackoverflow.com/q/25484616
has body: Maybe this: static BigInteger multiply(BigInteger c, BigInteger x) { BigInteger sum = BigInteger.ZERO; BigInteger addOperand; for (int i=0; i &lt; FIELD_ELEMENT_BIT_SIZE; i++) { if (c.testBit(i)) addOperand = x; else addOperand = BigInteger.ZERO; sum = add(sum, addOperand); x = x.shiftRight(1); } return sum; } with the following helper functions: static BigInteger add(BigInteger a, BigInteger b) { return modOrder(a.add(b)); } static BigInteger modOrder(BigInteger n) { return n.remainder(FIELD_ORDER); } To be honest though, I'm not sure if this is really efficient at all since none of these operations are performed in-place.
type: Answer

http://stackoverflow.com/comment/39878394
type: Comment
has text: Hi, what if I hope the max lengh(larger length of this two String) to be a param? Can I just replace the -4 in to "-"+n?
type: AnswerComment
comment on: http://stackoverflow.com/a/25540774
score: 0

http://stackoverflow.com/comment/39660437
comment on: http://stackoverflow.com/a/25423318
type: Comment
type: AnswerComment
score: 1
has text: @larsmans Not really. If you program against the base class `Set<T>`, you'll have to check whether the set is mutable before trying to add any items - the documentation is clear on that. If I then give you a `HashSet<T>`, your code will work. If I then replace the `HashSet<T>` with an `ImmutableSet<T>`, your code will *still* work. The LSP holds. It's just a design flaw.

http://stackoverflow.com/a/25455593
has comment: http://stackoverflow.com/comment/120761613
has body: How to handle serializability was one of the biggest challenges for the EG; suffice it to say that there were no great solutions, only tradeoffs between various downsides. Some parties insisted that all lambdas be automatically serializable (!); others insisted that lambdas never be serializable (which seemed an attractive idea at times, but sadly would badly violate user expectations.) You note: Well, another solution is to never use lambda expressions/method references in security relevant code, In fact, the serialization spec now says exactly that. But, there is a fairly easy trick to do what you want here. Suppose you have some library that wants serializable instances: public interface SomeLibType extends Runnable, Serializable { } with methods that expect this type: public void gimmeLambda(SomeLibType r) and you want to pass lambdas into it, but not have them be serializable (and take the consequences of that.) So, write yourself this helper method: public static SomeLibType launder(Runnable r) { return new SomeLibType() { public void run() { r.run(); } } } Now you can call the library method: gimmeLambda(launder(() -&gt; myPrivateMethod())); The compiler will convert your lambda into a non-serializable Runnable, and the laundering wrapper will wrap it with an instance that satisifies the type system. When you try to serialize it, that will fail since r is not serializable. More importantly, you can't forge access to the private method, because the $deserializeLambda$ support that's needed in the capturing class won't even be there.
has comment: http://stackoverflow.com/comment/87969789
type: AcceptedAnswer
downvote count: 0
upvote count: 40
has comment: http://stackoverflow.com/comment/39814951
answers question: http://stackoverflow.com/q/25443655
has comment: http://stackoverflow.com/comment/39818173
type: Answer
accepted answer of: http://stackoverflow.com/q/25443655
score: 40
has comment: http://stackoverflow.com/comment/39818783

http://stackoverflow.com/comment/39615743
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25398374
has text: There's a whole bunch of alternate JVMs: https://en.wikipedia.org/wiki/List_of_Java_virtual_machines
type: QuestionComment

http://stackoverflow.com/q/25426101
has comment: http://stackoverflow.com/comment/39665109
has body: I'm using this query: SELECT rank FROM (SELECT @rank:=@rank+1 AS rank, score_id From Model_Score where model_id = ? ORDER BY score_id ) AS X JOIN (SELECT @rank := 0) AS Y where X.score_id = ? I need to get the row of the element that match the condition model and score. In my java class I'm using this: return getJdbcTemplate().queryForObject(sqlCommand, new Object[] {model_id, score_id}, Integer.class); but it generates a null point exception. Is it possible that the "@rank" token is the main cause? thanks, Andrea -- Stacktrace 02:17:38,793 PM CEST ERROR ModelDaoMySql @ getLevelOfRecommendation [456] Unable to getLevelOfRecommendation(model: 10, score_id: 17) - java.lang.NullPointerException java.lang.NullPointerException at com.mediresource.datatype.model.database.mysql.ModelDaoMySql.getLevelOfRecommendation(ModelDaoMySql.java:437) at com.mediresource.datatype.question.PEAQFactory.getPeaqModels(PEAQFactory.java:442) 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.mediresource.container.BOContentFactory.callReflectionGetContent(BOContentFactory.java:888) at com.mediresource.container.BOContentFactory.generateWidget(BOContentFactory.java:496) at com.mediresource.container.BOContentFactory.fillContent(BOContentFactory.java:458) at com.mediresource.container.BOContentFactory.getBOContent(BOContentFactory.java:387) at com.mediresource.container.BOContentFactory.getBOContent(BOContentFactory.java:410) at com.mediresource.container.BOContentFactory.getBOContent(BOContentFactory.java:410) at com.mediresource.container.BOContentFactory.getBOContent(BOContentFactory.java:261) at com.mediresource.test.application.ManulifePEAQ.test_PEAQ(ManulifePEAQ.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.Na…
tagged with: jdbctemplate
type: Question
has comment: http://stackoverflow.com/comment/39665421
has title: Return row position with Spring getJdbcTemplate()
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39665541
has comment: http://stackoverflow.com/comment/39665723
tagged with: spring
has comment: http://stackoverflow.com/comment/39665296
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39665482
tagged with: java
tagged with: spring-data
tagged with: mysql

http://stackoverflow.com/a/25435376
type: Answer
answers question: http://stackoverflow.com/q/25418243
downvote count: 0
score: 1
upvote count: 1
has body: As you said "It would have been better and more sensible to use the regex to detect the characters that can be entered rather than testing for characters that can't be entered." So you can just do the reverse checking then : import javax.swing.*; import java.util.regex.*; public class ValidateJOptionPane { public static void main(String[] args) { String input = JOptionPane.showInputDialog("Enter number: "); Pattern p = Pattern.compile("^[0-9]*$"); Matcher m = p.matcher(input); if (!m.find()) { // if pattern doesn't match (not found) JOptionPane.showMessageDialog(null, "Please enter only numbers"); } } } [0-9] means digit 0-9 while * means some spaces
has comment: http://stackoverflow.com/comment/39691079

http://stackoverflow.com/a/25505137
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39813002
downvote count: 0
has comment: http://stackoverflow.com/comment/39812844
answers question: http://stackoverflow.com/q/25505091
score: 3
has comment: http://stackoverflow.com/comment/39812979
type: Answer
has body: Try this: String response = new String(responseBody, "UTF-8"); text.setText(response); System.out.println("text set: " + text.getText().toString()); That might help.
accepted answer of: http://stackoverflow.com/q/25505091
upvote count: 3

http://stackoverflow.com/q/25550535
accepted answer: http://stackoverflow.com/a/25552425
answer count: 2
has answer: http://stackoverflow.com/a/25552425
has body: I'm writing Eclipse plugin. One of many features is create Tree with File Attributes like .java files have (if you click on .java File in Eclipse you can see whole list with what classes or methods this file have). I can create this tree with separate view, it isn't problem (I have data,using TreeViewer and everything works great), but now I must create this tree in Project Explorer View and I don't know how. Maybe should I write because it isn't obviously. This tree won't be display with .java file but with .txt file. So read about this. What I know for now: I should have org.eclipse.ui.decorators extension point. I already have it My class should extends LabelProvider implements ILightweightLabelDecorator . It already has it Also I can get access to already selection File , Project , Folder (by using decorate() method). I can add prefix/suffix to already select file ,add icons into File but... I'm not seeing any methods what give me possibility add any attributes to file.
has answer: http://stackoverflow.com/a/25604818
tagged with: plugins
has comment: http://stackoverflow.com/comment/39902978
tagged with: treeviewer
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/25604818
tagged with: java
tagged with: eclipse
has title: Eclipse, own TreeViewer with file attributes in Project Explorer View
type: Question

http://stackoverflow.com/comment/39705865
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25447981
type: AnswerComment
has text: Ah, I wasn't aware about `clone()`'s special case. As to deserialization I figured a default constructor was invoked and reflection used to fill its values, but I never explicitly looked into it.

http://stackoverflow.com/q/25492100
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39789294
tagged with: regex
has title: using String split() method with non-white space regex
tagged with: string
duplicate of: http://stackoverflow.com/q/22259733
type: Question
has comment: http://stackoverflow.com/comment/39789209
accepted answer: http://stackoverflow.com/a/25492182
has answer: http://stackoverflow.com/a/25492182
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22259733
has body: I am trying to figure out how it works, I tried several different examples and I just don't uderstand the results I'm getting. fot example using it on string such as: String s1 = "Hello there how are you"; String [] sa1 = s1.split("\\s"); will return array with 5 elements which are obvious and this makes sense to me. How about this: String s1 = "Hello there how are you"; String [] sa1 = s1.split("\\S"); returns array of 17 empty strings... Could someone help me understanding it please?
score: 0

http://stackoverflow.com/q/25425828
answer count: 1
tagged with: jpa
downvote count: 0
tagged with: criteria-api
favorite count: 0
type: Question
has body: Lets say we have 2 mapped and related entities: Foo -> Bar. Foo holds the FK to the Bar. The point is, that using JPA Criteria Api I need to INNER JOIN these tables and fetch all Bar entities. How can I achieve that without mapping declaring reverse relation?
has title: JPA Criteria - Fetch child entities instead of root
accepted answer: http://stackoverflow.com/a/25427238
has comment: http://stackoverflow.com/comment/39664747
has answer: http://stackoverflow.com/a/25427238
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/9802717
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/39754771
type: Comment
comment on: http://stackoverflow.com/a/25473962
score: 0
type: AnswerComment
has text: Thank you for the suggestion, that worked. Why did my previous method not work? @Lucas

http://stackoverflow.com/comment/39886752
comment on: http://stackoverflow.com/a/25545703
type: AnswerComment
has text: Android, sadly, does not support `pre` tags. Source: http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html
type: Comment
score: 0

http://stackoverflow.com/comment/79059647
type: Comment
has text: @stanicmail - check out my answer
type: QuestionComment
comment on: http://stackoverflow.com/q/25420598
score: 0

http://stackoverflow.com/comment/39834166
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25515941
has text: You try to help people and that's what you get. For you info **Hovercraft Full Of Eels** you need +50 rep to add comments.
score: 0

http://stackoverflow.com/q/25405139
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/13539814
has comment: http://stackoverflow.com/comment/39674978
type: UnansweredQuestion
has body: I am using Javafx, I have a Inputstream of video data. How can i play this video stream directly in video player? Media class constructor takes String object only and The supplied URI must conform to RFC-2396 as required by java.net.URI. Only HTTP, FILE, and JAR URIs are supported. I have H.264 ACC video stream.
has comment: http://stackoverflow.com/comment/39650866
has title: play video from input stream in javafx
tagged with: desktop
answer count: 0
score: 1
tagged with: java
tagged with: javafx
downvote count: 0
duplicate of: http://stackoverflow.com/q/13539814
upvote count: 1

http://stackoverflow.com/q/25471597
has comment: http://stackoverflow.com/comment/39750662
accepted answer: http://stackoverflow.com/a/25471852
has comment: http://stackoverflow.com/comment/39750641
has comment: http://stackoverflow.com/comment/39750587
type: AnsweredQuestion
score: 0
has title: Alternate to print greater than (>) symbol in Ubuntu
has comment: http://stackoverflow.com/comment/39750602
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39750553
tagged with: ubuntu-13.04
has answer: http://stackoverflow.com/a/25471852
has body: May be this question is too easy but it took a lot my time but I could not figure out. I am trying to execute echo command in which I am trying to append some data in a text file. Everything works when run in terminal but when I try to run it through Runtime.getRuntime().exec("echo my text &gt;&gt; file.txt"), then >> does not work. Is there any way to give code or something so that this command should work? I tried &amp;gt; but it did not work for me.
type: Question
tagged with: terminal

http://stackoverflow.com/q/25492337
score: 0
tagged with: android
tagged with: java
type: Question
tagged with: android-viewpager
has body: I have music background in my app.. and want to stop the music when user reaches the last image in my app. If possible, I would like to make the last image to be name as "last" so that it will be better for code and when it recognize that image name "last" is reached it should be able to stop the music ...or it will be great if the music stops smoothly when last image in my app is reached by viewer..Any idea on how to do that ? Following are my codes... Mainactivity.java import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.view.Menu; import android.view.MenuItem; import android.widget.ShareActionProvider; public class MainActivity extends Activity { MediaPlayer oursong; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); oursong = MediaPlayer.create(MainActivity.this, R.raw.a); oursong.start (); ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); ImageAdapter adapter = new ImageAdapter(this); viewPager.setAdapter(adapter); } private ShareActionProvider mShareActionProvider; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate menu resource file. getMenuInflater().inflate(R.menu.activity_main, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_item_share); // Fetch and store ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider(); // Return true to display menu return true; } // Call to update the share intent private void setShareIntent(Intent shareIntent) { if (mShareActionProvider != null) { mShareActionProvider.setShareIntent(shareIntent); } } @Override protected void onPause(){ super.onPause(); oursong.release(); } } Imageadapter.java import java.io.IOException; import android.app.WallpaperManager; import android.content.Context; import android.support.v4.v…
answer count: 1
linked to: http://stackoverflow.com/q/7283928
accepted answer: http://stackoverflow.com/a/25493170
has title: How to stop music background when specific image is reached?
linked to: http://stackoverflow.com/q/6884590
has answer: http://stackoverflow.com/a/25493170
type: AnsweredQuestion

http://stackoverflow.com/q/25486539
upvote count: 2
type: UnansweredQuestion
tagged with: arrays
tagged with: string
downvote count: 1
tagged with: excel
has comment: http://stackoverflow.com/comment/39777629
has comment: http://stackoverflow.com/comment/39777680
has title: Convert Excel Column into String array
has comment: http://stackoverflow.com/comment/39777708
has comment: http://stackoverflow.com/comment/39777740
has body: I have a column of words in Excel and i want to convert it to a string array, it is a long list and i can't do it manually. How can i do it? My excel is like: Car House Key Phone ... I want my array to be like: "Car","House","Key","Phone",... Thanks in advance.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/39777910
has comment: http://stackoverflow.com/comment/39777850
has comment: http://stackoverflow.com/comment/39777791
has comment: http://stackoverflow.com/comment/39778035
has comment: http://stackoverflow.com/comment/39777660
has comment: http://stackoverflow.com/comment/39777620
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25487059
has answer: http://stackoverflow.com/a/77993727
linked to: http://stackoverflow.com/q/6773232
answer count: 2

http://stackoverflow.com/a/25484321
score: 3
upvote count: 3
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39775412
has comment: http://stackoverflow.com/comment/39775322
has comment: http://stackoverflow.com/comment/39775467
accepted answer of: http://stackoverflow.com/q/25484036
has body: You are obviously living in Ireland with a daylight saving time of +1 hour in summer. That means, your time 12:00h IST corresponds to 11:00h GMT. And consequently that means: Your assumption will become true at 12:00h local time. I tested it with this little program and a daylight savin time of +2 hours against GMT (in Germany): public class Time { public static void main(String[] args) { String ANNOUNCEMENT_DATE1 = "Mon, 25-Aug-2014 10:00:00 GMT"; String ANNOUNCEMENT_DATE2 = "Mon, 25-Aug-2014 11:00:00 GMT"; DateFormat df = new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss z", Locale.ENGLISH); Date announcementDate1 = null; Date announcementDate2 = null; try { announcementDate1 = df.parse(ANNOUNCEMENT_DATE1); announcementDate2 = df.parse(ANNOUNCEMENT_DATE2); } catch (ParseException e) { e.printStackTrace(); } long now = System.currentTimeMillis(); System.out.println(now >= announcementDate1.getTime()); System.out.println(now >= announcementDate2.getTime()); } } Running that on 12:54 (local time) results in the following output: true false
answers question: http://stackoverflow.com/q/25484036
type: Answer

http://stackoverflow.com/q/25412021
tagged with: android
tagged with: java
has body: I am trying distinguish if a notification was opened from the watch or the phone. Currently I am trying to set the contentIntent for the notification builder which also appears on the watch as an "Open on phone" action. I want to be able to set a different intent just for the watch so that I can add other parameters to the intent, but I cannot find the right way to do it. NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context); notificationBuilder .setContentTitle(contentTitle) .setContentText(contentText) .setContentIntent(contentIntent) .extend(wearableExtender) I've tried to add a wearable extender and the action for "Open on Phone" stopped working. I want to know if there is a way to disable the "Open on Phone" button for the wearables and still maintain a setContentIntent() for the phone notification? I've also tried setContentAction() on the extender and "Open on Phone" button, but it still doesn't work. Any ideas on how to get this working?
upvote count: 4
has answer: http://stackoverflow.com/a/25414869
type: UnansweredQuestion
answer count: 1
downvote count: 0
tagged with: android-intent
score: 4
favorite count: 0
has title: Android Wear modify "Open on Phone" button intent
tagged with: wear-os
type: Question
tagged with: android-wear-data-api

http://stackoverflow.com/comment/39682640
has text: Use what you find the clearer and easier to read.
type: Comment
comment on: http://stackoverflow.com/q/25435056
score: 1
type: QuestionComment

http://stackoverflow.com/comment/39725879
has text: Whats the problem with the banner its just a tool. Main aim is to code. And get the job done. Don't waste ur time in these stupid things
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25458221

http://stackoverflow.com/comment/39891219
type: AnswerComment
has text: Well you could go with only angles and get the trajectory changes with their signe but that would mean you have to rethink your range of angles [0-180] isn't enough and you need a range of [0-360], you can also keep your trajectories and put an abs() on cosine. For the angles you'd have to put an offset determined by the side the ball just hits, it might be, 90° for RIGHT, 180° for TOP, 270° for LEFT and 0 for BOTTOM, you won't have to bother with x_traj and y_traj anymore.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25523576

http://stackoverflow.com/a/25500222
has comment: http://stackoverflow.com/comment/39807913
answers question: http://stackoverflow.com/q/25499835
has comment: http://stackoverflow.com/comment/39805698
has comment: http://stackoverflow.com/comment/39804269
score: 0
has comment: http://stackoverflow.com/comment/39807472
type: Answer
has body: List m = c.list(); for(Iterator it = c.iterator(); it.hasNext()) { Object[] row = (Object[]) it.next(); System.out.println("-&gt; All entity metadata for GUID: " + row[0] + " : " +row[1]); }

http://stackoverflow.com/comment/39803044
comment on: http://stackoverflow.com/a/25499559
type: Comment
score: 0
type: AnswerComment
has text: @ Nikhil yes sorry i pass intent directly in pendingIntent ..now i modified it

http://stackoverflow.com/comment/39716888
has text: If you need a GUI for Quartz, you can use QuartzDesk or an alternative product that allows you to remotely connect to your Quartz scheduler instance and manage it.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25426452
score: 0

http://stackoverflow.com/q/25399933
tagged with: reverse
tagged with: deque
possible better answer: http://stackoverflow.com/a/25400063
tagged with: queue
has comment: http://stackoverflow.com/comment/39617013
accepted answer: http://stackoverflow.com/a/25400267
has answer: http://stackoverflow.com/a/25400080
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25400063
has answer: http://stackoverflow.com/a/25400267
answer count: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/39616991
linked to: http://stackoverflow.com/q/683041
has title: How to add an element in front of Queue in java?
downvote count: 0
has body: I am using Queue&lt;T&gt; q1 and I know that an element will be added using q1.offer(); at the end of the queue. But now, what I want to do is add an element in front of queue, which is not possible with Queue. The possible methods I could think of are Use of double ended queue and I can add the elements in front and at the end. reverse the q1, add the element at the end of the queue and reverse again. Now, as a non-programmer guy, I am not sure, how to code these methods; which one is more economical and easier to do. Problems I faced in 1) is transform of existing Queue to Deque and vice versa; and in 2) How to use Collections.reverseOrder(); to reverse the existing Queue.
favorite count: 0
type: Question

http://stackoverflow.com/q/25416056
answer count: 2
tagged with: stack
has comment: http://stackoverflow.com/comment/39647502
tagged with: java
linked to: http://stackoverflow.com/q/40480
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25416150
type: Question
has comment: http://stackoverflow.com/comment/39647473
linked to: http://stackoverflow.com/q/869033
has comment: http://stackoverflow.com/comment/39652214
type: UnansweredQuestion
has title: How should I display a stack?
has answer: http://stackoverflow.com/a/25416162
has body: Only the first call of display() works as intended. After the first call, tmpStack is empty and therefore the second call of display() won't print anything. How can I avoid this? public static void main(String[] args) { s.display(sortedStack); s.display(sortedStack); } public void display(Stack&lt;Integer&gt; stackToDisplay){ Stack&lt;Integer&gt; tmpStack = stackToDisplay; while(!tmpStack.isEmpty()){ System.out.println(tmpStack.pop()); } }
score: 0
has comment: http://stackoverflow.com/comment/39647540

http://stackoverflow.com/comment/39885131
comment on: http://stackoverflow.com/q/25544107
type: Comment
type: QuestionComment
has text: well you should add your code snippet here to begin with
score: 1

http://stackoverflow.com/q/25413142
upvote count: 4
type: Question
has title: Android - Can not open fragment a second time
score: 4
has answer: http://stackoverflow.com/a/25413229
favorite count: 0
accepted answer: http://stackoverflow.com/a/25413229
type: AnsweredQuestion
downvote count: 0
tagged with: android-fragments
tagged with: android
tagged with: java
has body: I'm opening a fragment and soon after closing it. It opens and closes no problem the first time but the second time it tries to open it gives a NullPointerException. To open the fragment with SomeFrag class that extends Fragment. To close it I call closeFrag() method. public class SomeFrag extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootview = (ViewGroup) inflater.inflate(R.layout.somefrag, container, false); // line with error return mRootview; } public void closeFrag(){ ((ViewGroup)mRootview.getParent()).removeView(mRootview); } } Why am I not able to open the fragment a second time?
answer count: 1

http://stackoverflow.com/a/25397427
answers question: http://stackoverflow.com/q/25397196
score: 0
has comment: http://stackoverflow.com/comment/39616457
has comment: http://stackoverflow.com/comment/39616333
has body: Do not reinvent the wheel, you can use an existing library to dump the content of CSV file to a Java Collection. I usually use OpenCSV to dump the contents of CSV file to List&lt;String[]&gt;. It has a one liner code to read all. CSVReader reader = new CSVReader(new FileReader("yourfile.csv")); List&lt;String[]&gt; lines= reader.readAll(); Then iterate the list like this to do the grouping. Map&lt;String, List&lt;String[]&gt;&gt; values = new LinkedHashMap&lt;String, List&lt;String[]&gt;&gt;(); for(String[] line : lines){ String key = line[4]; if(values.get(key) == null){ values.put(key, new ArrayList&lt;String[]&gt;()); } values.get(key).add(line); } System.out.println(values);
has comment: http://stackoverflow.com/comment/39616492
type: Answer

http://stackoverflow.com/comment/39752977
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25472799
type: AnswerComment
has text: @peksak Again, images are not parsed/rendered by Jsoup. It only receives the html source. `length` should be more than enough to measure how much Jsoup has downloaded.

http://stackoverflow.com/comment/39858458
score: 0
has text: This is a modified copy of my answer at http://stackoverflow.com/a/25513639/282229
comment on: http://stackoverflow.com/a/25530064
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39660410
comment on: http://stackoverflow.com/q/25423091
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example). 2) Use a logical & consistent code formatting style! The code indentation is intended to help people follow the program flow. 3) A single blank line of white space is *always* enough. Blank lines after `{` or before `}` are also typically redundant.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/47599694
upvote count: 2
downvote count: 0
has body: Maybe late. For ubuntu 17 azuka$ : xhost + azuka$ : sudo su root$ : sh netbeans-8.2-php-linux.sh
answers question: http://stackoverflow.com/q/25547555
type: Answer
score: 2

http://stackoverflow.com/comment/39882751
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25543351
has text: What means "below code but it is not working properly." any exception or the result is not the expected result?
score: 0

http://stackoverflow.com/q/25544059
has comment: http://stackoverflow.com/comment/39884170
has body: Kinda wondering why this happens. Same code but different result. File file = new File("src/config/ora2.config.properties"); System.out.println(file.getAbsolutePath()); In a regular java class, it results right path but when in servlet, it returns the installation path of eclipse. Thanks in advance EDITED Properties props = new Properties(); InputStream in = getServletContext().getResourceAsStream("WEB-INF/ora2.config.properties"); if(in != null) { try { props.load(in); props.setProperty("username", "temtem"); FileOutputStream out = new FileOutputStream(in.toString()); props.store(out, null); out.close(); } finally { in.close(); } Code above is not working :(
has answer: http://stackoverflow.com/a/25544391
type: UnansweredQuestion
tagged with: java
score: -4
answer count: 1
has comment: http://stackoverflow.com/comment/39884393
favorite count: 0
type: Question
has title: Servlet cannot get absolute path of a properties file
tagged with: eclipse
downvote count: 4
tagged with: servlets
upvote count: 0

http://stackoverflow.com/a/25418794
type: Answer
has body: Read the contents of the file into a string. Then make use of String.split(); String s = "insert into table values (‘test’, ); insert into table values ( ‘test’, " + " ); insert into table values (‘test’, );"; String[] test = s.split(";"); for(int i = 0; i < test.length; i++) { System.out.println(test[i]); }
answers question: http://stackoverflow.com/q/25418729
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25470139
score: 3
type: Answer
has body: Consider using Collections.shuffle(). You can use it like this: // assume `cards` is a `List`, Collections.shuffle(cards); // cards is now shuffled For the curious, look over http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/util/Collections.java on line 514.
answers question: http://stackoverflow.com/q/25469913
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25469913

http://stackoverflow.com/comment/39893792
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25549401
score: 0
has text: Please provide the actual error code.

http://stackoverflow.com/q/25513525
linked to: http://stackoverflow.com/q/23871255
tagged with: properties-file
linked to: http://stackoverflow.com/q/3965446
score: 0
has comment: http://stackoverflow.com/comment/39830555
answer count: 2
has answer: http://stackoverflow.com/a/25532207
has body: I am trying to set the properties file inside a class that extends the PropertyPlaceholderConfigurer based upon the environment (local, dev, ref, qa, prod) My folder structure looks like the following. properties environment.properties server-local.properties server-ref.properties server-prod.properties email-local.properties email-ref.properties email-prod.properties cache-local.properties cache-ref.properties cache-prod.properties The environment.properties has a property environment.stage=local (or whatever env this is) My Spring Integration context statements look something like this: <context:property-placeholder location="classpath:properties/*.properties" /> classpath:properties/environment.properties classpath:properties/*-${environment.stage}.properties What I want to do is have only the properties file from the particular environment stage load (be it local, ref, prod .... etc.). How do I get just this second set of properties files to load based upon environment.stage? Thanks for the help in advance.
has answer: http://stackoverflow.com/a/25522751
type: Question
has comment: http://stackoverflow.com/comment/39829997
has comment: http://stackoverflow.com/comment/39830318
tagged with: spring-el
type: UnansweredQuestion
tagged with: java
has title: Using Spring Integration SpEl inside value tag
tagged with: spring

http://stackoverflow.com/comment/39646370
has text: I'm not sure exactly, but should be less than `O(n)`. The removal isn't like `poll`, from the top. It can remove anywhere and still has to re-organize the underlying structure (probably a balanced heap/tree in most implementations).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25415037
score: 0

http://stackoverflow.com/comment/39618806
score: 0
comment on: http://stackoverflow.com/q/25400916
type: Comment
type: QuestionComment
has text: http://www.journaldev.com/1854/java-web-application-tutorial-for-beginners

http://stackoverflow.com/comment/39766701
comment on: http://stackoverflow.com/a/25480263
has text: wow, I have re-read the OP question and I can still not figure out that he is complaining about code not compiling.
type: Comment
type: AnswerComment
score: 0

cname
type: Tag
tags question: http://stackoverflow.com/q/25490593
tag name: cname

http://stackoverflow.com/q/25483420
tagged with: embedded-jetty
type: Question
tagged with: classloader
has body: I have in the resources of my Maven project an index.html file in the res/html folder. I am running Jetty as an embedded webserver. I want to tell him that the base resource for static content is the res/ folder. So, I tried: ResourceHandler rh = new ResourceHandler(); rh.setResourceBase(getClass().getResource("/res").toURI().toString()); It worked until I included another jar on my classpath which also have a res/ folder. Jetty started to look for static content in thisotherjar.jar!res/ I would like to avoid having to give literally the path of the jar that contains my res folder. I am looking for something more generic. I tried to start with the classpath of the file index.html and then go up the the res folder using URI.resolve("..") but the same problem happens. Any ideas to solve this nicely? Thanks!
has answer: http://stackoverflow.com/a/25483697
accepted answer: http://stackoverflow.com/a/25483697
type: AnsweredQuestion
score: 0
tagged with: java
has title: Get parent in the same jar of a classpath resource
answer count: 1

http://stackoverflow.com/comment/39797808
score: 0
comment on: http://stackoverflow.com/q/25496911
has text: This is, as was suggested in the [original post](http://stackoverflow.com/questions/25419808/frames-painting-at-different-times), likely a hardware issue..
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39725912
has text: Related answer: http://stackoverflow.com/a/2985169/2055998
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25458027
type: Comment

http://stackoverflow.com/q/25488051
has body: I need to generate an url with an array parameter, or looking like so: ?array_name[]=value1&amp;array_name[]=value2 How to achieve this with Uri.Builder? The following code: Uri.Builder builder = new Uri.Builder(); builder.appendQueryParameter("array[]", "one"); builder.appendQueryParameter("array[]", "another"); String result = builder.build().toString(); Gets me this output: ?array%5B%5D=one&amp;array%5B%5D=another In which square brackets are escaped. How do I obtain the result that I want? I wouldn't like to ditch Uri.Builder altogether as the solution is already based on that class.
answer count: 2
accepted answer: http://stackoverflow.com/a/25488507
tagged with: java
downvote count: 0
tagged with: uribuilder
possible better answer: http://stackoverflow.com/a/25488353
has title: How do I add array parameters to an url using Uri.Builder?
favorite count: 0
has answer: http://stackoverflow.com/a/25488353
type: Question
score: 5
tagged with: uri
upvote count: 5
tagged with: android
linked to: http://stackoverflow.com/q/176264
has answer: http://stackoverflow.com/a/25488507
type: AnsweredQuestion

http://stackoverflow.com/comment/39883641
has text: You can use struts url tag <s:url> to pass the parameter using <s:param> tag inside the url tag.<s:url action="urlTagAction.action" var="urlTag" > <s:param name="age">99</s:param> </s:url> <s:a href="%{urlTag}">URL Tag Action (via %)</s:a>
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25543178
type: QuestionComment

http://stackoverflow.com/comment/39661154
comment on: http://stackoverflow.com/a/25414080
type: Comment
has text: @markbernard You, never, want to break the paint rules, they will come back to bite you...In Swing, you don't control the paint process, so you have to play nice and within the rules to make it work ;)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39658132
type: Comment
score: 0
has text: @NathanHughes i have edited my post , please check it now . it is the exact thing i wish do with `jdbc template` . is it possible ?
type: QuestionComment
comment on: http://stackoverflow.com/q/25405095

http://stackoverflow.com/comment/39676581
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25431757
has text: Could you provide some examples of where things go wrong e.g. a test that should fail. Also spring and junit versions may help to troubleshoot the issue.

http://stackoverflow.com/comment/39803783
type: AnswerComment
score: 1
has text: I see. Is it smart enough to differentiate between many telescoping constructors too, then?
comment on: http://stackoverflow.com/a/25500382
type: Comment

http://stackoverflow.com/q/25529042
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39906838
has comment: http://stackoverflow.com/comment/39906910
has title: Set tick marks to RangeCrosshair in JFreeChart
tagged with: jfreechart
has comment: http://stackoverflow.com/comment/39884071
has comment: http://stackoverflow.com/comment/39861236
type: Question
tagged with: graph
has comment: http://stackoverflow.com/comment/39866953
has comment: http://stackoverflow.com/comment/39889095
type: UnansweredQuestion
has body: This code private JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart("", "", "", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = (CategoryPlot)chart.getPlot(); plot.setRangeCrosshairVisible(true); plot.setRangeCrosshairPaint(Color.BLACK); plot.setRangeCrosshairStroke(new BasicStroke(2.0f)); return chart; } results in BarChart with bold black line (f: y=0). How to add tick marks to RangeCrosshair? Bold black line should be like: ,-----------,------------,------------, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C
score: 0

http://stackoverflow.com/q/25393482
has body: I have this arraylist Jakarta, the Capital City of Indonesia. ,Tokyo, the Capital City of Japan. ,Manila, the Capital City of Phillipines. I want to remove the leading comma from Tokyo and Manila. How should I write the universal code so that the it can detect whether a string is lead by comma and remove it?? Expected Result: Jakarta, the Capital City of Indonesia. Tokyo, the Capital City of Japan. Manila, the Capital City of Phillipines. Thanks a lot for your help. :)
has answer: http://stackoverflow.com/a/25394326
tagged with: string
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39605908
answer count: 5
has answer: http://stackoverflow.com/a/25393534
possible better answer: http://stackoverflow.com/a/25393534
has title: Trim comma from the start of a string?
has answer: http://stackoverflow.com/a/25393506
upvote count: 1
accepted answer: http://stackoverflow.com/a/25393506
tagged with: regex
has answer: http://stackoverflow.com/a/25393562
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39606428
has answer: http://stackoverflow.com/a/25393588
score: 1
tagged with: java
downvote count: 0

http://stackoverflow.com/q/25397417
has answer: http://stackoverflow.com/a/25399246
has comment: http://stackoverflow.com/comment/39612781
upvote count: 2
has comment: http://stackoverflow.com/comment/39612670
score: 2
has comment: http://stackoverflow.com/comment/39612394
tagged with: chmod
downvote count: 0
tagged with: java
tagged with: file-permissions
answer count: 1
has body: I want to change the permission of a folder were application database is being stored. After searching on Google I found this:- public int chmod(File path, int mode) throws Exception { Class fileUtils = Class.forName("android.os.FileUtils"); Method setPermissions = fileUtils.getMethod("setPermissions", String.class, int.class, int.class, int.class); return (Integer) setPermissions.invoke(null, path.getAbsolutePath(), mode, -1, -1); } ... chmod("/foo/bar/baz", 0755); ... Here the FileUtils class should be a part of android.os package but I wasn't able to find it while importing the package. Any idea how to use FileUtils or some other way to change the permission of folder? I am changing the permission because after installing my app when I try to access the database, app stops working. As my device is rooted so when I change the permission of the database folder from 771 to 777 using Root Browser the app starts working perfectly. So how to change the permission of the folder while installation of app i.e. programmatically in unrooted devices? My DBHelper class:- public class DBHelper extends SQLiteOpenHelper { public SQLiteDatabase database = null; public File databaseFile; public static String databaseName = "Db1.sqlite"; public String databasePath = ""; Context mContext; public DBHelper(Context paramContext) { super(paramContext, databaseName, null, 1); this.mContext = paramContext; Log.d("data", "package name:" + paramContext.getPackageName()); //this.databasePath = ("data/data/" + paramContext.getPackageName() + "/databases/"+databaseName); this.databasePath = (Environment.getExternalStorageDirectory().getAbsolutePath()+"/Android/data/"+paramContext.getPackageName()+"/"+databaseName); System.out.println(databasePath); this.databaseFile = new File(this.databasePath); if (!this.databaseFile.exists()) try { deployDataBase(DBHelper.databaseName, this.databasePath); return; } catch (IOException localIOException) { localIOException.printStackTrace(); } } private void d…
has comment: http://stackoverflow.com/comment/39612618
tagged with: fileutils
has comment: http://stackoverflow.com/comment/39612381
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39612761
has comment: http://stackoverflow.com/comment/39612702
has title: How to change the file/folder permission programmatically in android
has comment: http://stackoverflow.com/comment/39612635
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/39747967
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/59874/discussion-between-marius-schonefeld-and-raghunandan).
score: 0
comment on: http://stackoverflow.com/q/25470137
type: Comment

http://stackoverflow.com/comment/39795155
has text: @TaiHirabayashi I think you wanted `splitS[0].split(" ")[1]` instead of `splitS[0][1]`. Also you'll want to test if `splitS[N]` is not an empty string. You may have empty strings between letters, or an empty string at the beginning if theString starts with a word (like `start 2 4 9`). I wrote [this fiddle](http://jsfiddle.net/rrezeeoL/1/) to show these points.
type: AnswerComment
comment on: http://stackoverflow.com/a/25435458
type: Comment
score: 0

http://stackoverflow.com/q/25501549
upvote count: 2
has comment: http://stackoverflow.com/comment/39805994
has body: I want to check whether an Array element is null. I have initialized an array of String which has a size of 2. I looped through the array and check whether an array element is null. If it's null, I will add a String "a" to that position only. My codes below will produce the following output: 1=a 2=a Code: public class CheckArrayElementIsNull { public static void main(String[] args) { String[] arr = new String[2]; for(int i = 0; i &lt; arr.length; i++) { if(arr[i] == null) { arr[i] = "a"; } System.out.println(i + "=" + arr[i]); if(arr[i] == null) { System.out.println(i + "= null"); } } } } I tried to add a break after my if condition but is not printing out anything. public class CheckArrayElementIsNull { public static void main(String[] args) { String[] arr = new String[2]; for(int i = 0; i &lt; arr.length; i++) { if(arr[i] == null) { arr[i] = "a"; break; } System.out.println(i + "=" + arr[i]); if(arr[i] == null) { System.out.println(i + "= null"); } } } } I expected this output: 1=a 2=null
has comment: http://stackoverflow.com/comment/39805955
tagged with: arrays
has answer: http://stackoverflow.com/a/25501738
has title: Checking for null element in an Array
type: AnsweredQuestion
answer count: 3
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25501648
downvote count: 1
has answer: http://stackoverflow.com/a/25501648
accepted answer: http://stackoverflow.com/a/25501767
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39806061
has answer: http://stackoverflow.com/a/25501767

wrapper
tag name: wrapper
type: Tag
tags question: http://stackoverflow.com/q/25514292

http://stackoverflow.com/comment/39784454
score: 0
has text: @Atlantis No problem. Capital-B Boolean is known as a *wrapper class* for the primitive lower-case-b boolean. You use wrapper classes for things that require an Object, since primitives aren't Objects. ArrayLists can only contain Objects, so that's why you need to use Boolean instead of boolean. Note that when you do add a primitive boolean to the ArrayList, Java is automatically converting it to a wrapper Boolean through a process called *autoboxing*.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25489601

http://stackoverflow.com/q/25472502
type: AnsweredQuestion
answer count: 2
downvote count: 0
tagged with: cxf
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25732461
accepted answer: http://stackoverflow.com/a/25732461
has body: I need to sign web service soap message body and timestamp via smart card. I am using cxf 2.7.12. In cxf ugly documentation, they say "MerlinDevice: Based on Merlin, allows loading of keystores using a null InputStream - for example on a smart-card device". But no example or documentation is provided. Is there anybody who can provide a cofiguration of merlindevice?
favorite count: 0
type: Question
has title: cxf merlindevice configuration
possible better answer: http://stackoverflow.com/a/25481938
has answer: http://stackoverflow.com/a/25481938

http://stackoverflow.com/a/25512154
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25511025
type: Answer
has body: If you use Handlers and Messages you can start and stop the recording when the user clicks the button. And to check if the button has been clicked, just use onClick method.

http://stackoverflow.com/comment/39922371
has text: There's a Spring Boot issue open for this where we're also trying to figure out what's going on: https://github.com/spring-projects/spring-boot/issues/1464. There should be another INFO log line stating the deployment has completed. What, if anything, is logged between the lines you've already posted and the completed line? It would also be helpful to know what's in your war file that's been built by Gradle. Could you update your question with the result of running `unzip -l` on the war?
score: 0
comment on: http://stackoverflow.com/q/25535100
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25418962
tagged with: java
has title: Styled change being delayed sometimes in StyledDocument
has comment: http://stackoverflow.com/comment/39656718
type: Question
tagged with: jeditorpane
has comment: http://stackoverflow.com/comment/39653502
answer count: 0
type: UnansweredQuestion
has body: I tried to change style when user enter StyledDocument. So I add CaretListener to the StyledDocument as below: package test; import java.awt.*; import java.awt.event.*; import java.util.HashMap; import javax.swing.*; import javax.swing.text.*; import javax.swing.event.*; import javax.swing.undo.*; public class TextComponentDemo extends JFrame { JTextPane textPane; AbstractDocument doc; static final int MAX_CHARACTERS = 300; JTextArea changeLog; String newline = "\n"; HashMap&lt;Object, Action&gt; actions; //undo helpers protected UndoAction undoAction; protected RedoAction redoAction; protected UndoManager undo = new UndoManager(); public TextComponentDemo() { super("TextComponentDemo"); //Create the text pane and configure it. textPane = new JTextPane(); textPane.setCaretPosition(0); textPane.setMargin(new Insets(5,5,5,5)); StyledDocument styledDoc = textPane.getStyledDocument(); if (styledDoc instanceof AbstractDocument) { doc = (AbstractDocument)styledDoc; doc.setDocumentFilter(new DocumentSizeFilter(MAX_CHARACTERS)); } else { System.err.println("Text pane's document isn't an AbstractDocument!"); System.exit(-1); } JScrollPane scrollPane = new JScrollPane(textPane); scrollPane.setPreferredSize(new Dimension(200, 200)); //Create the text area for the status log and configure it. changeLog = new JTextArea(5, 30); changeLog.setEditable(false); JScrollPane scrollPaneForLog = new JScrollPane(changeLog); //Create a split pane for the change log and the text area. JSplitPane splitPane = new JSplitPane( JSplitPane.VERTICAL_SPLIT, scrollPane, scrollPaneForLog); splitPane.setOneTouchExpandable(true); //Create the status area. JPanel statusPane = new JPanel(new GridLayout(1, 1)); CaretListenerLabel caretListenerLabel = new CaretListenerLabel("Caret Status"); statusPane.add(caretListenerLabel); //Add the components. getContentPane().add(splitPane, BorderLayout.CENTER); getContentPane().add(statusPane, BorderLayout.PAGE_END); //Set up the menu bar. actions=createActionTable(t…
score: 0
tagged with: swing
tagged with: caret

http://stackoverflow.com/comment/39804100
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25500424
has text: As the AbstractScheduledServiced is a Service and needs to be started. Yes you should call startAsync on it.
score: 0

http://stackoverflow.com/comment/39743331
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25467715
has text: +1 - Key point: use `jstack` to help you figure out what the threads are.
score: 0

http://stackoverflow.com/comment/39740323
comment on: http://stackoverflow.com/q/25466085
type: Comment
has text: This will work but not sure this is the best way to do, after you delete the row update your hashmap and call setadapter again with the updated values, and after that call notifyDataSetChanged().
type: QuestionComment
score: 0

http://stackoverflow.com/comment/53233382
type: QuestionComment
comment on: http://stackoverflow.com/q/25525332
score: 0
has text: Yeah, I did the same but that didnd't work for me. So just wanted to know if you did anything additional. Anyway, Thanks.
type: Comment

http://stackoverflow.com/q/25417053
favorite count: 0
tagged with: oop
type: Question
has title: design for a database interfacing API for inserting and deleting Domain objects
tagged with: single-responsibility-principle
tagged with: java
score: 1
accepted answer: http://stackoverflow.com/a/25418888
has comment: http://stackoverflow.com/comment/39649509
tagged with: object-oriented-analysis
has answer: http://stackoverflow.com/a/25418888
type: AnsweredQuestion
has body: I'm trying to create a good OOP design especially conforming to SRP for interfacing with a database to insert and delete Customers. My focus is on design rather than getting bogged down by details of SQL and JDBC or datasources. So I've left simple implementations using printlines. But I'm wondering if this is how springs jdbctemplate is designed.. This effort came about while I was learning about the SRP OOP design principle. A poorly designed Customer class violated SRP since it contained database insert/delete responsibility. I pulled out code from Customer class and put it into a class that inherits from an RdbmsManager base class who's responsibility is to establish connections and interact with the database. I'm not sure about weather this is a good design, and I'm also not sure if some database API object similar to jdbcTemplate or something needs to be provided to child classes to interact with the database. Customer class public class Customer { private int id; private String fullName; private boolean active; public Customer(int id, String name, boolean active){ this.id = id; this.fullName = name; this.active = active; } @Override public String toString() { return "Customer [id=" + id + ", name=" + name + ", active=" + active + "]"; } } The parent database access class: public class RdbmsManager{ public RdbmsManager(){ connectToDatabase(); } private void connectToDatabase(){ // read from properties files to get DB URL, PORT number etc. // Create Datasource object and establish connection to database System.out.println("Established Database Connection..."); } // Below method returns the database object children can use to issue commands protected DatabaseAPI getDatabaseObject(){ DatabaseAPI databaseObject = new DatabaseAPI (); return databaseObject; } } CustomerDataManager child class: public class CustomerDataManager extends RdbmsManager{ public CustomerDataManager() { super(); // call to super will establish database connection from parent class } public v…
downvote count: 0
upvote count: 1
tagged with: design-patterns
answer count: 1

http://stackoverflow.com/q/25418976
tagged with: xslt
type: Question
has title: XSL Generate Dynamic and Columns in Pdf template for Apache FOP
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/pdf
has body: I am new to style sheets and struggling to create dynamic column in pdf template.. Based on the resultset from java i have to create dynamic column in xsl . The fact is ,I can't able to predict how many columns ,so based on the resultset i have to generate columns dynamically? down below my xsl code &lt;fo:flow flow-name="mainbody"&gt; &lt;fo:block font-family="Arial" font-size="8pt" font-weight="normal" padding-top="-13pt"&gt; &lt;fo:table table-layout="fixed" width="100%" padding-top="105pt"&gt; &lt;fo:table-body height="80cm"&gt; &lt;xsl:for-each select="t013detailList"&gt; &lt;fo:table-row font-size="9pt"&gt; &lt;fo:table-cell padding="2pt" text-align="center" border-bottom="solid 0.01mm gray" number-columns-spanned="1" wrap-option="wrap"&gt; &lt;fo:block &gt; &lt;xsl:value-of select="AccountNumber"/&gt; &lt;/fo:block&gt; &lt;/fo:table-cell&gt; &lt;/fo:table-row&gt; &lt;/xsl:for-each&gt; &lt;/fo:table-body&gt; &lt;/fo:table&gt; &lt;/fo:block&gt; &lt;/fo:flow&gt; pls help.. All support is welcome. Thanks!
downvote count: 0
score: 1
upvote count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0

http://stackoverflow.com/q/25468152
has comment: http://stackoverflow.com/comment/39745490
has comment: http://stackoverflow.com/comment/39747160
type: UnansweredQuestion
has body: I use xslt 2.0. I have a parameter named "N" which has an integer value. Eg: &lt;xsl:param name="N" select="5"&gt; Now I want to define "N" number of parameters which are as follows: &lt;xsl:param name="car1"/&gt; &lt;xsl:param name="car2"/&gt; &lt;xsl:param name="car3"/&gt; and so on...till &lt;xsl:param name="carN"/&gt; So in this example since the value of N is 5, I want to create the following parameters: &lt;xsl:param name="car1"/&gt; &lt;xsl:param name="car2"/&gt; &lt;xsl:param name="car3"/&gt; &lt;xsl:param name="car4"/&gt; &lt;xsl:param name="car5"/&gt; The number of parameters must be generated dynamically based on value "N" and not hard coded in xsl.Also even I can use xslt 1.0 if this situation demands to use it. I may also pass the N value from java using transformer.setparameter("N","5");
tagged with: xslt-2.0
has comment: http://stackoverflow.com/comment/39744166
tagged with: http://stackoverflow.com/tag/xml
score: 0
has title: How to define "N" number of parameter based on the value of "N"
tagged with: java
has answer: http://stackoverflow.com/a/25470304
has comment: http://stackoverflow.com/comment/39749648
answer count: 1
tagged with: xslt-1.0
tagged with: xslt
type: Question

http://stackoverflow.com/comment/124785238
comment on: http://stackoverflow.com/a/27582110
score: 0
type: AnswerComment
type: Comment
has text: I prefer this solution, its easier and you dont have to convert to float.

http://stackoverflow.com/q/25426786
downvote count: 0
score: 1
upvote count: 1
tagged with: java
tagged with: certificate
answer count: 1
has body: I am currently able to read a Key modulus from a cer file using this code, also found on StackOverflow: X509Certificate cert = null; String source = "src/testCer.cer"; InputStream fis = null; ByteArrayInputStream bais = null; fis = new FileInputStream(source); byte value[] = new byte[fis.available()]; fis.read(value); bais = new ByteArrayInputStream(value); java.security.cert.CertificateFactory cf = java.security.cert.CertificateFactory.getInstance("X.509"); cert = (X509Certificate)cf.generateCertificate(bais); RSAPublicKey pub = (RSAPublicKey) cert.getPublicKey(); System.out.println(pub.getModulus()); The .cer file looks like this: (certificate is an example Alice certificate found on the internet): -----BEGIN CERTIFICATE----- [binary] -----END CERTIFICATE----- A nicely Base64 Encoded wrapped text. My question: How would I save this certificate to a String, and use that instead of reading the certificate from a file? So far I tried: String cert_1= "-----BEGIN CERTIFICATE-----" + "MIIBuTCCASKgAwIBAgIQNdNhtuV5GbNHYZsf+LvM0zANBgkqhkiG9w0BAQUFADAb" + "MRkwFwYDVQQDExBFZGlkZXYgU21va2VUZXN0MB4XDTA4MTExMjE5NTEzNVoXDTM5" + "MTIzMTIzNTk1OVowGzEZMBcGA1UEAxMQRWRpZGV2IFNtb2tlVGVzdDCBnzANBgkq" + "hkiG9w0BAQEFAAOBjQAwgYkCgYEAm6zGzqxejwswWTNLcSsa7P8xqODspX9VQBuq" + "CBpT4S5AaO3/wkYQSKdI108pXH7Aue0e/ZOwgEEX1N6OaPQn7AmAB4uq1h+ffw+r" + "5W1RoTgQ0LNR64+7ywLjH8+wrb/lB6QV7s2SFUiWDeduVesvMJkWtZ5zzQyl3iUa" + "RKNHqnsCAwEAATANBgkqhkiG9w0BAQUFAAOBgQCZmj+pgRsN6HpoICawK3XXNAmi" + "cgfQkailX9akIjD3xSCwEQx4nG6tZjTz30u4NoSffW7pch58SxuZQDqW5NsJcQNq" + "Ngo/dMoqqpXdi2/0BYEcJ8pjsngrFm+fM2BnyGpXH7aWuKsWjVFGlWlF+yi8I35Q" + "8wFJt2Z/XGA7WWDjvw==" + "-----END CERTIFICATE-----"; fis = new ByteArrayInputStream(cert_1.getBytes()); Which results in an error: java.io.IOException: Incomplete data. fis.available also differes from the certificate loaded from file. (it is 2 shorter). I am guessing this has to do with the WRAPPING. I am suspecting this because a .cer file does not work if the Header is not alon…
favorite count: 0
type: Question
tagged with: rsa
has comment: http://stackoverflow.com/comment/39671091
tagged with: word-wrap
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25429357
has comment: http://stackoverflow.com/comment/39666573
accepted answer: http://stackoverflow.com/a/25429357
has title: Saving Base64 encoded CER file to a String

http://stackoverflow.com/q/25531928
has comment: http://stackoverflow.com/comment/39884736
type: Question
score: 2
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/39863307
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39871984
tagged with: wsdl
downvote count: 0
tagged with: web-services
tagged with: https
favorite count: 0
tagged with: weblogic
has body: I want to create a web service in weblogic from WSDL using OEPE(Oracle Enterprise Pack for Eclipse) and Java. I've tried to follow the following tutorial and the first part of the tutorial: Web Service using the top-down (WSDL First) method. If I use http protocol in WSDL file, it works ok. For example, if I put something similar to: <wsdl:service name="WsService"> <wsdl:port name="WsPort" binding="tns:WsServiceSoapBinding"> <soap:address location="http://localhost:7001/WSService" /> </wsdl:port> </wsdl:service> it works ok. But I need to use https, so WSDL would change (I think) to something simimar to: <wsdl:service name="WsService"> <wsdl:port name="WsPort" binding="tns:WsServiceSoapBinding"> <soap:address location="https://localhost:7002/WSService" /> </wsdl:port> </wsdl:service> The problem is that when I've tried to run the project in the server or Add and remove the project, an error appears: Only HTTP ports are supported for JAX-WS. I've enabled SSL in Weblogic Admin Console, but I receive the same error. I've tried to follow these instructions and add the following to web.xml: SecurityConstraint <web-resource-collection> Secure Area /WsService POST </web-resource-collection> CONFIDENTIAL Nothing change. Do you know how I can solve it? or is there a better way to do this? Thank you very much! UPDATE This is the full stack trace(The first line is in Spanish the error: Only HTTP ports are supported for JAX-WS): oracle.eclipse.tools.webservices.compiler.CompilationException: Errors: Sólo se soportan los puertos HTTP para JAX-WS. (C:\Proyectos\workspace-weblogic\Test6\src\es\xxx\yyy\ws\WsService_WsPortImpl.java, line 14) at oracle.eclipse.tools.webservices.common.compiler.WebServiceCompilerImpl.compile0(WebServiceCompilerImpl.java:300) at oracle.eclipse.tools.webservices.common.compiler.WebServiceCompilerImpl.compile(WebServiceCompilerImpl.java:247) at oracle.eclipse.tools.webservices.common.compiler.WebServiceProjectCompilerImpl.build0(WebServiceProjectCompiler…
tagged with: java
has title: How to create a webservice in weblogic using Eclipse and https
has comment: http://stackoverflow.com/comment/39862862
has comment: http://stackoverflow.com/comment/39936349
has comment: http://stackoverflow.com/comment/39887804

http://stackoverflow.com/q/25532010
tagged with: exception
has answer: http://stackoverflow.com/a/25532557
has body: I'm trying to figure out, which java is my firefox using. I am using Fedora 20 with Firefox 31. I need to get access to an application which is using java. But i'm so confused, because my friend installed like 10x java version on my PC. I know, if i type which java in the terminal, i got the one. But that's just a simlink. I need to get to the ControlPanel to add some Exceptions for a Site. I found some java versions with a control panel, but i don't think it's the right one, because my exceptions are not working.
has answer: http://stackoverflow.com/a/25532048
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
has title: Which Java is in use

http://stackoverflow.com/comment/39747035
has text: I'm sorry, but I'll stop answering if you don't read what I say. I told you twice to surround the path by double quotes. I even did it for you. And your command still doesn't contain any double quote. You just have to copy and paste. Is it really so hard? Here's the complete command. Copy and paste it: `java -cp.;"C:\Program Files\PostgreSQL\9.3\lib\postgresql-9.3-1102.jdbc4.jar" JdbcPostgresqlConnection`.
type: Comment
comment on: http://stackoverflow.com/a/25469179
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39646567
comment on: http://stackoverflow.com/a/25415360
type: Comment
type: AnswerComment
score: 0
has text: does it always start with `com`? For example if the source code had `package abc;` what would it be?

http://stackoverflow.com/comment/39760674
type: QuestionComment
comment on: http://stackoverflow.com/q/25477109
has text: "echo" is a command of the DOS shell, it isn't directly a part of Windows itself. Your Java needs to run "cmd", and have cmd execute "echo". You'll find more details here: http://www.java2s.com/Questions_And_Answers/Java-File/batch-File/execute.htm
type: Comment
score: 1

http://stackoverflow.com/a/25400202
answers question: http://stackoverflow.com/q/25400082
downvote count: 0
type: Answer
has body: From the documentation read(byte[] b): Reads some number of bytes from the input stream and stores them into the buffer array b. The number of bytes actually read is returned as an integer. This method blocks until input data is available, end of file is detected, or an exception is thrown. If the length of b is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at the end of the file, the value -1 is returned; otherwise, at least one byte is read and stored into b. The first byte read is stored into element b[0], the next one into b[1], and so on. The number of bytes read is, at most, equal to the length of b. Let k be the number of bytes actually read; these bytes will be stored in elements b[0] through b[k-1], leaving elements b[k] through b[b.length-1] unaffected. Returns: The total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
score: 1
upvote count: 1

http://stackoverflow.com/q/25407744
answer count: 1
accepted answer: http://stackoverflow.com/a/25407904
type: Question
has answer: http://stackoverflow.com/a/25407904
has body: This "program" or "app" I'm writing is a thing I want to do to prove myself I can learn java, it's not a serious game, it's just a game for myself to see if I can do things right. This is my current code //*Importación del botón import javax.swing.JButton; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; //*Set de importación para sonido import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; //Fin del set de sonido import javax.swing.JFrame; //*Importando la ventana import javax.swing.JLabel; //*Texto en la ventana import javax.swing.JPanel; import javax.swing.SwingConstants; //*Swing para alinear texto //*Comienza el juego public class Principal { public static void main(String args[]) { //*Script original (Añadido final para cerrarlo) final JFrame vprincipal = new JFrame (); JLabel texto = new JLabel("Bienvenida",SwingConstants.CENTER); //*Añadiendo el JPanel no original JPanel contenedor = new JPanel(); contenedor.setOpaque(true); contenedor.setBackground(Color.WHITE); contenedor.setLayout(null); //*Script original texto.setText("Bienvenidos a la versión alfa 0.1 de Mazmorra de Puertas"); texto.setLocation(500,500); vprincipal.add(texto); String nombre = "Mazmorra de Puertas"; vprincipal.setTitle(nombre); vprincipal.setSize(400, 200); vprincipal.setVisible(true); vprincipal.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); vprincipal.setVisible(true); vprincipal.setLocation(750,350); vprincipal.setLayout(new BorderLayout()); contenedor.add(texto); //*Añadiendo botón final JButton empezar = new JButton("Empezar"); vprincipal.setContentPane(contenedor); contenedor.add(empezar); empezar.setSize(100, 20); empezar.setLocation(140, 130); //*Comienzo del juego final JFrame com…
has comment: http://stackoverflow.com/comment/39632618
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39632087
has title: Run different class from same java (eclipse) project
tagged with: java

http://stackoverflow.com/q/25431143
has answer: http://stackoverflow.com/a/25431179
tagged with: multithreading
downvote count: 0
answer count: 1
score: 1
upvote count: 1
has body: I have a thread pool that loops over a bunch of pages and checks to see if some string is there or not. If String is found, or not found response is near instant, however if server is offline or application is not running getting a rejection seems to take seconds How can I change my code to fail faster? for (Thread thread : pool) { thread.start(); } for (Thread thread : pool) { try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } Here is my run method @Override public void run() { for (Box b : boxes) { try { connection = new URL(b.getUrl()).openConnection(); scanner = new Scanner(connection.getInputStream()); scanner.useDelimiter("\\Z"); content = scanner.next(); if (content.equals("YES")) { } else { System.out.println("\tFAILED ON " + b.getName() + " BAD APPLICATION STATE"); } } catch (Exception ex) { System.out.println("\tFAILED ON " + b.getName() + " BAD APPLICATION STATE"); } } }
favorite count: 0
type: Question
has title: Failing faster when URL content is not found, howto
tagged with: java
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25431179

http://stackoverflow.com/comment/39670095
has text: `Today I have a application built in Graphics2D` - I guess I don't understand that comment. Graphics are drawn onto a panel. I just added a text field to the panel. So I don't undersatnd what you are asking. If you just want to display text on the panel then you use the `Graphics.drawstring()` method.
comment on: http://stackoverflow.com/a/25412439
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/39885918
type: Comment
type: QuestionComment
score: 0
has text: @ankur-singhal k but it was working fine before i did mongodb integration and now suddenly stopped working
comment on: http://stackoverflow.com/q/25542004

lambda
tags question: http://stackoverflow.com/q/25542849
tags question: http://stackoverflow.com/q/25479608
tags question: http://stackoverflow.com/q/25523375
tags question: http://stackoverflow.com/q/25473849
type: Tag
tags question: http://stackoverflow.com/q/25468711
tags question: http://stackoverflow.com/q/25460660
tags question: http://stackoverflow.com/q/25500213
tags question: http://stackoverflow.com/q/25456793
tags question: http://stackoverflow.com/q/25409533
tags question: http://stackoverflow.com/q/25435056
tags question: http://stackoverflow.com/q/25512532
tags question: http://stackoverflow.com/q/25504930
tags question: http://stackoverflow.com/q/25466664
tags question: http://stackoverflow.com/q/25391656
tags question: http://stackoverflow.com/q/25443655
tag name: lambda
tags question: http://stackoverflow.com/q/25439277

http://stackoverflow.com/comment/39707152
score: 0
has text: I was looking at Android's official API (set to API level 16) and I didn't see the method. I used: http://developer.android.com/reference/android/net/wifi/WifiManager.html
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25434339

http://stackoverflow.com/comment/39689739
comment on: http://stackoverflow.com/a/25438809
type: AnswerComment
has text: @Purpl3Paul I just tried it and it does let me input after I put characters.
score: 0
type: Comment

http://stackoverflow.com/q/25465881
downvote count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: performance
has body: I'm using junit to run a primitive benchmark like this: @Test public void testTime() throws Exception{ LoadoutBase<?> loadout = new LoadoutStandard("AS7-D-DC"); final int iterations = 1000000; long start = System.nanoTime(); int sum = 0; for(int i = 0; i < iterations; ++i){ Iterator<Item> it = loadout.iterator(); while( it.hasNext() ){ sum += it.next().getNumCriticalSlots(); } } long end = System.nanoTime(); long time_it = end - start; start = System.nanoTime(); sum = 0; for(int i = 0; i < iterations; ++i){ for(Item item : loadout.getAllItems()){ sum += item.getNumCriticalSlots(); } } end = System.nanoTime(); long time_arrays = end - start; System.out.println("it: " + time_it + " array: " + time_arrays + " diff: " + (double)time_it/time_arrays); } If I set iterations=1000000 then I get it: 792771504 array: 1109215387 diff: 0.7147137637029551 very consistently but if I set iterations=10000 then I get it: 32365742 array: 28902811 diff: 1.1198129482976587 with very wild fluctuations. The diff parameters is anywhere from 0.7 to 1.2 Could any one shed some light on what might be happening here? Which method should I choose? Edit: What I really am benchmarking is behind the scenes work. getAllItems creates a new List<Item> and populates it by getting all items from 16 sublists using addAll. The Iterator approach doesn't construct this temporary list but rather keeps track of in which of these 16 sublists it is currently iterating and has some logic to make the 16 sublists look like a continuous list.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25466410
accepted answer: http://stackoverflow.com/a/25466019
linked to: http://stackoverflow.com/q/504103
has comment: http://stackoverflow.com/comment/39739976
has title: What is going on in this java benchmark?
favorite count: 0
has answer: http://stackoverflow.com/a/25466019
linked to: http://stackoverflow.com/q/23226396
type: Question
answer count: 2
tagged with: benchmarking
has comment: http://stackoverflow.com/comment/39740158
linked to: http://stackoverflow.com/q/23685054
possible better answer: http://stackoverflow.com/a/25466410

http://stackoverflow.com/a/25473975
downvote count: 0
has comment: http://stackoverflow.com/comment/39757775
has body: for(int j=0;j&lt;matrix1[i].length;i++) ^^^ You're incrementing i instead of j.
type: Answer
answers question: http://stackoverflow.com/q/25473938
score: 3
upvote count: 3

http://stackoverflow.com/a/25501381
has body: You can try this to do it with 1 loop: int array[] = {8,2,0,5,-3,6,0,9}; int smallestPositive = array[0]; for(int i = 1; i &lt; array.length; i++){ if(smallestPositive &gt; 0){ if(array[i] &lt; smallestPositive &amp;&amp; array[i] &gt; 0) smallestPositive = array[i]; }else smallestPositive = array[i]; } System.out.println(smallestPositive); will print 2
type: Answer
answers question: http://stackoverflow.com/q/25500199
score: 0

http://stackoverflow.com/q/25479195
has comment: http://stackoverflow.com/comment/39765007
tagged with: runtime-error
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39765063
has answer: http://stackoverflow.com/a/25479550
accepted answer: http://stackoverflow.com/a/25479550
answer count: 3
has comment: http://stackoverflow.com/comment/39765313
has comment: http://stackoverflow.com/comment/39764853
has comment: http://stackoverflow.com/comment/39765090
score: 1
possible better answer: http://stackoverflow.com/a/25480169
tagged with: java
has answer: http://stackoverflow.com/a/25479301
downvote count: 1
has comment: http://stackoverflow.com/comment/39764642
has title: Unexpected IndexOutOfBoundsException
has body: Lately I have been complete befuddled by a strange bug in my code and got to the point of extreme frustration. Eventually I went and put in System.out.println();'s in my code until I narrowed it down, to reveal the most bizarre of results. Here is the code: for (Iterator&lt;Integer&gt; it = list.iterator(); it.hasNext();) { i = it.next(); System.out.println(DeathWish.getInstanceListReference() .get(DeathWish.getInstanceListReference().size() -1) ); System.out.println("Golden number: " + (DeathWish.getInstanceListReference().size() -1) ); System.out.println((DeathWish.getInstanceListReference().size() -1) == i); System.out.println("CurrentInstance List: " + Arrays.toString(DeathWish.getInstanceListReference().toArray())); System.out.println("Iteration: " + i); try { System.out.println( DeathWish.getInstanceListReference() .remove((int)list.get(i))); //remove unwanted objects from game paint list } catch(IndexOutOfBoundsException ex) { System.err.println(ex + " Error with multiple GameObj objects"); } finally { System.out.println("\n"); } } and the output: DeathWish.Bullet@ddd5de Golden number: 2 true CurrentInstance List: [DeathWish.Player@3a5cf7, DeathWish.Bullet@6cca54, DeathWish.Bullet@ddd5de] Iteration: 2 java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 Error with multiple GameObj objects getInstanceListReference() returns an ArrayList&lt;GameObj&gt;. GameObj is one of the super-super classes in my project that represents Game Objects. Additionally, the ArrayList that getInstanceListReference() returns is not being modified by internal source code during runtime. There is some code that is executed before the for loop: System.out.println("\n------------------------\n" + "Read Instance List: " + Arrays.toString(tmpLock.toArray()) + "|" + Arrays.toString(tmpLock1.toArray())); System.out.println("Recycle Bin: " + recycleBin.get(0) + "|" + recycleBin.get(1) + "\n------------------------\n"); This list in the source code in the very top refers to the recycleBin.…
has comment: http://stackoverflow.com/comment/39764748
tagged with: iteration
favorite count: 0
has comment: http://stackoverflow.com/comment/39765193
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/39765134
has comment: http://stackoverflow.com/comment/39764631
has comment: http://stackoverflow.com/comment/39765316
tagged with: indexoutofboundsexception
has answer: http://stackoverflow.com/a/25480169
has comment: http://stackoverflow.com/comment/39765046

http://stackoverflow.com/comment/39729849
type: Comment
type: QuestionComment
has text: @chrylis: I know, just wanted to know if it builds from command-line. `mvn clean package` would have been the better approach for that - I agree. (BTW: even if eclipse:eclipse doesn't work properly, it should not do any harm, though)
comment on: http://stackoverflow.com/q/25453342
score: 0

http://stackoverflow.com/comment/39613589
comment on: http://stackoverflow.com/a/25397591
has text: About a way to ignore comments and count number of while loops. You had mentioned to build a parser. Could you explain bit more about it?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/39864645
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25501352
has text: Yes, you're right. You're overriding the super's `getParent()` and you're changing the return type which is not kosher. If I were you, I'd also change the name of the Container class so as not to have a name clash there. 1+ to your answer.

http://stackoverflow.com/comment/39765512
score: 0
type: Comment
type: QuestionComment
has text: Can you try to make an interface out of that class, and inject an interface. It could be that CDI injects an object not a proxy, it is required to have an interface to proxy objects in CDI
comment on: http://stackoverflow.com/q/25401435

http://stackoverflow.com/a/25480970
answers question: http://stackoverflow.com/q/25480606
type: Answer
has body: byte[] array = new byte[] { 1, 2, 3, 4 }; System.out.println(array.length); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(array); oos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bais); Object obj = ois.readObject(); ois.close(); System.out.println(((byte[]) obj).length);
score: 0

http://stackoverflow.com/a/25522137
has body: I have found how to solve it. Firstly, I have changed the ivy.xml like; &lt;dependencies&gt; &lt;dependency org="Google Guava" name="guava" rev="17.0" conf="compile-&gt;default"/&gt; &lt;dependency org="Folee" name="folee-1.4.0" rev="1.4.0" conf="compile-&gt;default"/&gt; &lt;/dependencies&gt; Then, I have changed the ivyconf.xml like; &lt;conf defaultresolver="local"/&gt; &lt;resolvers&gt; &lt;filesystem name="local"&gt; &lt;artifact pattern="${ivy.settings.dir}/../../lib/[organisation]/[artifact].[ext]" /&gt; &lt;/filesystem&gt; &lt;/resolvers&gt; &lt;modules&gt; &lt;module resolver="local" /&gt; &lt;/modules&gt; As you see, I havenot use organisation="FS" to resolve them in own filesystem. Then, I used organisation variable as container for storing folder name. At last, what I got is the clean project hierarchy.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25521458
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25521458

http://stackoverflow.com/comment/39853586
comment on: http://stackoverflow.com/q/25527244
type: Comment
type: QuestionComment
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).

http://stackoverflow.com/comment/39681612
type: Comment
has text: @ElliottFrisch They are questions to problems that come at the end of the book I am using to teach myself. Even if I'm not taking a class I still consider it homework.
type: QuestionComment
comment on: http://stackoverflow.com/q/25430892
score: 0

http://stackoverflow.com/comment/39675564
comment on: http://stackoverflow.com/q/25431379
score: 0
type: Comment
has text: Why are you extending `JPanel`? Subclassing Swing classes should _only_ be done to add behavior, _not_ to control layout.
type: QuestionComment

http://stackoverflow.com/q/25542091
downvote count: 4
has title: Java sorting with comparator
tagged with: arraylist
upvote count: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39880532
has comment: http://stackoverflow.com/comment/39881032
duplicate of: http://stackoverflow.com/q/25706216
favorite count: 0
type: Question
has body: okay look i know this question has been answered time and time again HOWEVER i seriously can't figure out what im doing wrong. please help. i have two classes. Machine.java which is the object class and the InventoryTest.java class that holds the main statement. everywhere i have read says this should work. this is in the Machine.java class public static Comparator&lt;Machine&gt; machineIdNumberComparator = new Comparator&lt;Machine&gt;() { @Override public int compare(Machine s1, Machine s2) { String MachineID1 = s1.getMachineIdNumber(); String MachineID2 = s2.getMachineIdNumber(); //ascending order return MachineID1.compareTo(MachineID2); }}; this is in the InventoryTest Collections.sort(arraylist, inventoryArray.machineIdNumberComparator); this line comes up with problems. arraylist has cannot find symbol error and so does the machineIdNumberComparator. i need to be able to sort by 3 different methods. edit: this is how i add and created my arrayList public List&lt;Machine&gt; inventoryArray = new ArrayList&lt;&gt;(); inventoryArray.add(new Machine(strMachineIdNumber, strManufacturer, strType, dblPowerOrCapacity, dblPrice)); the arraylist is declaired at the start just under the public class where you declair all your variables. /** * * @author stephankranenfeld */ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Collections; import java.util.Comparator; import java.util.NoSuchElementException; import java.util.Scanner; import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.JButton; import javax.swing.JTextArea; public class InventoryTest extends JFrame { private static final int FRAME_WIDTH = 800; private st…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39880590
score: -4
linked to: http://stackoverflow.com/q/25706216
tagged with: sorting
has answer: http://stackoverflow.com/a/25542145

http://stackoverflow.com/a/25499871
type: Answer
score: 2
has body: WebElement ele = driver.findElement(by locator)); //find the text field if (ele.getAttribute("value").isEmpty()) { //Do something if the text field is empty } else { //Store the value String store=ele.getAttribute("value"); }
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25499551

http://stackoverflow.com/comment/39881283
has text: Show your manifest.xml file
comment on: http://stackoverflow.com/q/25542291
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25504854
type: AnsweredQuestion
score: 0
has title: refresh components in jframe in while loop
has answer: http://stackoverflow.com/a/25504959
possible better answer: http://stackoverflow.com/a/25504959
tagged with: java
has answer: http://stackoverflow.com/a/25504936
accepted answer: http://stackoverflow.com/a/25504936
answer count: 2
tagged with: jscrollpane
has body: I have a table in database contain image paths and inside the while loop on the query result , i added the images to JScrollPane while (rs.next()) {///loop on the image paths from database //// i added here the images to JScrollPane } but the frame is freezing until all the images set in JScrollPane then it shows to the user what i need : show the images in JScrollPane one by one and sorted without freezing the frame?! note : i used Thread and fixed the problem but there are a problem in sorted
has comment: http://stackoverflow.com/comment/39811989
has comment: http://stackoverflow.com/comment/39811963
has comment: http://stackoverflow.com/comment/39812046
tagged with: swing
type: Question

http://stackoverflow.com/q/25545219
possible better answer: http://stackoverflow.com/a/25545412
tagged with: datepicker
has body: Can anyone tell me why the date is being set to next month instead of this month? Even though im setting the dateFormatted variable as "28/08/2014" its setting the date to "28/07/2014". I can simply go -1 at the month but it will mess up the date in January. Is there some other way i should be setting the date? Thanks UtilDateModel model; JDatePanelImpl datePanel; DatePickerImpl datePicker; model = new UtilDateModel(); model.setDate(yearInt, monthInt, dayInt); model.setSelected(true); datePanel = new JDatePanelImpl(model); datePicker = new JDatePickerImpl(datePanel); // String dateFormatted = (String) result[1]; String dateFormatted = "28/08/2014"; System.out.println("Date Formatted : " + (String) result[1]); int day = Integer.parseInt(dateFormatted.substring(0, 2)); // Correct int month = Integer.parseInt(dateFormatted.substring(3, 5)); // Correct int year = Integer.parseInt(dateFormatted.substring(6, 10)); // Correct System.out.println(day); System.out.println(month); System.out.println(year); model.setDate(year, month, day); model.setSelected(true);
score: -1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25545283
has title: DatePicker setting month wrong
answer count: 2
has answer: http://stackoverflow.com/a/25545283
has answer: http://stackoverflow.com/a/25545412
tagged with: sql
upvote count: 0
tagged with: java
downvote count: 1
favorite count: 0
type: Question

osgi
tags question: http://stackoverflow.com/q/25409129
type: Tag
tags question: http://stackoverflow.com/q/25497239
tag name: osgi
tags question: http://stackoverflow.com/q/25436422

http://stackoverflow.com/comment/39687922
has text: yes, don't execute B#test()
score: 0
comment on: http://stackoverflow.com/q/25431255
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39828342
comment on: http://stackoverflow.com/q/25513263
has text: Implement a comparator interface, and sort it according to age/salary.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39760975
comment on: http://stackoverflow.com/q/25477294
has text: YemSalat - are you using any IDE like eclipse ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39746547
has text: in `onCreate` function i have only this code:`super.onCreate(savedInstanceState);` after change it with your solution i get error for `setAdapter`: `can not resolve method setAdapter` and in `onCreateView` function must be have only: `return super.onCreateView(inflater, container, savedInstanceState);` ???
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25469100
type: Comment

http://stackoverflow.com/q/25450570
has comment: http://stackoverflow.com/comment/39711187
has comment: http://stackoverflow.com/comment/39711065
has comment: http://stackoverflow.com/comment/39710911
has comment: http://stackoverflow.com/comment/39711296
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39711454
tagged with: recursion
has comment: http://stackoverflow.com/comment/39710818
has answer: http://stackoverflow.com/a/25450707
has body: This recursive method seems to be adding to sum. For some reason when it comes to returning the sum value, sum is equal to 4, not 10, the value it should be. Why is sum not equal to 10? I am just testing the method to see if it works, the array will change. public class TestMeanVal { public static void main(String[] args){ int[] intArray = new int[] {1,2,3,4}; System.out.println(meanRec(intArray, intArray.length-1, 0)); } static double meanRec(int[] array, int b, int g){ int sum = g; if (c.length == 1){ return c[0]/1.0; }else if(b &gt;= 0){ sum += c[b]; b--; meanRec(c,b, sum); } return sum/c.length; } }
has comment: http://stackoverflow.com/comment/39718426
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/39718357
score: 1
upvote count: 1
tagged with: methods
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39710854
has comment: http://stackoverflow.com/comment/39710947
has comment: http://stackoverflow.com/comment/39711212
type: Question
has title: Recursive method with incorrect return value
has comment: http://stackoverflow.com/comment/39710931

http://stackoverflow.com/q/25491428
tagged with: jquery
has body: New to stackoverflow so i am sorry if i broke any formatting rules. I have implemented in Java some fully functional algorithms about the calculation of topK best results utilizing RTrees and IRTrees. This calculation is also progressive, which means that when a response is calculated it is automatically displayed. However, what i have currently achieved from my website creation is to discard the progressive capability of my algorithms and instead provide the answers to the user when they are ready from my servlet. To the client i utilize AJAX with JQuery to handle the call to the servlet. What i want to know is how i can utilize a connection so as to send responses to the client whenever an answer is calculated. I have read about html5 sse but i don't think it's appropriate to my case. What do you think? What resources and advice can you give me? Thanks in advance! EDIT I managed to find a solution to my problem. WebSockets inspired me and i stumbled upon a framework called Atmosphere that looks like it can suit my needs. Thank you!
has comment: http://stackoverflow.com/comment/39788315
score: 0
tagged with: java
has title: How to implement progressive response from Servlet?
has comment: http://stackoverflow.com/comment/39787710
tagged with: http
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/39787488
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/39819078
score: 0
comment on: http://stackoverflow.com/q/25508281
type: QuestionComment
has text: That doesn't validate the argument. It silently replaces a null value with a default value. To validate it, use `Preconditions.checkNotNull()`. If an argument should not be null, then it should not be null, and an exception should be thrown to tell the caller code that it's buggy.
type: Comment

http://stackoverflow.com/comment/39704655
type: QuestionComment
comment on: http://stackoverflow.com/q/25447462
score: 0
has text: Welcome to Stack overflow. TO help us help you answer your questions, be sure check I encourage you to check out the Help Center and see how to ask "good" questions. [Help](http://stackoverflow.com/help). WE'll gladly help you out, but you need to offer some form of attempt :)
type: Comment

http://stackoverflow.com/comment/39699811
type: AnswerComment
comment on: http://stackoverflow.com/a/25403098
type: Comment
has text: I haven't used it, but it looks promising, give it a try, it might make your whole setup work. My only worry would be that because of using so many different pieces the testing environment would be too fragile. Let me know if it works
score: 0

http://stackoverflow.com/comment/39731610
has text: @MadProgrammer now i just edit my question. its my problem. Normally we can hide JFrame with setVisible(false) but in Netbeans how can i hide?
type: Comment
comment on: http://stackoverflow.com/q/25461451
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39890074
type: AnswerComment
has text: [0-9?] is easy to do ...just replace ? with [0-9?]...problem is with [5?] as inplace of 5 digit can be any from 0-9
type: Comment
comment on: http://stackoverflow.com/a/25546573
score: 0

http://stackoverflow.com/a/25393574
has comment: http://stackoverflow.com/comment/39605858
answers question: http://stackoverflow.com/q/25393425
type: AcceptedAnswer
score: 3
upvote count: 3
has body: Don't use a loop try this: editText_HEX.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { // check for valid hex here } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { } });
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25393425
type: Answer
has comment: http://stackoverflow.com/comment/39605762

http://stackoverflow.com/comment/39908112
has text: I seriously doubt that you could not find an answer to that question with a minimal search
comment on: http://stackoverflow.com/q/25538511
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39630948
score: 0
has text: By protected I mean that the class itself is package-private. Sorry for the confusion. Also, @SotiriosDelimanolis I've added more information on why I want to do this.
comment on: http://stackoverflow.com/q/25407260
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25524097
has comment: http://stackoverflow.com/comment/39852102
has comment: http://stackoverflow.com/comment/39849806
has comment: http://stackoverflow.com/comment/39848770
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39852571
has body: The classes are loaded from java.lang.ClassLoader's loadClass(String name) method which in turn calls the findClass(String name) method.Usually,the custom ClassLoader overrides the findClass method to retrieve the definition of classes using a specific protocol and location.It may be that classes are loaded from database or from network location,the location of which may be dynamically generated.So you can never know location of all Java classes. The best example is AppletClassLoader which loads classes from network stream or from a remote location. Bootstrap ClassLoader - core library package such as rt.jar present in JRE lib folder Extension ClassLoader - jar files present in ext folder or as specified in the environment variable for ext System ClassLoader - Application's classpath or as specified in environment variable for classpath or through JVM's startup argument parameter for -cp or -classpath CustomClassLader -accordingly to the classLoader's class loading policy (mostly defined in findClass() method)
score: 1
answers question: http://stackoverflow.com/q/25523873
type: Answer

api
tags question: http://stackoverflow.com/q/25427588
tags question: http://stackoverflow.com/q/25470319
tag name: api
tags question: http://stackoverflow.com/q/25525646
tags question: http://stackoverflow.com/q/25544278
tags question: http://stackoverflow.com/q/25418764
tags question: http://stackoverflow.com/q/25391638
tags question: http://stackoverflow.com/q/25489716
tags question: http://stackoverflow.com/q/25446993
tags question: http://stackoverflow.com/q/25480619
type: Tag
tags question: http://stackoverflow.com/q/25442069

http://stackoverflow.com/q/25451127
type: UnansweredQuestion
has body: I want the filter to keep all the values, instead of overlapping. What am I doing wrong? I want the filter to keep all of exp.substring(11,19) and not overlap ArrayList&lt;RowFilter&lt;Object,Object&gt;&gt; arrLstColorFilters = new ArrayList&lt;RowFilter&lt;Object,Object&gt;&gt;(); if (time3[i].after(time1) &amp;&amp; time3[i].before(time2)) { String exp = time3[i].getTime().toString(); please.add(exp.substring(11, 19)); RowFilter&lt;Object,Object&gt; blueFilter = RowFilter.regexFilter(exp.substring(11, 19),3); arrLstColorFilters.add(blueFilter); } sorter.setRowFilter(RowFilter.andFilter(arrLstColorFilters)); exp contains time formats: "09:19:19" Every value in arrLstColorFilters is not being displayed
has title: Table not filtering
score: 0
tagged with: filter
answer count: 0
has comment: http://stackoverflow.com/comment/39711903
tagged with: java
has comment: http://stackoverflow.com/comment/39711922
has comment: http://stackoverflow.com/comment/39712608
type: Question
has comment: http://stackoverflow.com/comment/39712532
has comment: http://stackoverflow.com/comment/39711884

http://stackoverflow.com/a/25471867
score: 0
has comment: http://stackoverflow.com/comment/39750962
type: Answer
answers question: http://stackoverflow.com/q/25471810
has body: Changed answer relevantly to the change in question. After Edit private static class Mytask extends Thread{ public void run(){ while(true){ if(Thread.currentThread().isInterrupted()){ System.out.println("Thread Interrupted"); break; } //do stuff here } } } public static void main(String[] args) throws InterruptedException { Mytask t = new Mytask(); t.start(); try{ Thread.sleep(1000); }catch(InterruptedException e){ } System.out.println("Interrupting now"); t.interrupt(); System.out.println("end after interruption"); }

http://stackoverflow.com/comment/39659391
type: AnswerComment
has text: I removed the downvoting
comment on: http://stackoverflow.com/a/25421232
type: Comment
score: 0

http://stackoverflow.com/comment/39733195
comment on: http://stackoverflow.com/q/25462299
has text: Maybe your enum was updated and new values ware added, but your `switch` wasn't updated to handle them, so in case some new added value was used in `f` method you will get `IllegalStateException`.
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39626251
comment on: http://stackoverflow.com/a/25405058
type: AnswerComment
score: 0
has text: But i need to add T2 , T3--- etc as required .
type: Comment

http://stackoverflow.com/comment/39750662
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25471597
score: 0
has text: @TauqeerAhmad I meant, did you try adding the two single quotes in the java string? Then, ErstwhileIII is right, why don't you use the java IO api and directly write to the file?

http://stackoverflow.com/comment/39715804
type: QuestionComment
has text: While I am tempted to write code that does look up a variable by its name (for instance through [JVMTI](http://en.wikipedia.org/wiki/Java_Virtual_Machine_Tools_Interface)), I think I will refrain from leading the OP any further astray. @scrapple: I am absolutely sure there are better ways of solving whatever problem you are trying to solve, but not knowing which problem that is, we can not point them out ...
comment on: http://stackoverflow.com/q/25451420
score: 0
type: Comment

http://stackoverflow.com/comment/40280665
type: Comment
comment on: http://stackoverflow.com/q/25502573
score: 0
type: QuestionComment
has text: I started using JavaMail, which is far easier to work with. Thnx

http://stackoverflow.com/comment/39741792
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25466735
type: QuestionComment
has text: I believe iut does not compile since because you're trying to pass a variable of type List<List<?>> into a method that expects an argument of type Collection<? extends Collection<T>> (calling "unwind(getList())"). The former is parametrized for a list of unknown type whereas the latter is a parametrized for a collection type T. With this structure, "unwind" method might end up returning a collection of unknown type. Is that what you want?

http://stackoverflow.com/q/25490744
linked to: http://stackoverflow.com/q/18162519
has title: "javac -version" throws Unsupported major.minor version 52.0, are my symlinks incorrect?
tagged with: macos
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39786023
answer count: 2
possible better answer: http://stackoverflow.com/a/25491340
upvote count: 3
has comment: http://stackoverflow.com/comment/39786494
downvote count: 0
has answer: http://stackoverflow.com/a/25491340
has comment: http://stackoverflow.com/comment/39786173
has comment: http://stackoverflow.com/comment/39786371
has comment: http://stackoverflow.com/comment/39785954
has comment: http://stackoverflow.com/comment/39791687
accepted answer: http://stackoverflow.com/a/25492442
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39786243
has comment: http://stackoverflow.com/comment/39790111
has answer: http://stackoverflow.com/a/25492442
score: 3
has body: These are in my /usr/bin: lrwxr-xr-x 1 root wheel 73 Aug 21 18:18 javap -&gt; /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/javap lrwxr-xr-x 1 root wheel 73 Aug 21 18:18 javah -&gt; /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/javah lrwxr-xr-x 1 root wheel 82 Aug 21 18:18 javafxpackager -&gt; /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/javafxpackager lrwxr-xr-x 1 root wheel 75 Aug 21 18:18 javadoc -&gt; /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/javadoc lrwxr-xr-x 1 root wheel 73 Aug 21 18:18 javac -&gt; /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/javac lrwxr-xr-x 1 root wheel 72 Aug 21 18:18 java -&gt; /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/java which all point to JDK v1.7.x. I'm running Max OS X 10.9.4. I stupidly attempted to downgrade from 1.8 to 1.7, which caused these issues. Trying to run javac -version throws this stack trace: zhickman:bin zhickman$ javac -version Exception in thread "main" java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:412) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(…
tagged with: javac
tagged with: java
has comment: http://stackoverflow.com/comment/39786591
has comment: http://stackoverflow.com/comment/39786320

http://stackoverflow.com/q/25509366
has body: I have FTP server written in java. No implementation of calculating speed. But when I use Solaris FTP client or winSCP and connect to my ftp server and transfer file, it shows speed at the end like : 380352 bytes sent in 0.72 seconds (51562.34 Kbytes/s) Can anybody help to let me know how this speed calculation is implemented. Or even guide where should I start looking.
type: Question
tagged with: ftp
has comment: http://stackoverflow.com/comment/39858072
tagged with: solaris
has answer: http://stackoverflow.com/a/25628578
accepted answer: http://stackoverflow.com/a/25628578
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39837953
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39820854
has title: Solaris FTP client implementation
tagged with: ftp-client

http://stackoverflow.com/q/25477562
has comment: http://stackoverflow.com/comment/39761907
has answer: http://stackoverflow.com/a/25477770
favorite count: 0
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/39762653
has title: Split Java String by space and not by double quotation (") that includes space
has comment: http://stackoverflow.com/comment/39761749
linked to: http://stackoverflow.com/q/17985909
has comment: http://stackoverflow.com/comment/39762354
has comment: http://stackoverflow.com/comment/39761765
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39761568
has comment: http://stackoverflow.com/comment/39761800
has comment: http://stackoverflow.com/comment/39762486
has comment: http://stackoverflow.com/comment/39762021
has answer: http://stackoverflow.com/a/25478073
has answer: http://stackoverflow.com/a/30253950
answer count: 3
has comment: http://stackoverflow.com/comment/39761668
score: 1
upvote count: 3
tagged with: java
downvote count: 2
has body: I want split a phrase on spaces, and not spaces within a quoted string (i.e., a string within pair of double quotation marks "). For example: software term "on the fly" and "synchrony" Should be split into these 5 segments: software term on the fly and synchrony So how could I implement this in java?

http://stackoverflow.com/comment/39882372
comment on: http://stackoverflow.com/a/25510698
type: AnswerComment
has text: But won't this add a lot of work to my server, meaning that the entire point of hosting files on S3 is missed?
score: 0
type: Comment

http://stackoverflow.com/comment/39616853
type: AnswerComment
comment on: http://stackoverflow.com/a/25396397
has text: @Anshul The actual url in page loading will be `<context-path>/resources/js/jquery.js` ..
type: Comment
score: 0

http://stackoverflow.com/comment/40327813
type: QuestionComment
has text: What OS are you using?
comment on: http://stackoverflow.com/q/25418916
score: 0
type: Comment

http://stackoverflow.com/a/25397072
has body: Paths tries to resolve a FileSystem which would contain your Path. (Actually this may be an implementation detail. The spec simply states that it will check the default FileSystem.) If you haven't registered/created such a FileSystem, it won't be able to find it. You would create a new FileSystem from the jar file and access the entry Path through that FileSystem. Path path = Paths.get("C:/foo.jar"); URI uri = new URI("jar", path.toUri().toString(), null); Map&lt;String, String&gt; env = new HashMap&lt;&gt;(); env.put("create", "true"); FileSystem fileSystem = FileSystems.newFileSystem(uri, env); Path file = fileSystem.getPath("bar.html"); System.out.println(file); You could then use Paths.get(new URI("jar:file:/C:/foo.jar!/bar.html")) Be careful to properly close the FileSystem when finished using it. For more information about ZipFileSystemProvider, see here.
answers question: http://stackoverflow.com/q/25396918
accepted answer of: http://stackoverflow.com/q/25396918
upvote count: 12
type: AcceptedAnswer
type: Answer
score: 11
downvote count: 1

http://stackoverflow.com/a/25422493
type: Answer
has comment: http://stackoverflow.com/comment/39659163
has body: If you include the 32-bit libraries and all you do is write Java code to call it and do other Java things, then yes, it will work on 32-bit machines too. Java code compiles to architecture independent byte code, there is no such thing as 32 bit or 64 bit byte code. There could only be problem if you would include the 64-bit libraries as those would not run on 32-bit machines obviously.
has comment: http://stackoverflow.com/comment/39659108
has comment: http://stackoverflow.com/comment/39659186
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25422399

http://stackoverflow.com/a/25427832
has body: You have to let the compiler know that cls_object is an instance of CSVAPI. If you don't, you can only use the object methods (toString, equals, etc.). To do this, you can do the following: rediff.inecom.catalog.product.CSVAPI cls_object = (rediff.inecom.catalog.product.CSVAPI) cls.newInstance(); Please, note that you need to have CSVAPI in your classpath!
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25427730

http://stackoverflow.com/a/25501223
accepted answer of: http://stackoverflow.com/q/25479875
type: AcceptedAnswer
downvote count: 0
has body: Can you try this syntax? @Post("json") public String sendMail(String json) { return json; } Annotated methods can contain a single argument that represents the request's entity (if any). Nb: as a side note, the Get requests does not have a payload. This instruction has no meaning: this.getRequest().getEntityAsText()
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25479875
score: 2

http://stackoverflow.com/q/25499550
has comment: http://stackoverflow.com/comment/39802236
favorite count: 0
has body: Is there any java util class and corresponding method, that returns the max element in an unsorted array ?
has comment: http://stackoverflow.com/comment/39802238
has title: Java util function for finding max element in unsorted array
has answer: http://stackoverflow.com/a/25499575
tagged with: java
has comment: http://stackoverflow.com/comment/39802272
answer count: 4
has answer: http://stackoverflow.com/a/25499814
type: Question
has answer: http://stackoverflow.com/a/25499889
downvote count: 11
score: -11
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25499626
has comment: http://stackoverflow.com/comment/39802291

http://stackoverflow.com/comment/39877512
has text: Thank you, that's a very thorough answer. I'd be really interested to know if there are any other common methods apart from size() that get inlined in this way. In your second example, if the first line had been List<String> list = Arrays.asList(arr); instead, technically size() could change in the loop. Would the JIT be able to recognise when arr isn't being modified in the loop and inline size() in this case?
comment on: http://stackoverflow.com/a/25540171
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/37683728
has body: Another possibility would be to execute a Groovy script via Jenkins Groovy console (you can reach it via JENKINS_URL/script): println(hudson.util.Secret.decrypt("zlvnUMF1/hXwe3PLoitMpQ6BuQHBJ1FnpH7vmMmQ2qk=")) Some other ways would be possible with python: https://github.com/tweksteen/jenkins-decrypt https://gist.github.com/menski/8f9980999ed43246b9b2
answers question: http://stackoverflow.com/q/25547381
type: Answer
upvote count: 19
downvote count: 0
has comment: http://stackoverflow.com/comment/70678967
score: 19

http://stackoverflow.com/comment/61505277
has text: My hero! I had the configuration file in the classpath (I think), but it was not in the src folder. I moved it in there and it is working now!
type: AnswerComment
type: Comment
score: 5
comment on: http://stackoverflow.com/a/25487455

http://stackoverflow.com/comment/39919985
score: 0
type: Comment
has text: Thank you Dmitriy, downloading now.
type: AnswerComment
comment on: http://stackoverflow.com/a/25515272

http://stackoverflow.com/comment/39695295
comment on: http://stackoverflow.com/q/25441723
type: Comment
has text: @Shijury you cannot delete an entry from a Map it expects a key also if you try to modify a map structurally by removing elements while iterating then you will get ConcurrentModification Exception. Please check my answer below
score: 0
type: QuestionComment

http://stackoverflow.com/q/25535991
accepted answer: http://stackoverflow.com/a/25555607
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: How can I force Hibernate to load my main object with some other object from ManyToOne relation? That's the moment where some other value is set, other than @Id property. Can you check my repo with maven project on github, HbnAddressDaoTest is a JUnit test class where I'm trying this behaviour Address is the entity class I would like to persist to database but only have country code from Country. All rows in Country table are constants, so Country object shouldn't be inserted again, only countryId need to be written. Is there any automation mechanism in Hibernate for this or do I have to manually load Country in some service transactional method before Address persistence?
tagged with: spring
has title: Hibernate @ManyToOne mapping - automatic loading without @Id property set
has answer: http://stackoverflow.com/a/25555607
type: Question
score: 0
answer count: 1
tagged with: jpa
tagged with: orm

http://stackoverflow.com/a/46218982
upvote count: 1
score: 1
type: Answer
has body: I get the same error on Windows (maybe de same solution works on Linux) because I have spaces on file names. If it is your case, protect the entire path of file directory with quotation marks. For example: "C:\Program Files\Pentaho Data Integration - Kettle 6.1.0.1\kitchen.bat" /file:"C:/Users/Username/Documents/Pentaho Projects/Job - System Integration.kjb" /level:Basic Another important thing is to follow the instruction given by a_horse_with_no_name (funny username by the way) using slash. Avoid the backslash instruction as given in the kitchen documentation (http://wiki.pentaho.com/display/EAI/Kitchen+User+Documentation) on its example: kitchen.bat /file:D:\Jobs\updateWarehouse.kjb /level:Basic
answers question: http://stackoverflow.com/q/25480948
downvote count: 0

http://stackoverflow.com/a/25469671
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25469583
score: 2
type: AcceptedAnswer
has body: Since your MoveListener inner class is not declared static, it inherently carries a reference to the outer class instance that uses it. Because it has a reference to the outer class, Java's compiler is able to infer what you mean since it's the only accessible method with that name in the current scope. this refers to the MoveListener in the actionPerformed method, however if you did GridButton.this.setContentAreaFilled(true) it should work as well since you are explicitly asking for the GridButton instance. The only time you should need to use the OuterClassName.this.methodName style is if the outer and inner class share a method with the same name and signature such that it would be ambiguous as to which method needs to be called. For more information on this topic, read up on Nested Classes.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25469583

http://stackoverflow.com/q/25507782
score: 0
has comment: http://stackoverflow.com/comment/39819308
has comment: http://stackoverflow.com/comment/39817923
has comment: http://stackoverflow.com/comment/39818982
tagged with: java
answer count: 1
tagged with: httpclient
has title: How do I specify the "path" section of a HTTP Post using Apache HttpClient?
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25535477
has answer: http://stackoverflow.com/a/25535477
has body: For example, this example is given on http://code.tutsplus.com/tutorials/http-headers-for-dummies--net-8039 : POST /foo.php HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (Windows; &lt;blah, blah&gt; &lt;other blah goes here&gt; I'm using Apache's HttpClient ( v.3.4.5 ), and I want to be able to specify the 'path' shown above, the '/foo.php' section. How do I do this? Thanks for your help.
has comment: http://stackoverflow.com/comment/39866060
linked to: http://stackoverflow.com/q/4582471

http://stackoverflow.com/q/25512523
tagged with: logcat
has comment: http://stackoverflow.com/comment/39827484
has comment: http://stackoverflow.com/comment/39869638
tagged with: android-logcat
possible better answer: http://stackoverflow.com/a/28797131
has comment: http://stackoverflow.com/comment/39869428
tagged with: android
tagged with: java
upvote count: 6
has comment: http://stackoverflow.com/comment/39906556
has comment: http://stackoverflow.com/comment/39826918
has answer: http://stackoverflow.com/a/31527058
accepted answer: http://stackoverflow.com/a/31527058
has title: logcat filled with java.io.IOException: Connection refused messages
type: AnsweredQuestion
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/28797131
has body: My logcat is filled with following message - E/UsDebuggingManager( 476): java.io.IOException: Connection refused E/UsDebuggingManager( 476): at android.net.LocalSocketImpl.connectLocal(Native Method) E/UsDebuggingManager( 476): at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:287) E/UsDebuggingManager( 476): at android.net.LocalSocket.connect(LocalSocket.java:130) E/UsDebuggingManager( 476): at com.android.server.DebuggingService.listenToSocket(UsDebuggingManager.java:75) E/UsDebuggingManager( 476): at com.android.server.DebuggingService.run(UsDebuggingManager.java:111) E/UsDebuggingManager( 476): at java.lang.Thread.run(Thread.java:841) I looked at UsbDebuggingManager. java and can see that a thread is trying to connect to adb server and the connection is failing. I am not getting any other messages apart from this. Any help to resolve this issue is appreciated. @MHP: I get this error as soon as I start logcat and it keeps coming. No app is running.
score: 6
favorite count: 0
type: Question

http://stackoverflow.com/q/25486674
tagged with: vaadin
has title: Vaadin Add new column to existing table
type: Question
has body: I'm having some problems to add new column to my table that is generated from one JPAContainer. The question is... I can add a new column to my existing table if my fields are inserted from JPAContainer? My code looks like... persons = JPAContainerFactory.make(Users.class, PERSISTENCE_UNIT); persons.sort(new String[]{"niu"}, new boolean[]{true}); table_1.setWidth("100%"); table_1.setSelectable(true); // Hacemos que se puedan seleccionar las filas del Grid. table_1.setMultiSelect(false);// Selección de múltiples filas del Grid. table_1.setContainerDataSource(persons); table_1.addContainerProperty("admin_vis", String.class, null); for (Iterator i = table_1.getItemIds().iterator(); i.hasNext();) { Object itemIdentifier = i.next(); Item item = table_1.getItem(itemIdentifier); String admin = (String) item.getItemProperty("admin").getValue(); Item item1 = ((Container) table_1.getContainerProperty(String.class, "admin_vis")).addItem("row"+i); if(admin.equals("Y")) { Property property = item1.getItemProperty("admin_vis"); property.setValue("true"); } else { Property property = item1.getItemProperty("admin_vis"); property.setValue("false"); } } table_1.setVisibleColumns(new Object[] { "niu", "nom", "mail", "admin_vis" }); table_1.setColumnHeaders(new String[] { "Niu", "Nom", "Mail", "Admin", }) table_1.setPageLength(15); table_1.setImmediate(true); The error that I'm having is: Caused by: java.lang.UnsupportedOperationException at com.vaadin.addon.jpacontainer.JPAContainer.addContainerProperty(JPAContainer.java:666) at com.vaadin.ui.AbstractSelect.addContainerProperty(AbstractSelect.java:772) at com.vaadin.ui.Table.addContainerProperty(Table.java:4099) Hope someone can help me. Thanks for advice!
tagged with: jpa
downvote count: 0
answer count: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/25487400
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25487400
score: 1
tagged with: java

http://stackoverflow.com/a/25431683
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25431546
answers question: http://stackoverflow.com/q/25431546
downvote count: 0
has body: Your server is waiting for a full line, i.e. a String that is terminated with \r, \n, or both. Your client does not send a line ending, thus the server's call to readLine() cannot complete until the stream ends, when the remaining (non-line-terminated) input is returned. Try sending "hi\n" and it should work.
type: Answer
has comment: http://stackoverflow.com/comment/39676427
upvote count: 3

http://stackoverflow.com/comment/39735970
score: 0
has text: @RohitJain yes it is.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25463796

http://stackoverflow.com/comment/39895916
has text: yes but the i cant do something like: b.SomeMethodADontHave();
type: Comment
comment on: http://stackoverflow.com/a/25550422
score: 0
type: AnswerComment

http://stackoverflow.com/q/25397469
answer count: 2
score: 0
possible better answer: http://stackoverflow.com/a/25397630
has body: Hi I need a regex to evaluate the condition of a while loop. Upto now I built something like this. String WhileCalc="while\\s*\\(+\\)+\\s*\\{"; This evaluate while(){ types. But To evaluate inside the conditions cant I use this approach every time. String whileCalc="while\\s*\\(+.*\\)+\\s*\\{"; Is this a good method to evaluate a while loop?
has answer: http://stackoverflow.com/a/25397630
has comment: http://stackoverflow.com/comment/39612562
type: Question
type: AnsweredQuestion
has title: Find the number of while loops in a program using regex
tagged with: java
tagged with: regex
accepted answer: http://stackoverflow.com/a/25397591
has comment: http://stackoverflow.com/comment/39612504
has answer: http://stackoverflow.com/a/25397591
has comment: http://stackoverflow.com/comment/39612516

http://stackoverflow.com/comment/39855271
type: QuestionComment
has text: Ok, I figured it out. Since the login sequence was the first thing I was doing, I hadn't gotten to any URL with `driver` yet, so its current domain was empty, not a match for `cookieDomain`. To fix this I need to send `driver` to `ROOT_URL` before I populate the cookies.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25516285

http://stackoverflow.com/comment/39742980
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25447177
has text: How are you writing these strings? If you aren't using writeUTF() it isn't going to work.
type: Comment

http://stackoverflow.com/a/25434683
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25434148
has body: You have 2 choices: Serialize the object and save it that way (Use ObjectOutputStream), or you could convert it to a String (this is what I'd do) and save the serialized string. BigDecimal has a string constructor, so it is easy to go back and forth (BigDecimal/String). ObjectOutputStream seems to be incompatible with FileUtils without a serious workaround, so you might want to do the string conversion method
score: 1
downvote count: 0

http://stackoverflow.com/comment/39834056
comment on: http://stackoverflow.com/a/25516136
score: 0
type: AnswerComment
has text: `split(",")` should be more then enough and you will need to `trim` the resulting elements to ensure they don't contain white space
type: Comment

http://stackoverflow.com/comment/39877630
type: AnswerComment
has text: I've just remembered that the length of an array is fixed, so previous comments are incorrect.
comment on: http://stackoverflow.com/a/25540171
score: 0
type: Comment

http://stackoverflow.com/a/25489620
score: 0
has comment: http://stackoverflow.com/comment/39783892
type: Answer
has body: Add the next property in your persistence.xml file. &lt;property name="eclipselink.ddl-generation" value="drop-and-create-tables"/&gt;
answers question: http://stackoverflow.com/q/25489359

http://stackoverflow.com/comment/39821649
type: AnswerComment
comment on: http://stackoverflow.com/a/25509535
has text: I am looking for (something similar) dude! I do not know how to provide the address
score: 0
type: Comment

http://stackoverflow.com/comment/39748359
type: Comment
has text: @user3814983 This sample more looks like a template. His main class is empty therefore his program won't do anything if he executes it.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25470280

http://stackoverflow.com/comment/39994029
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25546936
type: QuestionComment
has text: Hello there, feel free to answer it wasn't my intention to direct the question at someone in particular :)

http://stackoverflow.com/a/25424704
score: 0
has comment: http://stackoverflow.com/comment/39764718
has comment: http://stackoverflow.com/comment/39722247
has body: Since so many of answers talk about why this is a bad idea, so I won't repeat it. One solution that comes to my mind is to use an counter object. Whenever you want a particular counter to go out of scope, set that to null. If you use it after this point, a Null pointer access warning is shown (at least in eclipse. I suspect other IDEs should also have this feature. Not sure whether javac generates a warning). public class DisappearingVariables { public static class Counter { int i = 0; public Counter() { } public void inc() { i++; } public int get() { return i; } } public static void main(String[] args) { for(Counter i = new Counter(), oi = i; i.get() &lt; 10; i = oi, i.inc()) { System.out.println("i = " + i.get()); i = null; i.inc(); // This line gets a warning for(int j = 0; j &lt; 10; j++) { } } } }
answers question: http://stackoverflow.com/q/25423743
type: Answer
has comment: http://stackoverflow.com/comment/39722197
has comment: http://stackoverflow.com/comment/39770326
has comment: http://stackoverflow.com/comment/39764703

http://stackoverflow.com/a/25510236
type: AcceptedAnswer
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39825601
has comment: http://stackoverflow.com/comment/39826542
has body: The ServletRequest#setCharacterEncoding(String) method only sets the encoding used for the body of the request. There is no method you can use from the Servlet API to declare an encoding for the request URI. This is servlet container specific. With Tomcat, you need to do it at the &lt;Connector&gt; level. There's always the useBodyEncodingForURI config element you can use in &lt;Connector&gt; for setCharacterEncoding to do what you want. See here.
answers question: http://stackoverflow.com/q/25510085
type: Answer
has comment: http://stackoverflow.com/comment/39824309
accepted answer of: http://stackoverflow.com/q/25510085
score: 1

http://stackoverflow.com/comment/39867456
comment on: http://stackoverflow.com/q/25517486
score: 0
type: Comment
type: QuestionComment
has text: your emulator is not configured right, moreover none of these logs are associated to your code.. try filtering your logcat to use app:{package name goes here}

http://stackoverflow.com/a/25419105
upvote count: 2
has comment: http://stackoverflow.com/comment/39655256
has comment: http://stackoverflow.com/comment/39652934
has comment: http://stackoverflow.com/comment/39652914
has comment: http://stackoverflow.com/comment/39652902
has comment: http://stackoverflow.com/comment/39653005
has comment: http://stackoverflow.com/comment/39655073
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39870086
has body: You need to override getPreferredSize() in the GamePanel class. You should always do this when doing custom painting. The panel has no preferred size because it has no components. And the layout you are using FlowLayout takes the preferred size into consideration. Then just pack() the frame, instead of setting the size. Also note that setSize() for components is generally used for null layouts (which I strongly am against). With layout managers, they are determine by preferredSize public class GamePanel extends JPanel { private Image image; @Override public Dimension getPreferredSize() { return new Dimension(image.getWidth(this), image.getHeight(this)); // or whatever you want the size to be } } Aside: /*handled in paintComponent()*/ - A null check isn't a substitute for an empty catch block. frame.setVisible() should the last thing you do after adding all your components UPDATE As @MadProgrammer pointed out to me, you want the panel to resize with the frame. In order to do that, you need to use a different layout manager. The two that won't respect the preferred size of your panels will be either GridLayout or BorderLayout. These will "stretch your components to fit". So choose one of them, or a combination of both, seeing as you have nested panels. But you should also keep the overriden getPreferredSize() and still pack() your frame This will give you the initial size of the frame, based on your preferred size
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25419041
type: Answer
has comment: http://stackoverflow.com/comment/39652866
answers question: http://stackoverflow.com/q/25419041

http://stackoverflow.com/q/25452927
tagged with: elasticsearch
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39715923
has answer: http://stackoverflow.com/a/41183495
has comment: http://stackoverflow.com/comment/39715665
has title: Data directory in elastic search created inside project folder
has comment: http://stackoverflow.com/comment/39715605
downvote count: 0
tagged with: maven
has body: I am using Java API (maven project) for elastic search. I configured elasticsearch.yml for path.data field as one of the directories. But when I run my code for indexing, in addition to the folder mentioned in config yml file, it also creates a /data/ directory inside the root of the project folder. I am unable to understand why it do so. Can someone please help. In elasticsearch.yml path.data: /data/servers/es.data Thanks.
score: 1
has comment: http://stackoverflow.com/comment/39715494
upvote count: 1
answer count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39715741
tagged with: java
has comment: http://stackoverflow.com/comment/39718968

http://stackoverflow.com/q/25400109
has comment: http://stackoverflow.com/comment/39618820
type: Question
has body: I am trying to create a simple game that can work in different platforms as a proof of concept. For now I am happy to have it working for both J2SE (using AWT or Swing) and Android. I decided to use Java for the logic of the game as both platforms expects Java code. The idea is creating a set of interfaces to abstract the OS and have a clean straight-forward game logic using these interfaces. And having 2 implementations of these interfaces, one per platform. Some code to describe what I mean: public class MyGameLogic implements GameLogic { private GameSprite _sprite; @Override public void init(GamePlatform platform) { _sprite = platform.loadSprite("arena"); } @Override public void draw(GameCanvas canvas) { canvas.drawSprite(_sprite, 100, 200); } } Here GamePlatform, GameSprite and GameCanvas would be interfaces. These interfaces will be implemented in a different way for the different platforms depending on the platform capabilities and APIs. In a similar way, GameLogic is an interface that is implemented by the game logic and not the platform. The platform will use the GameLogic interface to initialise the logic and redrawing every time is required, but more method are expected to be added in the future. Even if I think this option is great, I see 2 flows in this design: * the game logic can create its own implementation of GameSprite and call drawSprite() with it, which is not expected by the platform implementation. * the implementation of the platforms must cast back all the interfaces in order they can access the real data inside the GameSprite. So if the GameSprite returned in loadSprite for J2SE is in reality a J2SESprite class, which implements GameSprite, when calling draw() I should cast the GameSprite back to J2SESprite. In order to solve the problem I thought in adding generics, but it will make the code really ugly, here is the same code with generics. public class MyGameLogic&lt; Sprite extends GameSprite, Platform extends GamePlatform, Canvas extends…
has title: Which design pattern should be used to avoid other implementations?
has answer: http://stackoverflow.com/a/25400495
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/39618628
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/39618212
score: 0
tagged with: java

http://stackoverflow.com/comment/39787785
type: Comment
has text: Plus it was not the worst question I've seen here. The OP supplied his code and wrote that it doesn't work for some cases. So i don't really get the downvoter, especially that he/she didn't want to explain his reasons... Now that's a bad SO practice. But hey! Who am I to judge;)
comment on: http://stackoverflow.com/a/25474637
type: AnswerComment
score: 0

http://stackoverflow.com/comment/39717432
type: QuestionComment
type: Comment
score: 0
has text: Mind Peace : what does that mean?
comment on: http://stackoverflow.com/q/25453794

http://stackoverflow.com/q/25423133
tagged with: mpxj
favorite count: 0
type: Question
has title: How to Fetch Task Notes from MS Project File (.mpp) if an Image/text is Attached to it
has body: I have been trying to fetch Notes attached to a task using the MPXJ library,using the method getNotes() from the class net.sf.mpxj.Task However the return type of the method is a String, and you can even insert Images and other Files as notes to the Task. My question is How Would it be possible for me to retrieve an image attached to the task. Also if I attach a plain text note to the Task eg. in this case the note is "This is Task 200" It is retrieved as the following Text {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang16393{\fonttbl{\f0\fnil\fcharset0 Segoe UI;}} {\*\generator Riched20 15.0.4567}{\*\mmathPr\mwrapIndent1440 }\viewkind4\uc1 \pard\f0\fs20 This is Task 200\par } I would be great is somebody could give a feedback on this.
downvote count: 0
tagged with: ms-project
tagged with: ms-office
accepted answer: http://stackoverflow.com/a/25567151
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25567151
score: 1
tagged with: java
answer count: 1
upvote count: 1

http://stackoverflow.com/a/25404379
has body: You have used different reference. You should use same reference so that only you can access the value.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25404348

http://stackoverflow.com/q/25421770
possible better answer: http://stackoverflow.com/a/25421818
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25421818
answer count: 2
upvote count: 2
downvote count: 0
has body: I wrote a test to see how setCompressionQuality() effects the file size and quality. However all the files created are the same size indicating that perhaps I'm doing something wrong. I've looked at many guides online on how to do this and other questions on stackoverflow and I still can't spot my mistake. Any ideas. SSCCE below. Background: Why am I using JPEG for screenshots!!? Yes I realize PNG is the tool for the job, but I'm trying to implement a "low quality" mode on a custom in-house remote desktop solution running over a low bandwidth link, the quality really doesn't matter as long as the user can sort of see what is going on. import java.awt.AWTException; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.imageio.ImageWriteParam; import javax.imageio.ImageWriter; import javax.imageio.stream.ImageOutputStream; public class ImageCompressionJpg { public static void main(String[] args) throws AWTException, IOException { Robot robot = new Robot(); BufferedImage image = robot.createScreenCapture(new Rectangle(Toolkit .getDefaultToolkit().getScreenSize())); ImageIO.write(image, "jpg", new File("screen.standard.jpg")); // JPEGs, different qualities 0 - 1 for (float quality = 0; quality &lt;= 1; quality += 0.2) { ImageWriter writer = (ImageWriter) ImageIO .getImageWritersByFormatName("jpeg").next(); ImageWriteParam param = writer.getDefaultWriteParam(); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(quality); ImageOutputStream ios = ImageIO.createImageOutputStream(new File( String.format("screen.%.1f.jpg", quality))); writer.setOutput(ios); writer.write(image); } } }
tagged with: javax.imageio
score: 2
type: AnsweredQuestion
has title: Can't get JPEG compression to work with ImageIO
accepted answer: http://stackoverflow.com/a/25421846
tagged with: java
has answer: http://stackoverflow.com/a/25421846
tagged with: bufferedimage

http://stackoverflow.com/a/31577395
answers question: http://stackoverflow.com/q/25452069
has body: ExecutorServise will have a pool of Threads to execute your Runnable tasks, you defined the size of the pool to be 4, I would change that to be the number of cpus in the machine: int threadCount = Runtime.getRuntime().availableProcessors(); ExecutorService executor = Executors.newFixedThreadPool(threadCount); Also, it appears that you are sending Threads to the executor to execute them in one of the available threads in it's pool, It's redundant, you might change your MyThread to a Runnable task.
score: 1
type: Answer
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25437004
answers question: http://stackoverflow.com/q/25436097
type: Answer
score: 3
has body: As you can read here: a PopupWindow does have its own Scene. Scene's root gets the .root style-class by default and the root scene of a PopupWindow to have distinct styles via the CSS rule .root.popup { /* declarations */ } So basically, what is happening is that you are applying the same dark background of your scene to the popup that shows the menu. If you want a different background, or none, you just need to add to your css file the following CSS rule: .root.popup { -fx-background-color: transparent; }
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25436097

http://stackoverflow.com/a/25641526
score: 0
type: AcceptedAnswer
has body: The problem was caused by the repository. It crashed sometime ago and corrupted the .properties files. After fixing this, the problem disappeared.
accepted answer of: http://stackoverflow.com/q/25422876
type: Answer
answers question: http://stackoverflow.com/q/25422876

http://stackoverflow.com/q/25403343
score: 0
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39622910
favorite count: 0
tagged with: ip
type: Question
tagged with: jakarta-ee
has body: I am using the following code to get the Client's Ip Address. But for all the headers, i am getting null value. And request.getRemoteAddr() returns IP address of the machine on which Tomcat server is running. So, what is the efficient way to get the IP address of the machine from which request is coming ? private static final String[] HEADERS_TO_TRY = { "X-Forwarded-For", "Proxy-Client-IP", "WL-Proxy-Client-IP", "HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED", "HTTP_X_CLUSTER_CLIENT_IP", "HTTP_CLIENT_IP", "HTTP_FORWARDED_FOR", "HTTP_FORWARDED", "HTTP_VIA", "REMOTE_ADDR" }; public static String getClientIpAddress(HttpServletRequest request) { for (String header : HEADERS_TO_TRY) { String ip = request.getHeader(header); if (ip != null &amp;&amp; ip.length() != 0 &amp;&amp; !"unknown".equalsIgnoreCase(ip)) { return ip; } } return request.getRemoteAddr(); }
tagged with: network-programming
has comment: http://stackoverflow.com/comment/39683513
type: UnansweredQuestion
tagged with: http-headers
has title: How to get Client's IP address in Java? Request.getRemoteAddr() returns IP address of the machine on which Tomcat server is running
has comment: http://stackoverflow.com/comment/39625154
has comment: http://stackoverflow.com/comment/39622853
linked to: http://stackoverflow.com/q/527638
answer count: 0

http://stackoverflow.com/comment/39821224
type: QuestionComment
has text: In the `/system/console` it says that it's active under the **Status** column. I've also specified the artifactId as a dependency as well as an embedded in the pom.xml of packaging type content-package for the jcr folders that we are uploading (apps and etc)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25494878

http://stackoverflow.com/q/25549362
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25549749
has title: Java: replace character inside a matching regex
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25549749
tagged with: regex
possible better answer: http://stackoverflow.com/a/25549426
answer count: 4
favorite count: 0
tagged with: pattern-matching
tagged with: replace
type: Question
has comment: http://stackoverflow.com/comment/39893696
has answer: http://stackoverflow.com/a/25549574
downvote count: 0
has body: I have a string. Let's say: String s = "This is my P.C.. My P.C. is the best.O.M.G!! Check this..."; I want to replace all the P.C. to PC words and O.M.G to OMG. In general, I want to replace all the dots that are between single letters OR single letter and a space or dot. I think the matching regex for that is: [^A-Za-z][A-Za-z]\\.[A-Za-z\\s\\.][^A-Za-z] How can I replace only the dot from that and not everything that matches? EDIT: Expected output: "This is my PC. My PC is the best.OMG!! Check this..." EDIT2: The basic task is to remove dots from abbreviations and acronyms that could be written with or without dots. So a good regex is also valuable
upvote count: 1
has answer: http://stackoverflow.com/a/25549522
has answer: http://stackoverflow.com/a/25549426

http://stackoverflow.com/comment/39721971
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25456207
score: 0
has text: I know it doesn't have anything to do with it or at least it shouldn't but it just won't move the mouse and click when Chrome is in focus. I can't figure out what the issue is. And no, it is not an applet.

http://stackoverflow.com/comment/39812396
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25502222
has text: @PeterMmm, Of course I've changed parameters for this question. I don't wanna share my password and username too.

http://stackoverflow.com/comment/39878712
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25539987
score: 0
has text: Your css is generally in 1 location not 2… I suspect that your URLs differ and that you use the wrong URIs to retrieve the css. I suspect you use relative instead of absolute URIs.

http://stackoverflow.com/comment/39683266
comment on: http://stackoverflow.com/q/25433763
type: QuestionComment
type: Comment
has text: Have you tried using a [`PriorityQueue`](http://docs.oracle.com/javase/7/docs/api/java/util/PriorityQueue.html) with a custom comparator?
score: 0

comparison
tags question: http://stackoverflow.com/q/25527856
tag name: comparison
type: Tag
tags question: http://stackoverflow.com/q/25435266
tags question: http://stackoverflow.com/q/25525140
tags question: http://stackoverflow.com/q/25478624
tags question: http://stackoverflow.com/q/25489102
tags question: http://stackoverflow.com/q/25447390
tags question: http://stackoverflow.com/q/25433081

http://stackoverflow.com/q/25430004
has title: java.lang.unsatisfiedLinkError caused by the package name
tagged with: java-native-interface
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25437197
type: Question
has body: My program works well, if I just put it in the default package. Once I put it in a specific package it does not work. I get the following error messag: Error Message: Exception in thread "main" java.lang.**UnsatisfiedLinkError**: mypackage.my_java_class_name.nativeUpload(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; OS: Ubuntu 12.04 32bits Java version: openjdk 7 Compiling: javac mypackage/my.java javah -jni mypackage.my_java_class_name gcc -shared -fpic -o mylib.so -I/Path_of_jdk/Include -I/Path_of_jkd/Include/linux my.c Running: java -Dava.library.path=/path_of_myprogram/
has comment: http://stackoverflow.com/comment/39672937
type: UnansweredQuestion
tagged with: package
score: 0

http://stackoverflow.com/q/25481582
tagged with: database
has answer: http://stackoverflow.com/a/25515307
has comment: http://stackoverflow.com/comment/40198695
score: 0
has title: How to assign value to an object in yaml file playframework 1.2.5
tagged with: playframework
tagged with: yaml
tagged with: java
answer count: 1
type: Question
tagged with: one-to-one
has body: I'm trying to make a one-to-one relationship between two tables by using playframework 1.2.5. I would like to create rating list for each user after this mapping. The java code is here: User.java @Entity @Table(name = "`user`") public class User extends Model { public String name; public String surname; public String password; public String username; public Date lastlogin; } UserRating.java @Entity @Table(name = "`userrating`") public class UserRating extends Model { public double rating; @OneToOne() @JoinColumn(name="id_user") public User user; } My yaml file is like that. However, I encountered this error: Cannot parse the /conf/initial-data.yml file: mapping values are not allowed here. Could you help to fix this error? initial-data.yml - &amp;user19 id: 19 name: freud surname: lily password: x56 username: freud lastlogin: 2010-05-02 - &amp;user20 id: 20 name: osman surname: özsu password: 798 username: osman lastlogin: 2004-12-11 UserRating(1): rating: 1.2 user: - *user20
type: UnansweredQuestion

http://stackoverflow.com/a/25520310
score: 0
answers question: http://stackoverflow.com/q/25515248
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25515248
has body: The problem is that, in production, the generated blob upload Urls (createUploadUrl(..)) are on servers separate from your app servers. OTOH requestDispatcher.forward(..) only works within the same servlet container. This works on development server because blob upload urls are simulated and run in the same servlet container. The solution is either to: forward the whole request via Url Fetch (which makes a full new outgoing Http request), or preferably make upload in two steps: first get Upload url from server, then upload blob to that url.
type: Answer
has comment: http://stackoverflow.com/comment/39847835

themes
type: Tag
tags question: http://stackoverflow.com/q/25411283
tag name: themes

http://stackoverflow.com/comment/39718761
score: 0
has text: It's worth noting that anonymous classes need not be declared as an *interface* implementation. They can be declared as any non-primitive type, all the way up to `Object`.
comment on: http://stackoverflow.com/a/25453305
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/39754020
comment on: http://stackoverflow.com/q/25472956
type: QuestionComment
has text: @JonK: Seriously Jon :D, Boann has pointed out to the problem in his comment.
type: Comment
score: 0

http://stackoverflow.com/a/25493391
type: AcceptedAnswer
has body: You're binding BaseAbstract as a Singleton instead of Concrete. Try this: bind(BaseAbstract.class).to(Concrete.class); bind(Concrete.class).toProvider(ConcreteProvider.class).in(Scopes.SINGLETON);
score: 6
accepted answer of: http://stackoverflow.com/q/25492831
type: Answer
answers question: http://stackoverflow.com/q/25492831
downvote count: 0
upvote count: 6

http://stackoverflow.com/q/25443945
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25453481
has title: elasticsearch is taking time while doing update and search simultaneously
type: Question
has answer: http://stackoverflow.com/a/25453481
has comment: http://stackoverflow.com/comment/39708692
has comment: http://stackoverflow.com/comment/39733642
tagged with: elasticsearch
has comment: http://stackoverflow.com/comment/39742839
has body: I'm doing update in elasticsearch document and the same time one rest api is calling for search results. Below is my code. public String updateElasticsearchDocument(String index, String type, List&lt;String&gt; indexID) { Client client = ESClientFactory.getInstance(); UpdateResponse updateResponse = null; JSONObject jsonResponse = new JSONObject(); JSONObject json =new JSONObject(); int i=1; try { for(String id : indexID) { updateResponse = client.prepareUpdate(index, type, id) .setDoc(jsonBuilder() .startObject().field("view_mode", "read") .endObject()) .setDocAsUpsert(true) .setFields("_source") .execute().actionGet(); logger.info("updating the document for type= "+ updateResponse.getType()+ " for id= "+ updateResponse.getId()); json.put("indexID"+i, updateResponse.getId()); i++; } jsonResponse.put("updated_index", json); } catch (ActionRequestValidationException e) { logger.warn(this.getClass().getName() + ":" + "updateDocument: " + e.getMessage(), e); } catch (ElasticsearchException e) { logger.warn(this.getClass().getName() + ":" + "updateDocument: " + e.getMessage(), e); e.printStackTrace(); } catch (IOException e) { logger.warn(this.getClass().getName() + ":" + "updateDocument: " + e.getMessage(), e); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return jsonResponse.toString(); } Search query I'm pusing is here POST /monitoring/quota-management/_search { "query": {"match": { "view_mode": "read" }}, "sort": [ { "_timestamp": { "order": "desc" } } ], "size": 10 } Now there is time gap between these 2 requests, I have to wait for like 40-50 seconds to get the updated search result. This is affecting the production application. Please let me know what needs to be done here to minimizes the time taken -Subhadip
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/25446196
score: 3
type: Answer
answers question: http://stackoverflow.com/q/25445952
has body: When you create a Child object a Parent constructor is invoked as well, because a Child is a Parent. But when you do this: System.out.println(child.getClass().getSuperclass().hashCode()); you're not invoking Parents instance hashode. You are invoking hashCode() of the instance of the Class object. See what child.getClass().getSuperclass() returns. It returns an instance of type Class not of type Parent/Child. You cannot invoke Parents instance methods using child.getClass().getSuperClass() - that doesn't return the instance of a type, but an object representing this type. Try doing this in child method: @Override public int hashCode() { System.out.println("In child hashCode: " + i); System.out.println("Parents hashCode: " + super.hashCode()); return i; } This will return 100 and 0, as Parents s hasn't been initialized.
has comment: http://stackoverflow.com/comment/39704358
has comment: http://stackoverflow.com/comment/39702560
has comment: http://stackoverflow.com/comment/39702338
upvote count: 3
has comment: http://stackoverflow.com/comment/39704057
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39703568
downvote count: 0
has comment: http://stackoverflow.com/comment/39703106
has comment: http://stackoverflow.com/comment/39702850
has comment: http://stackoverflow.com/comment/39702220
has comment: http://stackoverflow.com/comment/39703583
accepted answer of: http://stackoverflow.com/q/25445952

http://stackoverflow.com/q/25480617
tagged with: variable-assignment
upvote count: 1
downvote count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25480724
answer count: 5
has answer: http://stackoverflow.com/a/25480694
tagged with: variables
has answer: http://stackoverflow.com/a/25480819
has title: Confusion regarding variable assignment and allocation
has answer: http://stackoverflow.com/a/25480685
has comment: http://stackoverflow.com/comment/39767260
has answer: http://stackoverflow.com/a/25480765
possible better answer: http://stackoverflow.com/a/25480765
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39767387
accepted answer: http://stackoverflow.com/a/25480724
has body: Below is the Test program for the concept of inheritance. If I am running this program then the o/p is "Im A's method - 1" and if I remove the comment then the output is "Im b's method - 2". class A { public void test(int x){ System.out.println("Im A's method - 1"); } public void test(Integer x){ System.out.println("Im A's method - 2"); } } class B extends A{ public void test(Integer x){ System.out.println("Im b's method - 1"); } // public void test(int x){ // System.out.println("Im b's method - 2"); // } // } public class Test { /** * @param args */ public static void main(String[] args) { A a=new B(); a.test(2); } } Question: As per my knowledge it should not extend to class A. Correct me please !!!
tagged with: java

http://stackoverflow.com/comment/39792153
comment on: http://stackoverflow.com/q/25493837
score: 1
has text: You closed the ResultSet, so everything is deleted. Why you want to use it? Extract the data before you close it and return the data
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25467704
tagged with: java
has answer: http://stackoverflow.com/a/39265072
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
tagged with: android
has title: How to launch specific activity from GooglePlayGames invitation
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41173058
score: 2
has body: I'm trying to create a new android application that is comprised of multiple mini-games. The launcher activity extends BaseGameActivity and has a sign-in button and a ListView containing all the possible games that can be played. Inside of a mini-game activity (also extends BaseGameActivity), how can I get it to create a notification which will launch a specific Activity? Currently, when I call invitePlayersToGame, the invitation that gets sent is for the full application (Mini-Games) and not the individual game (specific dice game). public void invitePlayersToGame(View pView) { Intent intent = Games.RealTimeMultiplayer.getSelectOpponentsIntent(getApiClient(), 1, 1); intent.putExtra("gameName", "Patman Yahtzee"); startActivityForResult(intent, RC_SELECT_PLAYERS); } Is there a way to get the notification to generate with a specific message? Is there a way to get notification to open directly to the mini-game activity without going to the main launcher activity first? Any help is appreciated. Thanks!
tagged with: google-play-games
has comment: http://stackoverflow.com/comment/52416481

http://stackoverflow.com/q/25530927
has answer: http://stackoverflow.com/a/25532253
tagged with: spring
tagged with: javabeans
has title: Using spring beans in jasper reports
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/25532253
tagged with: java
answer count: 1
type: Question
tagged with: jasper-reports
has body: I have a spring bean: And in a jrxml: my.package.CustomerWrapper.lookupWithMainAddress($P{cust_id}, "informationLine") But this is throwing a NullPointerException because customerWrapperCache is null. What is the correct way to do this?

http://stackoverflow.com/comment/39794167
type: QuestionComment
comment on: http://stackoverflow.com/q/25493948
type: Comment
score: 0
has text: @Nicolai You could simply follow the link provided by HFOE: [MVCE](http://stackoverflow.com/help/mcve) and read what's in it. It guides you through the entire process of building MVCE. No sorcellery, no mistery, no black magic. Follow the steps and you will get there.

http://stackoverflow.com/comment/39705698
type: AnswerComment
comment on: http://stackoverflow.com/a/25447981
has text: @JeroenVannevel No they don't hide it. It's JVM magic, the constructor is never called (which can be easily tested).
type: Comment
score: 0

http://stackoverflow.com/comment/39753583
score: 0
type: Comment
type: AnswerComment
has text: @jameslarge: using notifyAll() is safer. If another thread waits on the same lock to do something other than producing values, then you have a deadlock. notifyAll() is simpler: everyone is woken up, checks if the condition to restart is fulfilled, and goes back to sleep if it isn't.
comment on: http://stackoverflow.com/a/25472600

http://stackoverflow.com/comment/39652557
has text: you can do this after setContentView if you want the place this code before setContentView() and this only can be achieved when you go to this activity you cant call windowmanger for full screen on button click
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25418959
type: QuestionComment

http://stackoverflow.com/q/25447878
has comment: http://stackoverflow.com/comment/39707942
has body: Is it possible to use FetchGroup when the entity you are fetching has a reference to an abstract class but you want to fetch an attribute that belongs only to one of the possible inheriting classes. For example... A pet has an owner (owner is an abstract class) and an owner can be a person or a shelter. A person has an attribute... lets say age, and I want that. public Pet findPetSlim(Integer id) { Pet result = null; FetchGroup group = new FetchGroup("PetSlim"); group.addAttribute("id"); group.addAttribute("owner.age"); //this will not work because owner doesn't have age Query q = getEntityManager().createQuery("Select p from Pet p where p.id = :id").setParameter("id", id); q.setHint(QueryHints.FETCH_GROUP, group); result = (Pet) q.getSingleResult(); return (result); }
has title: EclipseLink FetchGroup fetching inherited attributes
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39706784
score: 0
has comment: http://stackoverflow.com/comment/39706502
answer count: 0
tagged with: eclipselink
tagged with: java
tagged with: jpa

http://stackoverflow.com/comment/39737016
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25463751
has text: As I said: the controllers are your backend, which is called from tge frontend. What you perhaps meant is the "frontcontroller" which is also part of tge backend.

http://stackoverflow.com/q/25413611
type: Question
has comment: http://stackoverflow.com/comment/39671539
has body: Our application uses Log4J for its logging purposes. I recently finished implementing and testing our Log4J capabilities on my local server in RAD 7.5. The property settings for this are below. # Set root category priority to INFO and its only appender to CONSOLE. log4j.rootCategory= INFO, CONSOLE, rollingFile #log4j.rootCategory=INFO, CONSOLE, LOGFILE # Set the enterprise logger category to FATAL and its only appender to CONSOLE. log4j.logger.org.apache.axis.enterprise=INFO, CONSOLE, rollingFile # CONSOLE is set to be a ConsoleAppender using a PatternLayout. log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.Threshold=INFO log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n #rolling file storage - dp0jmr 07/24/2014 log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender log4j.appender.rollingFile.File=C:\\applogs\\WPM\\wpmlog.log log4j.appender.rollingFile.MaxFileSize=10MB log4j.appender.rollingFile.MaxBackupIndex=20 log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout log4j.appender.rollingFile.layout.ConversionPattern=%p %t %c - %m%n With some careful fiddling, and adding in log calls to all the appropriate areas of our application, I managed to get the app generating log files in the specified location on my computer, c:\applogs\WPM\wpmlog.log. On deploying this application to our development server, I've made the following change to one line of the above code. log4j.appender.rollingFile.File=/applogs/WPM/wpmlog.log Note the changed directory at the end of this line. This is the appropriate directory into which I want our application logs to be written. However, when I go to this location in winscp after performing an action in the application that should write to the log, I find no wpmlog.log file at all. I have not moved or altered the log files in any way other than to change the directory to which it should be writing. I do not believe there is a…
has comment: http://stackoverflow.com/comment/39667263
tagged with: logging
has title: Log4j not writing to the development server
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: log4j

http://stackoverflow.com/comment/40137235
type: Comment
comment on: http://stackoverflow.com/a/25463773
type: AnswerComment
has text: That is a valid email id
score: 0

http://stackoverflow.com/comment/39747013
score: 0
type: AnswerComment
has text: moved the jar files to the folder of the java program (no spaces in name) with this result - C:\AZ_Fantasy5>cd \AZ_Fantasy5 C:\AZ_Fantasy5> C:\AZ_Fantasy5>javac JdbcPostgresqlConnection.java C:\AZ_Fantasy5> C:\AZ_Fantasy5>java -cp .;C:\AZ_Fantasy5\postgresql-9.3-1102.jdbc4.jar C:\AZ_Fan tasy5\JdbcPostgresqlConnection Error: Could not find or load main class C:\AZ_Fantasy5\JdbcPostgresqlConnection
type: Comment
comment on: http://stackoverflow.com/a/25469179

http://stackoverflow.com/a/25418257
has body: First of all expand the scope of size,weight and userInfo means keep it inside main but outside the conditions as it is being used everywhere. Something like this. int selection = 0; String size = null; String weight = null; Creature userInfo = null; Instead of this creature.add(userInfo); should be user.add(userInfo); and call display like this userInfo.displayCr(); because the return type of the method is void so cannot be used inside sysout and it should be inside that else if(){}
has comment: http://stackoverflow.com/comment/39666575
has comment: http://stackoverflow.com/comment/39667102
type: Answer
answers question: http://stackoverflow.com/q/25418122
score: 0

http://stackoverflow.com/comment/119997635
has text: I have "no main manifest attribute" error trying to run the jar generated in this way
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/59241391

http://stackoverflow.com/q/25443360
tagged with: java
tagged with: ssh
answer count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25443915
type: UnansweredQuestion
tagged with: keystore
tagged with: scp
has title: SCP from a Java program with a Java Keystore
linked to: http://stackoverflow.com/q/652916
has body: I need to SCP files (e.g. csv files) to another server in a java program. The RSA keys for SCP are stored in a java keystore. I have not been able to find any code which allows one to do this. Can anyone provide some sample code or ideas on how to do this? (I have found some code that works with id_rsa String. But they are a different format. And trying to extract/convert to that format is proving difficult)
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/25496979
type: Answer
answers question: http://stackoverflow.com/q/25496580
has comment: http://stackoverflow.com/comment/39816195
has body: public void onClick_start_thread_a(View v) { logger.d("onClick_start_thread_a"); Runnable r = new Runnable() { @Override public void run() { // TODO Auto-generated method stub while (true) { synchronized (flag) { System.out.println("Thread A!"); flag.notifyAll(); try { flag.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } }; Thread t = new Thread(r); t.start(); } public void onClick_start_thread_b(View v) { logger.d("onClick_start_thread_b"); Runnable r = new Runnable() { @Override public void run() { // TODO Auto-generated method stub while (true) { synchronized (flag) { System.out.println("Thread B!"); flag.notifyAll(); try { flag.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } }; Thread t = new Thread(r); t.start(); }
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39817091
has comment: http://stackoverflow.com/comment/39804087
has comment: http://stackoverflow.com/comment/39816639
score: 1

http://stackoverflow.com/a/25443194
answers question: http://stackoverflow.com/q/25443038
type: Answer
score: 0
has body: Try the regex below. It would get you all groups of .number.. You would have to yoin the nymbers later though. (\.[0-9]+\.)+ Try this site for further tests: http://www.regexplanet.com/advanced/java/index.html

http://stackoverflow.com/q/25498993
accepted answer: http://stackoverflow.com/a/25506948
score: 0
tagged with: junit4
tagged with: powermock
has comment: http://stackoverflow.com/comment/39801872
has comment: http://stackoverflow.com/comment/39803141
has title: Method getting mocked but Value not correctly returned
tagged with: java
has comment: http://stackoverflow.com/comment/39801528
has comment: http://stackoverflow.com/comment/39801259
tagged with: easymock
type: Question
has answer: http://stackoverflow.com/a/25506948
has body: I am trying to unit test my class which is looks something like:- class A{ private void method1(){ B b=new B(); C c=b.method2(); if(c!=null){ ... ... } } } I want to mock "method2()" inside Class B. I know that we need to have a mock object of B() so that whenever we call a method on it mocking happens. This is what I have tried A aMock=Easymock.createNiceMock(A.class); B bMock=Easymock.createNiceMock(B.class); Powermock.expectNew(B.class).andReturn(bMock).anyTimes(); Easymock.expect(bMock.method2()).andReturn(new C()).anyTimes(); //have done all the replays and verifies and call it using aMock.method1(), now the main problem is method2is getting mocked( i.e body of method2() is not getting executed)but I am not able to receive object of C as response from this. My test scenario is:- I want to test method1() of Class A which in turn calls method2() of class B ,but I dont want it to execute its code(of method2()) and as it is a DB call and I also need the Object of C that is returned by method2() so I am using mocking to achieve this.
answer count: 1
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/39801310
type: AnsweredQuestion

http://stackoverflow.com/comment/39719707
comment on: http://stackoverflow.com/a/25455080
type: Comment
has text: Looks like my answer crossed in the post. However it shows a slightly different case, that is where the initial variable is defined with a precision rather than a scale.
type: AnswerComment
score: 1

http://stackoverflow.com/comment/39807885
has text: could you please explain how the first example might break?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25501994
type: Comment

http://stackoverflow.com/a/25527285
has comment: http://stackoverflow.com/comment/39878357
has comment: http://stackoverflow.com/comment/39853937
score: 0
has comment: http://stackoverflow.com/comment/39887192
answers question: http://stackoverflow.com/q/25527163
has comment: http://stackoverflow.com/comment/39853561
has comment: http://stackoverflow.com/comment/39890442
type: Answer
has body: Did you implement that using listView ? If yes, did you use this method in your Activity A ? public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id)

http://stackoverflow.com/q/25394908
type: AnsweredQuestion
has title: BufferedWriter array elements in new line
tagged with: bufferedwriter
has comment: http://stackoverflow.com/comment/39608101
score: 1
tagged with: java
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0
type: Question
tagged with: newline
tagged with: arrays
accepted answer: http://stackoverflow.com/a/25394942
has comment: http://stackoverflow.com/comment/39608025
has answer: http://stackoverflow.com/a/25394942
tagged with: tostring
has body: looked through a lot of similar subjects, couldn't find something that works for me :/ All I want to do is to write every element of an array to a text file. Arrays.toString(array); That code gives me every element in one line and also brackets around the whole list of elements. Thats not what I want. The elements of the array are only text. For example: this is a test this is testline number 2 The array here is btw already a string array. String[] array = new String[5]; My code so far is following: public void dateiausgeben() throws NullPointerException { try { FileWriter fw = new FileWriter("neueDatei.txt"); BufferedWriter bw = new BufferedWriter(fw); for (int i = 0; i &lt; array.length;i++) { //String str = array[i].toString(); //System.out.println("array 0 ="+array[0]+"\n array 1 ="+array[1]+"\n array 2= "+array[2]+"\n array 3="+array[3]); bw.write(array[i].toString()); } bw.close(); } catch (IOException e){ e.printStackTrace(); } } I tried also other stuff out. I also want to keep it as simple as possible. Stack Trace Exception in thread "main" java.lang.NullPointerException at java.io.Writer.write(Unknown Source) at Kapitel3_3.readfile.dateiausgeben(readfile.java:61) at Kapitel3_3.DateiKopierer.main(DateiKopierer.java:15)

json-deserialization
tag name: json-deserialization
tags question: http://stackoverflow.com/q/25464425
type: Tag

http://stackoverflow.com/q/25539855
score: 2
type: AnsweredQuestion
tagged with: bash
accepted answer: http://stackoverflow.com/a/25539934
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/25539934
downvote count: 0
has body: I modified my .bash_profile as follow: # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe export ORACLE_HOME export PATH=$PATH:$ORACLE_HOME/bin export ORACLE_SID=XE JAVA_HOME=/home/oracle/softs/jdk1.7.0_25 export JAVA_HOME export PATH=$PATH:$JAVA_HOME/bin But the output of echo $PATH command is not as my expect: /usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin Of course, I cannot use Java commands. Please help.
has title: Linux Redhat .bash_profile does not work
favorite count: 0
type: Question
tagged with: linux
upvote count: 2

http://stackoverflow.com/a/25444841
has comment: http://stackoverflow.com/comment/39708848
type: Answer
answers question: http://stackoverflow.com/q/25441838
has comment: http://stackoverflow.com/comment/39781576
type: AcceptedAnswer
downvote count: 0
upvote count: 7
has comment: http://stackoverflow.com/comment/39783964
score: 7
has body: If you look at CheckBoxTreeCell class, you'll see it has the possibity to provide a callback that returns an ObservableValue&lt;Boolean&gt; with the selection status of the item, and a StringConverter. So we can define these in our class: final Callback&lt;TreeItem&lt;Person&gt;, ObservableValue&lt;Boolean&gt;&gt; getSelectedProperty = (TreeItem&lt;Person&gt; item) -&gt; { if (item instanceof CheckBoxTreeItem&lt;?&gt;) { return ((CheckBoxTreeItem&lt;?&gt;)item).selectedProperty(); } return null; }; final StringConverter&lt;TreeItem&lt;Person&gt;&gt; converter = new StringConverter&lt;TreeItem&lt;Person&gt;&gt;() { @Override public String toString(TreeItem&lt;Person&gt; object) { Person item=object.getValue(); return item.getName(); } @Override public TreeItem&lt;Person&gt; fromString(String string) { throw new UnsupportedOperationException("Not supported yet."); } }; And now we just need to define the cell factory with these two parameters: treeView.setCellFactory(p -&gt; new CheckBoxTreeCell&lt;&gt;(getSelectedProperty,converter)); If you try this, you will see that you can select/unselect the root as well as the children with just one click. EDIT There's an easier solution, using the static method forTreeView, where you don't need to provide the callback nor the converter: treeView.setCellFactory(CheckBoxTreeCell.&lt;Person&gt;forTreeView()); But for this to work you just need to override toString in Person: private class Person { ... @Override public String toString() { return name; } } And this explains why you had the problem in the first place: if you add the toString method to your code, it will work also with your CheckBoxTreeCell: treeView.setCellFactory(p -&gt; new CheckBoxTreeCell&lt;Person&gt;() { @Override public void updateItem(Person item, boolean empty) { super.updateItem(item, empty); if (item != null) { setText(item.getName()); } } });
accepted answer of: http://stackoverflow.com/q/25441838
has comment: http://stackoverflow.com/comment/39705083

http://stackoverflow.com/a/25602785
answers question: http://stackoverflow.com/q/25526139
type: AcceptedAnswer
has body: When you return from activity B to activity A you recreate your fragments, so it will always show your fragment1 instead of your desired fragment2. Your problem is, that you trust on savedInstanceState to decide if your fragments should be recreated or not. However, onSaveInstanceState() is only called, when the activity gets destroyed, which will not instantly happen when you navigate to the next activity. You should query the FragmentManager in your onCreate() method of activity A, if fragments are already added, otherwise you do your initial fragment creation. In order to do so, I would add an TAG to better find your fragments. private static final String FRAGMENT_TAG_CONVERSATION = "frag_conv"; ... fragmentManager.beginTransaction().replace(R.id.content_frame, conv, FRAGMENT_TAG_CONVERSATION).commit(); You can then check, if you already added the fragment: if(fragmentManager.findFragmentByTag(FRAGMENT_TAG_CONVERSATION) == null)) // only add it here
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25526139

http://stackoverflow.com/a/25456252
type: Answer
score: 0
has body: This is a total anti-pattern approach to the FactoryMethod Pattern: if ( source instanceof ABCObject ) return new ABCTypeConverter(); ...and so on... Don't do that it will never scale and will never be maintainable. What is wrong with: TypeConverter&lt;ABCObject&gt; tc = new TypeConverter&lt;ABCObject&gt;(); That is how every sane framework that implements something like this works. For example: com.google.common.base.Converter Look at the how Jackson does it for JSON Serializer/Deserializers as well. There is a way with Guava to get an instance of a type T Class&lt;T&gt; klass = (Class&lt;T&gt;) new TypeToken&lt;T&gt;(getClass()) {}.getRawType(); Then you can do klass.newInstance(); but this is hacky was well.
answers question: http://stackoverflow.com/q/25456181

http://stackoverflow.com/comment/39702947
type: QuestionComment
comment on: http://stackoverflow.com/q/25446660
type: Comment
has text: Given it is Swing, I'd say `JFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)`..
score: 1

http://stackoverflow.com/q/25404394
score: 2
type: UnansweredQuestion
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39625175
favorite count: 0
tagged with: processing
has title: Processing: How to stop mouse event being captured by all the listeners
tagged with: java
has body: I'm working on some GUI elements, some of them are overlapped and can both capture mouse events. Is there are way to make the mouse event captured by the "topmost" element only? Bla a,b; void setup(){ size(300,300); a=new Bla("a",this); b=new Bla("b",this); } void draw(){ background(0xffffffff); a.draw(10,10); b.draw(25,25); } public class Bla{ String name; float x,y; PApplet p; Bla(String name, PApplet p){ this.name=name; this.p=p; p.registerMethod("mouseEvent",this); } public void mouseEvent(MouseEvent e){ float mx=e.getX(); float my=e.getY(); if(mx&gt;x &amp;&amp; mx&lt;x+50 &amp;&amp; my&gt;y &amp;&amp; my&lt;y+50){ if(e.getAction()==MouseEvent.RELEASE){ print(name); } } } public void draw(float x, float y){ this.x=x; this.y=y; p.fill(0xffffffff); p.stroke(0xff000000); p.rect(x,y,50,50); } }
tagged with: mouseevent
type: Question
has answer: http://stackoverflow.com/a/25405171
upvote count: 2

http://stackoverflow.com/comment/39765046
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25479195
score: 0
has text: I read the SSCCE and I believe I have all the components correct except 'Self Contained' I can post my entire project if that would help?

http://stackoverflow.com/comment/39774138
type: AnswerComment
comment on: http://stackoverflow.com/a/25483619
has text: I don't know. Maybe a different version, maybe you're not exactly using the same code?
type: Comment
score: 0

http://stackoverflow.com/a/25525703
type: AcceptedAnswer
has body: You can create a second camera, render your tiles with it, and move only this camera: create method: this.scrollingCamera =new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); this.scrollingCamera.translate(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2); this.scrollingCamera.update(); and then, during rendering: this.renderer.setView(scrollingCamera); this.renderer.render(); // Render tiles this.scrollingCamera.translate(SCROLLING_SPEED.X, SCROLLING_SPEED.Y); this.scrollingCamera.update(); this.renderer.setView(camera); // Render other stuff camera.update();
answers question: http://stackoverflow.com/q/25522623
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25522623

http://stackoverflow.com/q/25508706
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25509172
favorite count: 0
has body: I am successfully loading and using an PKCS12 file Cert.pfx from Assets like this: String certLocation = "certificates/Cert.pfx"; InputStream isCert = null; try { isCert = getAssets().open(certLocation); } catch (Exception e) { Log.d(TAG, "Could not get Assets"); } // Work with the certificate I am trying to do the same now, but reading from a storage in Android. File sdCard = Environment.getExternalStorageDirectory(); File dir = new File (sdCard.getAbsolutePath() + "/PrintableRSA"); File cert = new File(dir,"Cert.pfx"); InputStream isCert= null; try { isCert = new BufferedInputStream(new FileInputStream(cert)); isCert.close(); Log.d(TAG,"Sucsess!"); } catch (Exception e) { Log.d(TAG, "Could not load the file"); } // Same work with the certificate The file loads sucsessfully, but When I further to work with isCert InputStream, loaded from storage, it does not work. I suspect that therefore the files are not equal. I also tried with InputStream isCert = FileInputStream(cert); unsuccessfully. How can I fix this issue?
has comment: http://stackoverflow.com/comment/39902525
has title: Loading a file from Internal storage to InputStream same way as from Assets
type: Question
tagged with: android
tagged with: bufferedinputstream
score: -1
has comment: http://stackoverflow.com/comment/39819586
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39824503
tagged with: fileinputstream
upvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25509172
tagged with: inputstream

http://stackoverflow.com/q/25550515
has comment: http://stackoverflow.com/comment/39903706
has comment: http://stackoverflow.com/comment/39896026
has title: Issue with Sorting List using collections in java
has comment: http://stackoverflow.com/comment/39903661
has comment: http://stackoverflow.com/comment/39898541
accepted answer: http://stackoverflow.com/a/25554664
score: 0
has answer: http://stackoverflow.com/a/25554664
has comment: http://stackoverflow.com/comment/39896534
tagged with: predicate
answer count: 1
tagged with: sorting
tagged with: collections
has body: I have a list with Order Entries. Each order entry has a base price. I want to sort this list on entry.basePrice descending (enty.basePrice == 0 entries should be at the bottom). In this list, either no entry will have 0 price or one entry will have. I am doing like this .. final Collection&lt;AbstractOrderEntryModel&gt; orderEntry = Collections2.filter(source.getEntries(), new Predicate&lt;AbstractOrderEntryModel&gt;() { @Override public boolean apply(final AbstractOrderEntryModel arg) { return arg.getBasePrice().doubleValue() == 0 ? true : false; } }); Here I m filtering my entry which having baseprice = 0.0 Now How I will remove and add this item (orderEntry.iterator().next()) at last in OrderEntry List? If its not a recommended solution, and it can be possible through Collections.sort also then please give me solution.
type: Question
tagged with: guava
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/25424411
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25394365
upvote count: 1
answers question: http://stackoverflow.com/q/25394365
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/39686461
has body: A 300MB file will not consume 6GB of heap when loaded into a byte array. And looking closer at your stacktrace, it seems the loading part is completely fine. "The java.lang.OutOfMemoryError: Java heap space" is only thrown when you try to log something using Log4j. The logging seems to originate from 3rd party code instead of your own, so you might not be able to change what is being logged, but you can definitely reduce the logging via Log4j configuration, try increasing the log level (to WARN, ERROR or FATAL) for org.apache.* and you should be good to go.
score: 1

http://stackoverflow.com/comment/39678194
comment on: http://stackoverflow.com/a/25416162
has text: It needs 15 reputations to do so. As I'm new here I haven't reached those numbers. Will do that for sure once I reach that number.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25428939
has title: How to stop Marshaller class adding XML tag in my output file
answer count: 2
possible better answer: http://stackoverflow.com/a/25448184
downvote count: 0
has answer: http://stackoverflow.com/a/25448184
favorite count: 0
has body: I am marshalling my Object in 2 separate steps. One adds Header and the other one adds the Body. Now when I use this code marshaller.marshal(payload, writer); //payload is Objects name and writer is StringWriter class object The XML tag, &lt;?xml version="1.0" encoding="utf-8"?&gt; is added twice in the final output file. How can I not add the [&lt;?xml version="1.0" encoding="utf-8"?&gt;] XML tag second time when I am marshalling the body part?? I have used all the properties of Marshaller interface, but that did not help.
type: AnsweredQuestion
upvote count: 9
has answer: http://stackoverflow.com/a/25429553
tagged with: java
tagged with: jaxb
tagged with: http://stackoverflow.com/tag/xml
tagged with: marshalling
score: 9
accepted answer: http://stackoverflow.com/a/25429553
type: Question

http://stackoverflow.com/q/25547875
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25547917
has title: GWT add a widget above the existing widget
possible better answer: http://stackoverflow.com/a/25547949
type: Question
has answer: http://stackoverflow.com/a/25547949
answer count: 2
has body: I have a VericalPanel. If I add an element to it, it will be added under the element, now how can I place an Element over it? VerticapPanel vpanel = new VerticalPanel()
has answer: http://stackoverflow.com/a/25547917
tagged with: gwt
type: AnsweredQuestion

http://stackoverflow.com/comment/39849076
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25524946
has text: do check if doc is null or not

http://stackoverflow.com/q/25419934
has answer: http://stackoverflow.com/a/25419974
possible better answer: http://stackoverflow.com/a/25419974
has answer: http://stackoverflow.com/a/25420161
accepted answer: http://stackoverflow.com/a/25420161
type: Question
has body: the android app can load the absolute image path form the sdcard, which looks like this/storage/sdcard0/DCIM/Camera/20130622_200703.jpg I only need part of the path string like/20130622_200703.jpg So I want to recursively split the absolute path into the one I need. I wrote the code like below public String splitPath(String path){ if (path == "") { return null; } if(path.indexOf("/") != -1){ String subPath = path.substring(path.indexOf("/") + 1); //absoultePath = subPath; splitPath(subPath); } return path; } But the problem is when I following the process in Debug mode. the path could be split from /.../.../.../.../... to /... which is correct, but it did not return the path even when path.indexOf("/") equals -1. Then weird things happened, the recursive loop did not end, it continued to change the /... to /.../.../.../.../... step by step, after that process, it returned the path, which was exactly the same value like /storage/sdcard0/DCIM/Camera/20130622_200703.jpg. I really confused about that, it feels like the logic itself playing joke on me. Oops Any feedback from you will be appreciated.
tagged with: split
has comment: http://stackoverflow.com/comment/39683341
has comment: http://stackoverflow.com/comment/39654043
tagged with: string
type: AnsweredQuestion
tagged with: recursion
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25419997
has title: android recursively split string exception
tagged with: android
tagged with: java

http://stackoverflow.com/a/25535117
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39869032
type: Answer
answers question: http://stackoverflow.com/q/25534644
has comment: http://stackoverflow.com/comment/39880564
downvote count: 0
has comment: http://stackoverflow.com/comment/39868422
has comment: http://stackoverflow.com/comment/39868746
has body: You may have not provided the request mapping for "/" i.e for for startup url. Put a "/" url mapping in your controller. You need to first deploy it on server and start the server then hit the application url in browser. @RequestMapping(value = "/", method = RequestMethod.GET) public String testReporte(Model model) { try { System.out.println("Entre"); List&lt;Usuario&gt; lista = usuarioDAO.encontrarTodosUsuarios(); model.addAttribute("lista", lista); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return "index"; }

http://stackoverflow.com/comment/39829379
comment on: http://stackoverflow.com/a/25513837
type: AnswerComment
score: 0
type: Comment
has text: @Roman I should also point out that `compareTo` also uses a ternary operator in the Oracle implementation.

http://stackoverflow.com/q/25447256
tagged with: java
answer count: 1
has title: recovering programmatically the ServingUrl of a blob uploaded in BlobStore using the BlobInfo?
type: Question
has answer: http://stackoverflow.com/a/25449150
has body: I want to recover the ServingUrl of a blob uploaded in BlobStore using the BlobInfo entity My code in My doGet() method is : ImagesService imagesService = ImagesServiceFactory.getImagesService(); Iterator&lt;BlobInfo&gt; iterator = null; iterator = new BlobInfoFactory().queryBlobInfos(); while (iterator.hasNext()) { if(iterator.next().getFilename().equals("test.png")) { resp.getWriter().println(iterator.next().getBlobKey()) ;// the result is &lt;BlobKey: aKQyp27ZfDgvEdPE8QvMAQ&gt; resp.getWriter().println(iterator.next().getFilename());//the result is test.png BlobKey bk=iterator.next().getBlobKey(); String urlStr=imagesService.getServingUrl(ServingUrlOptions.Builder.withBlobKey(bk)); resp.getWriter().println(urlStr); } } I got this error : HTTP ERROR 500 Problem accessing /enrollementfinale. Reason: INTERNAL_SERVER_ERROR Caused by: java.util.NoSuchElementException at com.google.appengine.api.datastore.QueryResultIteratorImpl.next(QueryResultIteratorImpl.java:75) at com.google.appengine.api.datastore.QueryResultIteratorImpl.next(QueryResultIteratorImpl.java:26) at com.google.appengine.api.blobstore.BlobInfoFactory$1.next(BlobInfoFactory.java:108) at com.google.appengine.api.blobstore.BlobInfoFactory$1.next(BlobInfoFactory.java:100) at com.EnrollementFinaleServlet.doGet(EnrollementFinaleServlet.java:135) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:127) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at c…
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: blobstore
score: 0

http://stackoverflow.com/a/25592037
has body: Use two priority queues. One way to do this is tag an item for deletion when it's next in one's poll. If the other queue sees it, skip and move to next. I'm not sure the complexity of this, but it will depend on subtle questions such as how much longer one item remains in a queue than the other. I would suggest profiling for your actual situation.
answers question: http://stackoverflow.com/q/25415037
score: 2
has comment: http://stackoverflow.com/comment/40083553
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/25537675
score: 97
has body: I don't quite understand how different they are from each other so I have some inquiries regarding these two packages. After looking around a bit on Google, it seems like Oracle decided to update the NIO package with the newer and enhanced NIO.2 package as part of the JDK7 release. How does the performance of NIO package compare with the NIO.2 package? What are some big changes from NIO to NIO.2? (e.g. new methods, features) Why did the original NIO package have to be updated? Is NIO.2 just synonymous with the NIO package nowadays? It's not that I want to use the legacy package in my code, I'm just really curious about this. Please tell me their differences?
downvote count: 0
tagged with: difference
linked to: http://stackoverflow.com/q/23791024
has comment: http://stackoverflow.com/comment/49024510
has comment: http://stackoverflow.com/comment/39873168
type: AnsweredQuestion
upvote count: 97
has answer: http://stackoverflow.com/a/25539157
has comment: http://stackoverflow.com/comment/39873774
accepted answer: http://stackoverflow.com/a/25539157
answer count: 3
has answer: http://stackoverflow.com/a/30471811
linked to: http://stackoverflow.com/q/22177722
tagged with: java
tagged with: io
has comment: http://stackoverflow.com/comment/39873421
has comment: http://stackoverflow.com/comment/39873288
tagged with: nio
has title: Java: what exactly is the difference between NIO and NIO.2?
has answer: http://stackoverflow.com/a/57777945
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/30471811

http://stackoverflow.com/comment/39765817
type: AnswerComment
type: Comment
has text: how pal can u tell how to link it@maddy
comment on: http://stackoverflow.com/a/25479723
score: 0

http://stackoverflow.com/comment/39784081
score: 0
type: QuestionComment
has text: Years ago I was trying to do the same sort of thing you are doing, and I ran into similar problems with the Object Streams... If possible, I'd recommend using JSON for serialization, rather than java object serialization.
comment on: http://stackoverflow.com/q/25489145
type: Comment

http://stackoverflow.com/comment/39780894
comment on: http://stackoverflow.com/q/25488090
has text: You can either make printButton and inputFrame static (easier), or convert your static method into a non-static method, initialize an instance of your class, and call your method on that.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/25428545
score: 1
type: Answer
upvote count: 1
has body: public static void main(String args[]){ String allTogether= "ip:port"; String[] array; if(allTogether.contains(":")){ array = allTogether.split(":"); String ip = array[0]; String port = array[1]; System.out.println(ip); System.out.println(port); } }
downvote count: 0
answers question: http://stackoverflow.com/q/25428405

http://stackoverflow.com/comment/39598986
type: Comment
type: QuestionComment
score: 0
has text: I'm unfamiliar with libgdx, but that problem sounds like the screen is not clearing itself. https://github.com/libgdx/libgdx/wiki/Clearing-the-screen
comment on: http://stackoverflow.com/q/25390148

http://stackoverflow.com/a/25451542
has body: You're iterating through an ArrayList (RouteListLV.arrayOfRoutesEnabled) and modifying it as you go along. That causes a ConcurrentModificationException, so don't do it. Find a way to first find the element or elements you're going to modify and then modify the list (and never use the iterator after that). Or build a "shadow" copy of the list that has everything you want it to have at the end, then call removeAll() and then addAll(newList) on the original list, which is just that same idea in a slightly different form.
type: Answer
has comment: http://stackoverflow.com/comment/39712905
has comment: http://stackoverflow.com/comment/39714806
has comment: http://stackoverflow.com/comment/39712969
has comment: http://stackoverflow.com/comment/39712576
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25451349
answers question: http://stackoverflow.com/q/25451349
score: 1

http://stackoverflow.com/a/25410248
score: 0
has body: You are looking for this: sqlite3 db .dump
type: Answer
answers question: http://stackoverflow.com/q/25410192

http://stackoverflow.com/comment/39602789
type: QuestionComment
comment on: http://stackoverflow.com/q/25391685
has text: Really, no one's got anything?
type: Comment
score: 0

http://stackoverflow.com/q/25453011
has title: How to get elements by index in this array?
accepted answer: http://stackoverflow.com/a/25453443
tagged with: libgdx
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39716279
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/39716257
has comment: http://stackoverflow.com/comment/39715963
has comment: http://stackoverflow.com/comment/39715556
has comment: http://stackoverflow.com/comment/39715584
has answer: http://stackoverflow.com/a/25453443
has comment: http://stackoverflow.com/comment/39715691
has comment: http://stackoverflow.com/comment/39715999
has comment: http://stackoverflow.com/comment/39716050
has comment: http://stackoverflow.com/comment/39715933
has body: I am creating an array from an XML list like this: Array<Element> a = root.getChildrenByName("Element name"); I'm trying to get the XML data out by index but this is not working. int result = a.get(i).getInt("attribute name"); //Does not change anything to the result. int result = tiles.items[i].getInt("attribute name"); //Results in an error. I tried casting it to a regular array[] but that does not work out either. When debugging the array i created from the xml file i can see the XML written at the bottom when hovering over the array, i am unable to see an actual "arraytree" in there. [<element att="value"/>, <element att="value"/>, ...] When i am trying to cast this array to a normal array[] or ArrayList or anything like that i'm getting: Exception in thread "LWJGL Application" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lcom.badlogic.gdx.utils.XmlReader$Element; Posting my complete code block and XML: public static Tile[][] LoadMap(String file) { Tile[][] map = new Tile[0][0]; XmlReader xml = new XmlReader(); try { Element root = xml.parse(Gdx.files.internal(file)); int width = root.getInt("width"); int height = root.getInt("height"); map = new Tile[width][height]; map = new Tile[width][height]; for (XmlReader.Element l : root.getChildrenByName("layer")) { //Populate floor tiles if (l.getAttribute("name").equals("floor")) { Element data = l.getChildByName("data"); Array<Element> tiles = data.getChildrenByName("tile"); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { map[x][y] = new Tile(); map[x][y].tileTexture = tiles.get(x+y).getInt("gid"); //add properties since we know it uses the floor tileset. } } } //Populate wall tiles else if (l.getAttribute("name").equals("wall")) { Element data = l.getChildByName("data"); Array<Element> tiles = data.getChildrenByName("tile"); for (int y = 0; y < height; y++) { for (int x = 0; x < width;x++) { map[x][y].wallTexture = tiles.get(x+y).getInt("gid"); //add properties since we k…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39716383
score: 0

http://stackoverflow.com/comment/39839366
comment on: http://stackoverflow.com/q/25519363
score: 0
type: Comment
has text: Why don't you go for some php framework like opencart. It will provide you free and ready base for eCommerce platform.
type: QuestionComment

http://stackoverflow.com/q/25516193
type: AnsweredQuestion
score: 0
has body: I need to add time delay between cycle flow like this: public boolean timeDelay(int seconds) { // 1000000000 ns = 1 s if (/* some system method to start calculate time in seconds*/ == seconds) { return true; } else { return false; } } public void renderEnemies() { for (int w = 0; w &lt; wave.size(); w++) { while(timeDelay(2)){ (wave.get(w)).render(); } } } Maybe my thinking isn't good, but I need to do like this... wave --> ArrayList of enemies in my game Render enemies is in game loop after pressing button "NextWave" and I need to spawn them with delay between them like a --> 2s * 2s * 2s * 2s * 2s * where * is enemy... Can you help me?
answer count: 3
has comment: http://stackoverflow.com/comment/39834343
tagged with: java
has answer: http://stackoverflow.com/a/25516495
type: Question
has answer: http://stackoverflow.com/a/25516253
possible better answer: http://stackoverflow.com/a/25516253
tagged with: time
has title: Java - add time delay to a cycle flow
tagged with: cycle
tagged with: delay
accepted answer: http://stackoverflow.com/a/25516495
has answer: http://stackoverflow.com/a/25516782
has comment: http://stackoverflow.com/comment/39835197

http://stackoverflow.com/a/25639784
answers question: http://stackoverflow.com/q/25390711
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25390711
has body: Ya, I too got the same error once.What I did is:- Right click on the project in eclipse click run as --> run configurations there u can see the java application some where under the 'type filter text box'. right click and click new. then give the project name and main class name and then click run after selecting the created application settings. Hope this helps.
type: Answer
has comment: http://stackoverflow.com/comment/40159758
has comment: http://stackoverflow.com/comment/41557830
score: 3
upvote count: 3

http://stackoverflow.com/comment/39754655
type: Comment
comment on: http://stackoverflow.com/q/25473846
type: QuestionComment
score: 0
has text: Initially I did not use any parameters in that method. Last night when I was trying to figure out the issue, I tweaked it a few times. Here is what I initially thought it should look like. I'll edit it now

http://stackoverflow.com/q/25515292
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
tagged with: recursion
type: Question
has title: Draw a basic tree from recursion?
tagged with: java
has comment: http://stackoverflow.com/comment/39832373
has comment: http://stackoverflow.com/comment/39832510
accepted answer: http://stackoverflow.com/a/25515692
has answer: http://stackoverflow.com/a/25515692
has comment: http://stackoverflow.com/comment/39832558
type: AnsweredQuestion
score: 0
has body: I am trying to learn recursion but am not really understanding it at all. Can somebody please show me example code to build a tree like this? As I feel it will help seeing graphic recursions Assuming there is a line method with parameters for the top and bottom x and y coordinates how would I go about this? Thanks! also any recommended tutorials etc on recursion?
has comment: http://stackoverflow.com/comment/39832403

http://stackoverflow.com/a/25537978
answers question: http://stackoverflow.com/q/25537953
score: 3
has body: Your add method creates a new array every time (and copies the Strings of the current array to the new array), even if the existing array is large enough to insert a new String to it. That's why it's much slower than ArrayList. Compare it to this implementation of ArrayList : /** * Appends the specified element to the end of this list. * * @param e element to be appended to this list * @return true (as specified by {@link Collection#add}) */ public boolean add(E e) { ensureCapacity(size + 1); // Increments modCount!! elementData[size++] = e; return true; } A new array would only be created if there's no room for the new element in the current array.
type: Answer
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/25527225
upvote count: 2
has body: Use containsInAnyOrder() : List colors = Arrays.asList("red","green","blue"); assertThat(colors, containsInAnyOrder("green", "red", "blue")); // is true
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25527175
score: 2
answers question: http://stackoverflow.com/q/25527175
type: Answer

http://stackoverflow.com/comment/39873226
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25537634
has text: The 'error' function passed to $.ajax() receives 3 arguments: ( jqXHR jqXHR, String textStatus, String errorThrown ). Try adding those in and checking their values
type: Comment

http://stackoverflow.com/a/25463056
answers question: http://stackoverflow.com/q/25462376
score: 1
downvote count: 0
has body: This is what fixes it. In BarcodeSpiderMainFrame, remove the call to setVisible. So it will look something like: public static BarcodeSpiderMainFrame instance() { if (INSTANCE == null) { INSTANCE = new BarcodeSpiderMainFrame("Spider") INSTANCE.minimumSize = new Dimension(800,600) INSTANCE.preferredSize = new Dimension(1024,768) INSTANCE.maximumSize = new Dimension(1024,768) INSTANCE.defaultCloseOperation = EXIT_ON_CLOSE } INSTANCE.initializeContent() // INSTANCE.visible = true // remove this line INSTANCE } and in the launcher, call setVisible() @Singleton class SpiderLauncher { BarcodeSpiderMainFrame barcodeSpiderMainFrame public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { SpiderLauncher.instance.run(args); } }); } void run(String[] args) { barcodeSpiderMainFrame = BarcodeSpiderMainFrame.instance() barcodeSpiderMainFrame.pack() barcodeSpiderMainFrame.setVisible(true) // add this line } } I have added the call to pack(). But i dont think it really matters. How did the above fix my problem? I do not know. It would be great if someone can explain what actually happened.
type: Answer
upvote count: 1

http://stackoverflow.com/a/25442166
has body: You cannot remove the entry object from a Map. The remove method expects key. Instead you can try the below:- Iterator&lt;Entry&lt;Integer, String&gt;&gt; itr = myMap.entrySet().iterator(); while(itr.hasNext()) { Entry&lt;Integer, String&gt; entry = itr.next(); if (entry.getValue().contains("EnterStringHere")) { itr.remove(); } } Also you cannot directly structurally modify a Map while iterating else you will get ConcurrentModification Exception. To prevent this you need to delete using the remove method on the iterator as shown in above code.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25441723
upvote count: 1
type: Answer

http://stackoverflow.com/comment/39716246
comment on: http://stackoverflow.com/q/25453342
has text: post your `.classpath` file for your eclipse project
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39773729
type: QuestionComment
has text: I need use in jList and I have to fetch first column id in a full row.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25483867

http://stackoverflow.com/comment/39995930
score: 0
comment on: http://stackoverflow.com/q/25505141
type: Comment
type: QuestionComment
has text: Then it would probably be easier for us to help you if you could edit your question and add the code where the exception occurs. As the question now is written we have no idea exactly what you are doing when you get the exception.

http://stackoverflow.com/comment/39844622
type: AnswerComment
has text: *Some* database access is locking the database. When you say there is only one, you have found the culprit.
type: Comment
comment on: http://stackoverflow.com/a/25522187
score: 0

http://stackoverflow.com/q/25521882
score: 0
has comment: http://stackoverflow.com/comment/39843748
has comment: http://stackoverflow.com/comment/39843659
has comment: http://stackoverflow.com/comment/39843725
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/25522081
has comment: http://stackoverflow.com/comment/39843802
has answer: http://stackoverflow.com/a/25523137
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25521967
has title: Is in If condition the check obj == null more performance effective then obj!=null
has body: According to one of my senior coding style 2 is better in performance than coding style 1,is it true ? coding style 1 If (obj!=null) { Logic A } else { Logic B } coding style 2 If (obj==null) { Logic B } else { Logic A }
tagged with: performance
has answer: http://stackoverflow.com/a/25522035
type: UnansweredQuestion
tagged with: null
has comment: http://stackoverflow.com/comment/39846105
has comment: http://stackoverflow.com/comment/39843718
answer count: 4
upvote count: 2

http://stackoverflow.com/a/25407736
has comment: http://stackoverflow.com/comment/39634222
type: Answer
answers question: http://stackoverflow.com/q/25407656
has comment: http://stackoverflow.com/comment/39631713
has comment: http://stackoverflow.com/comment/39631714
has comment: http://stackoverflow.com/comment/39632586
has comment: http://stackoverflow.com/comment/39631777
has body: Java inlines final fields that are initialized to constant expressions at compile time. According to the Java Language Specification, any static final* field initialized with an expression that can be evaluated at compile time must be compiled to byte code that "inlines" the field value. That is, no dynamic link will be present inside class Main telling it to obtain the value for A from InterfaceA at runtime. Decompile the bytecode and you'll find that the body of getA() simply pushes the constant 1 and returns it. * - The JavaWorld quote says static final. Kumar points out that the static is not required by the language specification in the definition of a constant variable. I think Kumar is right and JavaWorld is in error.
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39650438
has comment: http://stackoverflow.com/comment/39631562
score: 9
upvote count: 9
accepted answer of: http://stackoverflow.com/q/25407656

http://stackoverflow.com/q/25454697
favorite count: 0
has body: I am trying to call a method in a DLL using JNA. So far have loaded the DLL using Runtime.getRuntime().load("myworkspace/test.dll"); This dll contaings a method that I need to access. How can I execute the method present in DLL in my Java file. Do I create an object or something of the DLL and then get the method name after the dot operator.
upvote count: 40
tagged with: jna
score: 39
tagged with: dll
has title: How to call a method in DLL in a Java program
tagged with: java-native-interface
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25456834
answer count: 2
has comment: http://stackoverflow.com/comment/39718986
has answer: http://stackoverflow.com/a/25454767
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/comment/39812080
type: Comment
has text: Regarding the code building, anything you build with is ok, as long as you compile the native with the correct compiler for the correct processor architecture (most common is armeabi-v7a and it comes with the ndk).
type: AnswerComment
comment on: http://stackoverflow.com/a/25449492
score: 0

http://stackoverflow.com/comment/39613945
type: AnswerComment
score: 0
has text: @user3889926 clone() will always yield an Exception unless you've implemented the Cloneable interface and the clone() method (latter might not be technically required, but you'll get a rather useless clone if you don't.
comment on: http://stackoverflow.com/a/25397931
type: Comment

return
tags question: http://stackoverflow.com/q/25473846
type: Tag
tags question: http://stackoverflow.com/q/25456472
tags question: http://stackoverflow.com/q/25502025
tags question: http://stackoverflow.com/q/25432988
tag name: return
tags question: http://stackoverflow.com/q/25399982
tags question: http://stackoverflow.com/q/25451481
tags question: http://stackoverflow.com/q/25488119
tags question: http://stackoverflow.com/q/25475963

http://stackoverflow.com/comment/39774238
comment on: http://stackoverflow.com/q/25484662
type: Comment
score: 0
has text: @RajeevArora: You are the one who asks for help, so you should put some effort to your question so that others can focus on solving the problem and not on guessing what the OP actually asks for.
type: QuestionComment

http://stackoverflow.com/a/25550493
downvote count: 0
answers question: http://stackoverflow.com/q/25542514
type: Answer
accepted answer of: http://stackoverflow.com/q/25542514
score: 5
upvote count: 5
has body: Hang in there! :-) You're citing the very first example from the website. I suggest following the manual's section about how to read the manual (I know, this sounds like I'm RTFM'ing you. Sorry about that), where you will find a couple of explanations, e.g. // Whenever you see "standalone functions", assume they were static imported // from org.jooq.impl.DSL. "DSL" is the entry point of the static query DSL exists(); max(); min(); val(); inline(); // correspond to DSL.exists(); DSL.max(); DSL.min(); etc... The tutorial also shows how to do it, i.e. with static imports: // For convenience, always static import your generated tables and // jOOQ functions to decrease verbosity: import static test.generated.Tables.*; import static org.jooq.impl.DSL.*; Note, there's a pending feature request #3503 to improve the manual and the website with tooltips, in order to explain these things to new users, which will quickly become common practice once you get a hang of jOOQ.
type: AcceptedAnswer

http://stackoverflow.com/q/25458331
tagged with: multithreading
answer count: 0
has body: I need to queue all my requests to particular service and need to execute 2 requests at a time.All remaining threads will be in Queue. For that purpose I am using ThreadPoolExecutor object by setting corePoolSize and maximumPoolSize as 2. Whenever request comes, ThreadPoolExecutor handle that request to one of these threads. So these 2 threads will be there from application startup to till you shutdown server.I am simply using below statement. threadpoolExecutorObject.execute(new RunnableObject()); 1.I just want to know, Is there any better way to do this? 2.Our application server is sometimes hanging and not responding and we are restarting server. By any chance, Is the above implementation causing this problem? 3.I am leaving only above statement in my method. Do I need to do shutdown or anything else?
tagged with: threadpoolexecutor
has comment: http://stackoverflow.com/comment/39726378
type: Question
tagged with: java
type: UnansweredQuestion
has title: ThreadpoolExecutor for queueing up requests
has comment: http://stackoverflow.com/comment/39726352
score: 0

http://stackoverflow.com/q/25479808
has answer: http://stackoverflow.com/a/25479895
has title: Passing parameter as Wrapper class and overriding
upvote count: 4
type: AnsweredQuestion
answer count: 3
linked to: http://stackoverflow.com/q/3386039
downvote count: 0
possible better answer: http://stackoverflow.com/a/25479892
has answer: http://stackoverflow.com/a/25479892
has body: Please clarify my doubt on overriding, When I am calling a method which is not overrided, the method that is being called is form parent class, please give brief explanation on this, The example is like this public class A { public void test(int x){ System.out.println("Haiiiiiii"); } } public class B extends A{ public void test(Integer x){ System.out.println("hiii Im b's method"); } } public class Main { /** * @param args */ public static void main(String[] args) { B a=new B(); a.test(2); } } I'm calling b's method but in B class the method takes wrapper class as parameter.
favorite count: 0
has answer: http://stackoverflow.com/a/25479927
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/25479895
score: 4
has comment: http://stackoverflow.com/comment/39765835

http://stackoverflow.com/a/25509434
answers question: http://stackoverflow.com/q/25509290
has comment: http://stackoverflow.com/comment/39822773
type: Answer
has comment: http://stackoverflow.com/comment/39822602
has comment: http://stackoverflow.com/comment/39821583
downvote count: 0
score: 1
upvote count: 1
has body: You can map the association like this: @ManyToOne(optional=true) @JoinColumn(name="user_id", nullable=true) If you do so, be sure that your code handles the case where AuthenticationToken.getUser() == null;
has comment: http://stackoverflow.com/comment/39821834

http://stackoverflow.com/comment/39720744
type: AnswerComment
comment on: http://stackoverflow.com/a/25455250
has text: Actually Z is related to timezones. In your implementation you had not provided any timezone information to GSON.If you remove Z and try running your code, It should work fine. Because in this case its not related to anything specific to timezones, so GSON will parse it to local timezone.
score: 0
type: Comment

http://stackoverflow.com/q/25457120
type: UnansweredQuestion
has body: I've been experimenting with quicksort and learning how to test a programs speed. One thing doesn't make sense to me. I tried implementing a quicksort algorithm which uses tail recursion in Java. It usually runs faster. But then I learned that Java doesn't support tail call optimization. Why would it run faster then? Here is the code. import java.util.Arrays; import java.util.Random; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; public class QuicksortCompare { private final static Random rand = new Random(); private static final int MIN_LENGTH = 10; private static final int MAX_LENGTH = 1000; private static final int MIN_VAL = -1000; private static final int MAX_VAL = 1000; public static void main(String[] args) { /*long[] avgTimes = {0, 0}; System.out.println("press enter to start"); Scanner in = new Scanner(System.in); in.nextLine();*/ for(;;) { int[] arr1 = generateRandomArray(MIN_LENGTH, MAX_LENGTH, MIN_VAL, MAX_VAL); int[] arr2 = Arrays.copyOf(arr1, arr1.length); long startTime = System.nanoTime(); quicksortNormal(arr1, 0, arr1.length-1); long endTime = System.nanoTime(); long duration = endTime-startTime; System.out.print("normal: "+duration+" ns\t"); startTime = System.nanoTime(); quickSortTailRecurse(arr2, 0, arr2.length-1); endTime = System.nanoTime(); duration = endTime-startTime; System.out.println("special: "+duration+" ns\tlength: "+arr1.length); try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(QuicksortCompare.class.getName()).log(Level.SEVERE, null, ex); } } } public static int[] generateRandomArray(int minLength, int maxLength, int minVal, int maxVal) { int[] arr = new int[minLength+rand.nextInt((maxLength-minLength)+1)]; populateArray(arr, minVal, maxVal); return arr; } public static void populateArray(int arr[], int min, int max) { for(int i = 0; i &lt; arr.length; i++) arr[i] = min+rand.nextInt((max-min)+1); } private static void quickSortTailRecurse(int[] arr, int lo, int …
has comment: http://stackoverflow.com/comment/39723873
has comment: http://stackoverflow.com/comment/39723875
tagged with: quicksort
tagged with: optimization
has comment: http://stackoverflow.com/comment/39723960
score: 0
has comment: http://stackoverflow.com/comment/39723889
has answer: http://stackoverflow.com/a/25457151
has comment: http://stackoverflow.com/comment/39723902
has comment: http://stackoverflow.com/comment/39723887
tagged with: java
has comment: http://stackoverflow.com/comment/39723715
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/39729786
tagged with: tail-recursion
has comment: http://stackoverflow.com/comment/39723961
has title: Why does sorting the smaller subarray first result in faster quicksort?

http://stackoverflow.com/a/25525456
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25499751
has body: On your code, what happen if you don't get any prediction? Well, index will be equals to 0, and predictions.get(index) will crash because there is no object at index 0. public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) { ArrayList&lt;Prediction&gt; predictions = gestures.recognize(gesture); if (predictions == null || predictions.isEmpty()) { return; } // continue the regular flow }
answers question: http://stackoverflow.com/q/25499751
type: Answer
score: 0

http://stackoverflow.com/comment/129348877
score: 0
has text: It doesn't work. Exclude only excluided AutoConfiguration. Not beans and regualr Configuration
type: Comment
comment on: http://stackoverflow.com/a/44997843
type: AnswerComment

http://stackoverflow.com/a/25419451
has comment: http://stackoverflow.com/comment/39679856
has comment: http://stackoverflow.com/comment/39653717
answers question: http://stackoverflow.com/q/25419369
has comment: http://stackoverflow.com/comment/39654760
has comment: http://stackoverflow.com/comment/39680360
type: Answer
has body: Try setting -keepclassmembers to @javax.annotation.Resource? -keepclassmembers class * { @javax.annotation.Resource *; } If that doesn't work, you might have to wire your context together by name, since your class names are likely getting mangled. Add @Bean("somename") to the classes and update the fields to @Resource("somename") so they match.
has comment: http://stackoverflow.com/comment/39655066
score: 0
has comment: http://stackoverflow.com/comment/39656588

http://stackoverflow.com/q/25459255
tagged with: java
answer count: 1
type: Question
has body: so what I am trying to accomplish is check a file to see if a word in the file matches the customers input. I am attaching the code from when the button is clicked and what its supposed to do. Where its failing, or basically not doing it right, is where its supposed to check to see if it is in the list. *CODE* btn1.setOnClickListener(new OnClickListener() { // listen for when i click public void onClick(View v) { btn1.setText("yeah"); theirpass = edt1.getText().toString().toLowerCase(); // set theirpass = to text boxs input System.out.println("before i read file theirpass =s "+ theirpass); System.out.println("before i read file checking =s "+ checking); readFile(); // read the accouts dude tv1.setText("i pressed the button");// test to make sure button pressing works System.out.println("after reading. theirpass =s " + theirpass); System.out.println("after i read file. checking =s "+ checking); }// end on click }); //end listener }// end oncreate public void readFile() { BufferedReader reader = null; try { reader = new BufferedReader( new. InputStreamReader(getAssets().open("account.txt"))); // do reading, usually loop until end of file reading String mLine = reader.readLine();// reading each line. while (mLine != null) { //process line mLine = reader.readLine(); if. (mLine.matches(theirpass)) { // when an. account is found stop reading System.out.println("cheking mLine"+ mLine); checking = theirpass; //trying to set vale of. checking to theirpass Log.d("if statement in mline",checking); mLine=null;// trying to stop the loop }//end if }// end loop } catch (IOException e) { //log the exception } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { //log the exception Log.d("Catch buffer","i failed the catch in finally for reading lines"); } } }//end buffer reader Toast.makeText(this,checking,Toast.LENGTH_LONG).show(); //test to get. value of cheking, keeps coming up blank- no text if (checking == theirpass) { btn1.setText("its there");//test…
accepted answer: http://stackoverflow.com/a/25460927
tagged with: if-statement
tagged with: android
tagged with: bufferedreader
type: AnsweredQuestion
has title: in android, trying to find text loaded from an asset file
score: 0
tagged with: android-edittext
has answer: http://stackoverflow.com/a/25460927
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/comment/39834505
comment on: http://stackoverflow.com/q/25516426
score: 0
type: QuestionComment
has text: Please, post your logcat.
type: Comment

http://stackoverflow.com/q/25517486
has comment: http://stackoverflow.com/comment/39867283
has comment: http://stackoverflow.com/comment/39868592
type: UnansweredQuestion
tagged with: android-viewpager
tagged with: android
has comment: http://stackoverflow.com/comment/39896817
has comment: http://stackoverflow.com/comment/39898514
has comment: http://stackoverflow.com/comment/39866464
has comment: http://stackoverflow.com/comment/39867098
has comment: http://stackoverflow.com/comment/39866322
has comment: http://stackoverflow.com/comment/39837161
score: 0
has comment: http://stackoverflow.com/comment/39836972
has answer: http://stackoverflow.com/a/25518008
has comment: http://stackoverflow.com/comment/39866513
tagged with: java
has comment: http://stackoverflow.com/comment/39892682
answer count: 1
has comment: http://stackoverflow.com/comment/39867456
has comment: http://stackoverflow.com/comment/39866973
has body: I have developed simple android imageview that uses viewpager, and it plays music in background. It also stops music when last image is reached and it will resume the music when user slides back to the images. However, my main problem is that when device goes to sleep music stops and when device starts again instead of resuming music again and displaying image..It force closes... Any suggestion on how to fix this issue...Following are my codes... Mainactivity.java import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.Menu; import android.view.MenuItem; import android.widget.ShareActionProvider; public class MainActivity extends Activity { MediaPlayer oursong; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); oursong = MediaPlayer.create(MainActivity.this, R.raw.a); oursong.seekTo(0); oursong.start(); ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); final ImageAdapter adapter = new ImageAdapter(this); viewPager.setAdapter(adapter); viewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int pos) { if (pos == adapter.getCount() - 1) { oursong.pause(); } else if (!oursong.isPlaying()) { oursong.start(); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } }); } private ShareActionProvider mShareActionProvider; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate menu resource file. getMenuInflater().inflate(R.menu.activity_main, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_item_share); // Fetch and store ShareActionProvider m…
tagged with: gallery
has comment: http://stackoverflow.com/comment/39915706
has comment: http://stackoverflow.com/comment/39866980
type: Question
has title: How to fix Application force closes issue when device is turned on?

http://stackoverflow.com/q/25518066
answer count: 5
has answer: http://stackoverflow.com/a/25518321
tagged with: char
type: AnsweredQuestion
score: 0
tagged with: stack
tagged with: java
possible better answer: http://stackoverflow.com/a/25518097
has body: After an hour of looking for an solution in stackoverflow and other forums I gave up. Do you have an idea why I am getting the exception? public Stack&lt;Character&gt; einlesen(){ Scanner sc = new Scanner(System.in); Stack&lt;Character&gt; st = new Stack&lt;&gt;(); System.out.println("Please insert any random text: \n"); DataInputStream is = new DataInputStream(System.in); try { String eingabe; eingabe = is.readLine(); int i = 0; while (eingabe.charAt(i) != -1 ) { st.push(eingabe.charAt(i)); i++; } } catch (IOException e) { e.printStackTrace(); } return st; Edit: Thanks to Elliot its working perfectly. If I want to rewrite all the characters in the stack now in the opposite order I tried to use following code. But it only writes a few characters. When I use the peek function it gives me all of them. So I guess there is smth wrong with "i for ( int i =0; i&lt;st.size();i++) { System.out.print(st.pop().toString()); }
has answer: http://stackoverflow.com/a/25518097
accepted answer: http://stackoverflow.com/a/25518100
tagged with: while-loop
type: Question
has title: StringIndexOutOfBoundsException while loop with charat()
tagged with: exception
has answer: http://stackoverflow.com/a/25518092
has answer: http://stackoverflow.com/a/25518100
has comment: http://stackoverflow.com/comment/39837309
has answer: http://stackoverflow.com/a/25518113

firefox
type: Tag
tags question: http://stackoverflow.com/q/25491577
tag name: firefox

http://stackoverflow.com/a/54890675
score: 1
downvote count: 0
upvote count: 1
has body: Here is a builder I created to build the OAuth v1 Authorization header. You may find it useful. https://gist.github.com/robotdan/33f5834399b6b30fea2ae59e87823e1d Example usage calling Twitter: String authorizationHeader = new OAuth1AuthorizationHeaderBuilder() .withMethod("POST") .withURL("https://api.twitter.com/oauth/access_token") .withConsumerSecret("twitterConsumerSecret") .withTokenSecret("your_oauth_token_secret") .withParameter("oauth_consumer_key", "your_consumer_key") .withParameter("oauth_token", "your_oauth_token") .build()
type: Answer
answers question: http://stackoverflow.com/q/25418764

http://stackoverflow.com/a/25429167
has comment: http://stackoverflow.com/comment/39673319
type: Answer
has comment: http://stackoverflow.com/comment/39673439
answers question: http://stackoverflow.com/q/25429087
score: 0
upvote count: 1
downvote count: 1
has body: What if you moved the data input logic from the main frame and kept it running on a separate, dedicated, background thread whose sole job is to listen for connections and handle them. This would leave your parent JFrame to handle UI interactions thereby giving you the freedom to freeze it when one of your JDialog has focus.
has comment: http://stackoverflow.com/comment/39671212
has comment: http://stackoverflow.com/comment/39671372

http://stackoverflow.com/comment/39724655
comment on: http://stackoverflow.com/a/25456151
type: Comment
type: AnswerComment
score: 1
has text: Plus one to this one. 1. For getting rid of setBound. 2. For not entertaining this overly pointless idea of overring setBackground.

http://stackoverflow.com/comment/39874052
score: 0
type: Comment
type: QuestionComment
has text: Oops yes, private final.
comment on: http://stackoverflow.com/q/25537932

http://stackoverflow.com/comment/39652864
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25418959
has text: you say FullScreen is your checkbox variable but as per your code it is a boolean variable and this is the reason of your crash. @jasonflanagan

http://stackoverflow.com/comment/39612269
has text: And now you can understand why you can `implement` multiple interfaces, but not `extend` multiple classes
comment on: http://stackoverflow.com/q/25397317
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39687946
has text: It should be noted that your algorithm (known as a "greedy algorithm") won't work right (produce the minimal number of coins to represent the value) if the coinage includes, say, a 30-cent piece (in addition to the others listed).
comment on: http://stackoverflow.com/a/25437710
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/25531997
tagged with: java
has comment: http://stackoverflow.com/comment/39928486
has title: How to create a combobox with checkbox items?
tagged with: combobox
has answer: http://stackoverflow.com/a/25532125
type: UnansweredQuestion
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25533714
downvote count: 0
has body: Hello all Java developpers I have developed a simple application with java import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; public class Klass { public static void main(String[] args) { JFrame frame = new JFrame("My Frame"); //****************** Basic Configuration *****************// frame.setSize(400, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); //*********************************************************// JPanel pan = new JPanel(); JComboBox cmb = new JComboBox(); cmb.addItem("Worker 1"); cmb.addItem("Worker 2"); cmb.addItem("Worker 3"); cmb.addItem("Worker 4"); pan.add(cmb); frame.add(pan); frame.setVisible(true); }} But what I want is to make combobox Items displayed as checkbox objects, I want to select more than one worker at once. please help me with your suggestions
has answer: http://stackoverflow.com/a/25532944
score: 2
answer count: 3

http://stackoverflow.com/a/25548241
downvote count: 0
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/39891533
has body: Try to parse it and if exception occurs return false else return true boolean numberValidation(String supposedNumber) { boolean flag = false; int x; try { x = Integer.parseInt(supposedNumber); flag = true; } catch(NumberFormatException ex) { flag = false; } return flag; }
has comment: http://stackoverflow.com/comment/39891448
has comment: http://stackoverflow.com/comment/39891386
answers question: http://stackoverflow.com/q/25548162
has comment: http://stackoverflow.com/comment/39891478
type: Answer
has comment: http://stackoverflow.com/comment/39891420

http://stackoverflow.com/comment/39717343
score: 0
type: QuestionComment
has text: you can probably use putty
type: Comment
comment on: http://stackoverflow.com/q/25453682

http://stackoverflow.com/comment/39767011
type: Comment
score: 0
type: AnswerComment
has text: I don't want to stop the Tomcat, that's the catch. I want it to stay up but the application on it to tell Nginx that the Tomcat is unavailable. I've edited the question to make it clearer.
comment on: http://stackoverflow.com/a/25480344

http://stackoverflow.com/q/25498747
score: 5
accepted answer: http://stackoverflow.com/a/25510884
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25510884
type: AnsweredQuestion
tagged with: javafx-8
upvote count: 5
tagged with: java
tagged with: javafx
has body: My question concerns the proper usage of ObservableList and ListChangeListeners in JavaFX (JavaFX 8, though I guess it would be similar in 2.x). As I'm a JavaFX beginner, I'm asking if I've understood correctly how they should be used. Suppose I have a list of custom objects (let's call them Slots) which I'd want to render in a GridPane: each Slot would know where in the GridPane 'grid' it should go (= the row and the column data). There will exist an initial (Array)List of Slots, but because the contents of the list are subject to change, I figure it'd make sense to create an ObservableList, and attach to it a ListChangeListener. However, I'm a little puzzled about what do with change.wasUpdated() etc. methods. Does the following setup make sense: public class SlotViewController { @FXML private GridPane pane; private ObservableList&lt;Slot&gt; slots; @FXML public void initialize() { List&lt;Slot&gt; originalSlots = ... slots = FXCollections.observableList(originalSlots); slots.addListener(new ListChangeListener&lt;Slot&gt;() { @Override public void onChanged(ListChangeListener.Change&lt;? extends Slot&gt; change) { while (change.next()) { if (change.wasUpdated()) { for (Slot slot : change.getList()) { slot.update(pane); } } else { for (Slot removedSlot : change.getRemoved()) { removedSlot.removeFrom(pane); } for (Slot addedSlot : change.getAddedSubList()) { addedSlot.addTO(pane); } } } } }); } wherein the Slot would then have methods update(GridPane pane), addTO(GridPane pane) and removeFrom(GridPane pane)` that would look about like this: (I don't have idea what I should do with update(GridPane pane), though.) public class Slot { ... public void addTo(GridPane pane) { // slot contents might be e.g. a couple of String labels in a HBox. pane.add(this.getSlotContents(), this.getColumn(), this.getRow()); } public void removeFrom(GridPane pane) { pane.getChildren().remove(this); // ? } public void update(GridPane pane) { // ???? } } (1) Overall, would this work, or am …
has title: JavaFX: GridPane, ObservableList and ListChangeListener
favorite count: 0
type: Question

http://stackoverflow.com/a/25479685
type: Answer
answers question: http://stackoverflow.com/q/25479548
has body: You may try using two list for tracking the mail status. List&lt;MailId&gt; read; List&lt;MailId&gt; unread; When user flips mail to read, then move the MailId from unread to read list and vice-versa.
score: 0

http://stackoverflow.com/comment/39804411
score: 0
has text: As there's a cast to byte just after, I really don't see why there's this `& 0xFF`.
type: Comment
comment on: http://stackoverflow.com/a/25500512
type: AnswerComment

http://stackoverflow.com/comment/87117383
type: Comment
type: AnswerComment
score: 1
has text: I also had to use stepwise=false, disconnect=true alone was not enough. using camel 2.18.1
comment on: http://stackoverflow.com/a/25663698

http://stackoverflow.com/comment/39737619
type: Comment
type: QuestionComment
has text: You mean when the user starts the camera and presses back button?
comment on: http://stackoverflow.com/q/25462324
score: 0

http://stackoverflow.com/a/25520109
has body: As suggested by Piotr, select a column or set of columns that are unique in your view. If you have a single column that is unique and not null then you can select that as your primary key. For example, to make empId as primary key, you can try this: @Id @Column(name = "EmpID") private String empId; But if you have multiple columns that can form as your composite key then you need to create an composite key using @EmbeddedId: @Entity @Table(name = "employmentinformationview") public class EmploymentInformationView implements Serializable { @EmbeddedId @AttributeOverride(name="infoId", column=@Column(name="InfoID") @AttributeOverride(name="empId", column=@Column(name="EmpID") EmploymentViewId id; ... } The composite key is declared as an Embedabble class: @Embeddable class EmploymentViewId implements Serializable { int infoId; String empId; }
downvote count: 0
has comment: http://stackoverflow.com/comment/39840839
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/39841144
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25519401
answers question: http://stackoverflow.com/q/25519401

http://stackoverflow.com/comment/39751163
comment on: http://stackoverflow.com/q/25471892
score: 0
has text: Let's say you rent a room. Every time you rent the room to someone, you have to be careful that you haven't already rented the room to someone else. Now if you dedicate the room to a single person, and this person is thus the only one who can rent the room, you don't have to do any checks before renting it anymore. The room isn't shared, so there is no room (no pun intended) for conflicts. thread-safety is all about shared state. No shared state, no problem.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25411278
linked to: http://stackoverflow.com/q/16656400
linked to: http://stackoverflow.com/q/19652974
type: Question
tagged with: graphics
linked to: http://stackoverflow.com/q/24849691
answer count: 2
has comment: http://stackoverflow.com/comment/39662509
tagged with: textfield
has body: I searched for many topics but did not find any with a concrete answer. I need a field data input on the Graphics2D (like the JTextField or TextField). Does anyone know how I can create this component? Or put a text field (Component) in Graphics2D? Thank you!
has comment: http://stackoverflow.com/comment/39638498
has answer: http://stackoverflow.com/a/25412439
has title: Java graphics2d: text field
tagged with: swing
has comment: http://stackoverflow.com/comment/39638628
has answer: http://stackoverflow.com/a/25487877
possible better answer: http://stackoverflow.com/a/25487877
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/39638645
tagged with: java
accepted answer: http://stackoverflow.com/a/25412439

http://stackoverflow.com/comment/39630988
type: Comment
has text: I find this solution to be inferior to the _Utils_ solutions proposed in my post as it will not break compilation if `TheProtectedClass` changes name between library versions.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25407383

http://stackoverflow.com/a/25494874
has body: The error message is telling you exactly what is wrong. You're passing in a window variable into the drawBox method, but you don't declare or initialize such a variable in the main method before doing so, and so this cannot be done in Java. BoxyMethod c = new BoxyMethod(); // *** window variable below is used but never declared prior to use c.drawBox(window, Color.RED, 200, 300); More importantly though, you're not doing Swing drawing correctly. Instead, you should create a class that extends JPanel, give it a paintComponent(Graphics g) method override, and draw in that method. Then place that JPanel in a JFrame and display the JFrame. Please check out the Performing Custom Painting Swing graphics tutorial for more detail on how to do Swing graphics. As an aside, do not follow that tutorial that you've linked to as it is 30 years out of date. For example: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.*; public class BoxyTest { private static void createAndShowGui() { JFrame frame = new JFrame("Boxy Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new BoxyPanel(200, 300)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } } @SuppressWarnings("serial") class BoxyPanel extends JPanel { private static final int PREF_W = 800; private static final int PREF_H = 650; private int myX; private int myY; public BoxyPanel(int myX, int myY) { this.myX = myX; this.myY = myY; } @Override // so my JPanel will be big enough to see public Dimension getPreferredSize() { if (isPreferredSizeSet()) { return super.getPreferredSize(); } return new Dimension(PREF_W, PREF_H); } @Override protected void paintComponent(Graphics g) { // call super method so that the JPanel can do housekeeping painting super.paintComponent(g); g.fillRect(myX, myY, 100, 1…
answers question: http://stackoverflow.com/q/25494851
downvote count: 0
has comment: http://stackoverflow.com/comment/39794737
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39796753
score: 6
has comment: http://stackoverflow.com/comment/39794302
has comment: http://stackoverflow.com/comment/39794289
accepted answer of: http://stackoverflow.com/q/25494851
upvote count: 6
type: Answer

clipboard
tags question: http://stackoverflow.com/q/25402290
tag name: clipboard
type: Tag

http://stackoverflow.com/comment/39702685
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/25446411
type: Comment
has text: Drawing (semi-) transparent stuff usually is more expensive, because the system has to *check* what color already *is* at the target location and mix it with the new color, and can *not* just overwrite it as it could be done with non-transparent data. But +1: Creating a new image is not necessary here (and if it was required, it could be cached)

http://stackoverflow.com/comment/39941136
has text: @vivien, as far as I know for default there isnt, but with the help of loop you can iterate each of your column indexes to put inside .getColumn(int columnPosition) as parameter. Then you can set preffered size for those columns.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25531169
type: Comment

http://stackoverflow.com/q/25534338
upvote count: 1
type: UnansweredQuestion
answer count: 1
tagged with: selenium
has title: Xpath of container with same class name
favorite count: 0
has answer: http://stackoverflow.com/a/25534426
type: Question
has body: I am writing a selenium test for a java applicaton that creates new id after every login session, so I can't find an element using ID's. How do I find the second or third class in xpath that has the same name without using ID's
tagged with: java
score: -1
tagged with: selenium-webdriver
tagged with: xpath
downvote count: 2

http://stackoverflow.com/comment/39839616
score: 0
type: Comment
has text: yeah sure i will do it. i need ur help pls provide ur g+
type: AnswerComment
comment on: http://stackoverflow.com/a/25506481

http://stackoverflow.com/comment/133275541
score: 1
has text: @JohnyClash: "fully should be expected from any open source development environment" -- you are welcome to build Android from its open source code and set the heap limit to be whatever you want. If you want to use an existing commercial build of Android from a device manufacturer, the device manufacturer will be in charge of the heap limit. That is because Android is primarily a consumer OS, and consumers want their devices to work, despite developers who want to abuse the system resources.
type: Comment
comment on: http://stackoverflow.com/a/25436478
type: AnswerComment

http://stackoverflow.com/a/25445677
score: 1
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/39701329
has body: Why did you turn off auto-commit? setAutocommit(false); Since you disabled auto-commit, your INSERT/UPDATE will not be executed immediately. So if you call m() twice, since it starts with a SELECT that will be executed again before the INSERT/UPDATE from the previous run will be executed, hence you'll see an execution order: SELECT > SELECT > INSERT/UPDATE > INSERT/UPDATE You should commit before you return from m() or you should go with @Transactional but don't disable auto-commit.
has comment: http://stackoverflow.com/comment/39701762
type: Answer
answers question: http://stackoverflow.com/q/25445577

http://stackoverflow.com/a/25446891
has body: Your example (if I understand it correctly; I don't know Haskell) is a "function" that does a one to one mapping of an integer to an integer, with a limited set of values mapping to specified values and all others mapping to 0. The closest analogy for that in Java would to use a Map: private static final Map&lt;Integer,Integer&gt; mapping = new HashMap&lt;&gt;(); static { mapping.put(2,4); mapping.put(3,9); mapping.put(4,16); } public int f(int x) { Integer result = mapping.get(x); if (result == null) { return 0; } else { return result; } }
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25446426
type: Answer

http://stackoverflow.com/comment/39719595
comment on: http://stackoverflow.com/a/25434339
score: 0
type: Comment
type: AnswerComment
has text: I think my suggestion to use the WifiP2pManager should do what you want. It looks like Google just split the WifiManager up into smaller managers. What exactly is the code trying to do?

http://stackoverflow.com/q/25504624
has answer: http://stackoverflow.com/a/31592093
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27273632
has comment: http://stackoverflow.com/comment/39923184
has comment: http://stackoverflow.com/comment/39910948
score: 3
tagged with: rest
answer count: 3
tagged with: atg
upvote count: 3
tagged with: java
has body: I need to call method using ATG 11 REST API. public String getString(String str) { return str; } I created actor properties configuration like this: $class=atg.service.actor.ActorChainService definitionFile=/path/to/service/accountServiceActor.xml And that my accountServiceActor.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;actor-template default-chain-id="cartService" xsi:noNamespaceSchemaLocation="http://www.atg.com/xsds/actorChain_1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;actor-chain id="getString" transaction="TX_SUPPORTS"&gt; &lt;component id="getString" name="/path/to/service/AccountService" method="getString" method-return-var="str"&gt; &lt;input name="str" value="${param.str}" /&gt; &lt;output id="str" name="str" value="${str}" /&gt; &lt;/component&gt; &lt;/actor-chain&gt; &lt;/actor-template&gt; Also I updated AccessControlServlet.properties and ActorChainRestRegistry.properties So my rest call is here: curl -L -v -b customer_cookies.txt -X POST -H "Content-Type: application/json" -d '{ "str" : "value" }' http://localhost:7003/path/to/service/AccountServiceActor/getString And i am getting this error: * Adding handle: conn: 0x7f8eb9803000 * Adding handle: send: 0 * Adding handle: recv: 0 * Curl_addHandleToPipeline: length: 1 * - Conn 0 (0x7f8eb9803000) send_pipe: 1, recv_pipe: 0 * About to connect() to localhost port 7003 (#0) * Trying ::1... * Connected to localhost (::1) port 7003 (#0) &gt; POST /path/to/service/AccountServiceActor/getString HTTP/1.1 &gt; User-Agent: curl/7.30.0 &gt; Host: localhost:7003 &gt; Accept: */* &gt; Cookie: DYN_USER_CONFIRM=f0f599f9f11aa5571d7055c2b4c7c9d5; DYN_USER_ID=240004; JSESSIONID=6iUR5qvjjBHPhSNq6zMh_B6dn18lwhKFWvPbOZxTekUIhsFPqf3r!-1528908093 &gt; Content-Type: application/json &gt; Content-Length: 20 &gt; * upload completely sent off: 20 out of 20 bytes &lt; HTTP/1.1 500 Internal Server Error &lt; Connection: close &lt; Date: Tue, 26 Aug 2014 11:19:21 GMT &lt; Content-Length: 265 &lt…
favorite count: 0
type: Question
has title: ATG 11 REST call with parameters
has comment: http://stackoverflow.com/comment/39863674
has answer: http://stackoverflow.com/a/36418326
has comment: http://stackoverflow.com/comment/39887340

http://stackoverflow.com/a/25529962
upvote count: 4
has body: Create a new class called Util, and add the method; public class Util { public static int Calculation(int x, int y, int z, int i) { int calculation=0; x = y + z / 2 + i; if (x &gt;= 10) { calculation = 1; } else if (x &lt; 10) { calculation = 0; } return calculation; } } Then from anywhere, you can call it like this; int final_value = Util.calculation(1,2,3,4);
downvote count: 0
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25529799

http://stackoverflow.com/q/25402789
tagged with: java
has comment: http://stackoverflow.com/comment/39624828
tagged with: amazon-ec2
answer count: 1
has answer: http://stackoverflow.com/a/25406000
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39634088
has title: Connect the AWS aerospike instance in Java
tagged with: amazon-web-services
has body: I've the aerospike instance in the AWS EC2. I can connect through putty but I try through java code (Java client). I can't connect to the aerospike. AerospikeClient client = new AerospikeClient("IP-address", 3000); System.out.println(client.isConnected()); "IP-address" I try out followings Amazon EC2 instance private IP public IP private DNS public DNS unfortunately prints system connected false. Any idea about this?
tagged with: aerospike
score: 0

http://stackoverflow.com/q/25459977
has comment: http://stackoverflow.com/comment/42173245
type: UnansweredQuestion
answer count: 1
score: 4
has answer: http://stackoverflow.com/a/26811675
tagged with: notifications
tagged with: push-notification
tagged with: java
has comment: http://stackoverflow.com/comment/41968038
has body: 08-23 13:42:57.649: E/AndroidRuntime(3836): FATAL EXCEPTION: main 08-23 13:42:57.649: E/AndroidRuntime(3836): android.app.RemoteServiceException: Bad notification posted from package com.test.nursery.rhymes.stories: Couldn't expand RemoteViews for: StatusBarNotification(pkg=com.test.nursery.rhymes.stories id=16104475 tag=null score=0 notn=Notification(pri=0 contentView=com.test.nursery.rhymes.stories/0x7f030012 vibrate=null sound=null defaults=0x4 flags=0x10 kind=[null])) 08-23 13:42:57.649: E/AndroidRuntime(3836): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1471) 08-23 13:42:57.649: E/AndroidRuntime(3836): at android.os.Handler.dispatchMessage(Handler.java:99) 08-23 13:42:57.649: E/AndroidRuntime(3836): at android.os.Looper.loop(Looper.java:153) 08-23 13:42:57.649: E/AndroidRuntime(3836): at android.app.ActivityThread.main(ActivityThread.java:5000) 08-23 13:42:57.649: E/AndroidRuntime(3836): at java.lang.reflect.Method.invokeNative(Native Method) 08-23 13:42:57.649: E/AndroidRuntime(3836): at java.lang.reflect.Method.invoke(Method.java:511) 08-23 13:42:57.649: E/AndroidRuntime(3836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 08-23 13:42:57.649: E/AndroidRuntime(3836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 08-23 13:42:57.649: E/AndroidRuntime(3836): at dalvik.system.NativeStart.main(Native Method) can anyone help me im getting issue like this when i send push notification when app is not running. please anyone help... the code for this issue is as requested. the also want to understand the detailed concept of remote views. i tried to study it from developer site. but cant get it better explained over there. also please paste some helpful links for this. code is as follows: long when = System.currentTimeMillis(); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(res…
has comment: http://stackoverflow.com/comment/51631517
downvote count: 1
has title: Bad notification posted from package, Couldn't Expand RemoteViews
favorite count: 0
type: Question
tagged with: android
upvote count: 5

http://stackoverflow.com/comment/39896265
comment on: http://stackoverflow.com/a/25514641
score: 0
type: Comment
has text: I inverted the way I was doing things so this is no longer needed. Maybe the ormlite team will consider what you posted.
type: AnswerComment

http://stackoverflow.com/q/25438160
possible better answer: http://stackoverflow.com/a/57639193
has title: How do I properly include an external jar file for a cordova plugin?
has body: I am trying to make a simple cordova android plugin that requires classes defined in a jar file. I have a test project here, that includes the example usage &amp; a simplified version of my plugin. In my plugin.xml, I have this: &lt;platform name="android"&gt; &lt;config-file target="res/xml/config.xml" parent="/*"&gt; &lt;feature name="Pebble"&gt; &lt;param name="android-package" value="com.jetboystudio.pebble.PebblePGPlugin"/&gt; &lt;/feature&gt; &lt;/config-file&gt; &lt;source-file src="src/android/PebblePGPlugin.java" target-dir="src/com/jetboystudio/pebble" /&gt; &lt;source-file src="src/android/libs/pebble_kit.jar" target-dir="libs" /&gt; &lt;/platform&gt; In my test project, I have pebblekit jar in-place where it needs to be (I think): plugins/com.jetboystudio.pebble.PebblePGPlugin/src/android/libs/pebble_kit.jar When I "cordova build" I get no errors, but when I install the apk-file I get "Class not found" in Chrome device inspect. I am assuming this class it can't find is one of the classes defined in pebble_kit.jar. Also, it doesn't seem to be copying this file into platforms/android. If I could just debug better (which class is not found?) that might be a good start, if no one has the actual answer of why this doesn't work.
tagged with: android
tagged with: java
accepted answer: http://stackoverflow.com/a/25440153
score: 17
has answer: http://stackoverflow.com/a/25440153
type: AnsweredQuestion
tagged with: cordova
answer count: 2
has answer: http://stackoverflow.com/a/57639193
downvote count: 0
favorite count: 0
upvote count: 17
type: Question

http://stackoverflow.com/q/25453218
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39716218
type: Question
has answer: http://stackoverflow.com/a/25453356
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39716017
has comment: http://stackoverflow.com/comment/39716146
has body: I have some experience with C and PHP but never really touched OOP. Started Headfirst Java book and got confused about this guessing game program. I don't understand just the first part of the program. what is going in GuessGame class in the beginning? public class GuessGame{ Player p1; Player p2; Player p3; public void startGame() { p1=new Player(); p2=new Player(); p3=new Player(); int guessp1=0; int guessp2=0; int guessp3=0; boolean p1isRight=false; boolean p2isRight=false; boolean p3isRight=false; int targetNumber = (int) (Math.Random() * 10); System.out.println("I'm thinking of a number between 0 and 9..."); while(true) { System.out.println("Number to guess is " + targetNumber); p1.guess(); p2.guess(); p3.guess(); guessp1 = p1.number; System.out.printn("Player one guessed " + guessp1); guessp2 = p2.number; System.out.printn("Player two guessed " + guessp2); guessp3 = p3.number; System.out.printn("Player three guessed " + guessp3); if(guessp1==targetNumber) p1isRight=true; if(guessp2==targetNumber) p2isRight=true; if(guessp3==targetNumber) p3isRight=true; if(p1isRight || p2isRight || p3isRight) { System.out.println("We have a winner!"); System.out.println("Player one got it right? " +p1isRight); System.out.println("Player two got it right? " +p2isRight); System.out.println("Player three got it right? " +p3isRight); System.out.println("Game's up."); break; }else System.out.println("Players will have to try again."); } } } public class Player { int number = 0; public void guess() { number = (int) (Math.random()*10); System.out.println("I'm guessing " +number); } } public class GameLauncher { public static void main (String[] args) { GuessGame game = new GuessGame(); game.startGame(); } } So this is what I don't understand : I get that p1= new Player(); means creating p1 object from class player but what does Player p1 mean ? Is it a declaration of p1 variable of type Player?
has title: HeadFirstJava Guessing Game
score: 0

http://stackoverflow.com/a/25464538
score: 0
answers question: http://stackoverflow.com/q/25463569
type: Answer
has comment: http://stackoverflow.com/comment/39737721
has body: All your ifs are nested so if the first fails, all the rest are skipped. Try closing the curly braces after each if body as: if( condition1 ){ body } if( condition2 ){ body2 } ...

http://stackoverflow.com/a/33739070
answers question: http://stackoverflow.com/q/25543910
type: Answer
score: 0
has body: For me the problem was very strange. I have a testng.xml file at the root of my Eclipse project. When I changed the file through Eclipse, it wasn't changing the testng.xml file in my directory. Turns out it made a copy of the folder into the eclipse workspace.. Hope this helps someone out

http://stackoverflow.com/comment/39729563
comment on: http://stackoverflow.com/q/25460137
type: QuestionComment
type: Comment
score: 0
has text: @Tom If he needs to sync the changes back to the server, JPA will probably only complicate things.

http://stackoverflow.com/a/25420194
accepted answer of: http://stackoverflow.com/q/25419896
type: AcceptedAnswer
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25419896
score: 1
has body: Maybe I don't understand what you need, but instead of inherit LoginTest and Privillege - can u just use/call their functionality into your Alerts (keep instances of LoginTest and Privillege)? If they are in same package - this shouldn't be a problem. In my experience I've always consider creation and usage of BaseTest.java wich helps me to share test_logic in my architecture. In case you need some more complex logic you can always try use Decorator or try Mediator.
downvote count: 0

http://stackoverflow.com/comment/39604800
type: AnswerComment
comment on: http://stackoverflow.com/a/25392698
score: 0
has text: I have changed the formatting to "%s ", which prints to rows, however the data for the five strings is printed in sequential order in one long row. Any suggestions for how to print ALL of stream 7 on one row, then all of stream 8 on the second row, etc?
type: Comment

http://stackoverflow.com/comment/39875586
comment on: http://stackoverflow.com/q/25539222
score: 0
has text: See this answer to a similar question http://stackoverflow.com/a/588014/3440545
type: Comment
type: QuestionComment

dokuwiki
tags question: http://stackoverflow.com/q/25405062
tag name: dokuwiki
type: Tag

http://stackoverflow.com/comment/39637851
comment on: http://stackoverflow.com/q/25409138
type: Comment
type: QuestionComment
score: 0
has text: where is the LogCat /stacktrace? please post it up

http://stackoverflow.com/q/25427913
answer count: 1
has title: Not able to start app in Apache Tomcat
type: Question
has body: Just to let you know, I'm not a programmer at all so I'm kind of lost in my problem. I'm trying to migrate an app from a Windows Server 2003 server on Apache Tomcat 4.1 and Java 1.4.2 (App is working fine on that server). I'm tried migrating it on a Windows Server 2008 R2 with any version of Apache Tomcat and Java compatible with W2KR2 but I'm always getting the same error when I try to start the app from the web interface: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/GestClientsAS2]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3780) at org.apache.catalina.startup.HostConfig.reload(HostConfig.java:1307) at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1290) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1474) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:280) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1141) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1365) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1369) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1345) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NoClassDefFoundError: javax/mail/internet/MimeBodyPart at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getDeclaredMethods(Unknown Source) at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:127) at org.apache.catali…
accepted answer: http://stackoverflow.com/a/25428196
has comment: http://stackoverflow.com/comment/39669234
has comment: http://stackoverflow.com/comment/39668854
has answer: http://stackoverflow.com/a/25428196
has comment: http://stackoverflow.com/comment/39668831
tagged with: apache
has comment: http://stackoverflow.com/comment/39668788
tagged with: tomcat
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/25516006
score: 1
has body: When using a NotificationCompat builder in Android, how can I conditionally apply one of the methods? return new NotificationCompat.BigPictureStyle(notificationBuilder) .setBigContentTitle(bigContentTitle) .bigPicture(imageBitmap) .setSummaryText(summaryText)// only apply if parameter length &gt; 0 .build();
favorite count: 0
accepted answer: http://stackoverflow.com/a/25516292
has answer: http://stackoverflow.com/a/25516292
type: Question
possible better answer: http://stackoverflow.com/a/25516124
tagged with: android
has title: Conditionally apply Android notification builder methods
has answer: http://stackoverflow.com/a/25516124
tagged with: android-studio
type: AnsweredQuestion
tagged with: java
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25516129
upvote count: 1

http://stackoverflow.com/q/25449800
duplicate of: http://stackoverflow.com/q/218384
tagged with: jdbc
has comment: http://stackoverflow.com/comment/39709140
has body: First of all before i created this dao I was doing this operation in a helper class and it was working well. Now I'm getting a NullpointerException on this line where I call dao. Student stu = pf.getUser(request.getParameter("st_id").toString()); I tried to trace it and find the problem but i couldn't. I'm new in jdbc so any suggestions will be appreciated. This is my student dao; program doesn't even enter the getUser method. public class StDAO extends BaseDAO { public Student getUser(String Id) throws Exception { String query = "select * from students where id=" + Id; ResultSet rs = execQuery(query); return new Student(rs.getString("name"), Id, rs.getString("gpa")); } public void addUser(String id, String name, String gpa) throws Exception { String query = "INSERT INTO students (name, id, `gpa`) VALUES ('" + name + "'," + id + "," + gpa + ")"; ResultSet rs = execQuery(query); } }
has answer: http://stackoverflow.com/a/25449850
has comment: http://stackoverflow.com/comment/39710654
has comment: http://stackoverflow.com/comment/39709722
tagged with: dao
score: 0
tagged with: nullpointerexception
tagged with: java
has title: Cannot implement a DAO
answer count: 1
has comment: http://stackoverflow.com/comment/39709097
type: Question
has comment: http://stackoverflow.com/comment/39709691
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/39709138
type: UnansweredQuestion

http://stackoverflow.com/comment/39903706
type: QuestionComment
has text: Hey guys my question is different, and you went to some another topic. Can you plz tell me some example also?
comment on: http://stackoverflow.com/q/25550515
score: 0
type: Comment

http://stackoverflow.com/comment/39813258
comment on: http://stackoverflow.com/q/25505199
type: Comment
has text: what is on Testcase_execute.java:47
type: QuestionComment
score: 0

http://stackoverflow.com/comment/39802332
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25486313
type: Comment
has text: oh hey hi so your input is in one single line? We assumed there is one line per "entry". That will make things complicated @Scorpiorian83.

http://stackoverflow.com/a/25481959
answers question: http://stackoverflow.com/q/25481928
has body: You have to call java -cp . Chapter08_JavaIOFundamentals.Echo from the parent directionry of Chapter08_JavaIOFundamentals
score: 5
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/39769560
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25481928
has comment: http://stackoverflow.com/comment/39769743
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39769537
has comment: http://stackoverflow.com/comment/39769799

http://stackoverflow.com/q/25536969
has body: I am using Postgres SQL 9.2, Spring JDBC with version 4.0.5, and Java 8. Java 8 introduced new date/time API and I would like to use it, but I encountered some difficulties. I have created table TABLE_A: CREATE TABLE "TABLE_A" ( new_date date, old_date date ) I am using Spring JDBC to communicate with database. I have created Java class, which corresponds to this table: public class TableA { private LocalDate newDate; private Date oldDate; //getters and setters } this is my code which is reponsible for inserting new row: public void create(TableA tableA) { BeanPropertySqlParameterSource parameterSource = new BeanPropertySqlParameterSource(tableA); final String sql = "INSERT INTO public.TABLE_A (new_date,old_date) values(:newDate,:oldDate)"; namedJdbcTemplate.update(sql,parameterSource); } When I executed this method I got exception: org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.time.LocalDate. Use setObject() with an explicit Types value to specify the type to use. so I updated cretion of BeanPropertySqlParameterSource: BeanPropertySqlParameterSource parameterSource = new BeanPropertySqlParameterSource(tableA); parameterSource.registerSqlType("newDate", Types.DATE); after that change I was able to insert row. But next, I would like to fetch rows from database. Here is my method: public List&lt;TableA&gt; getAll() { final String sql = "select * from public.TABLE_A"; final BeanPropertyRowMapper&lt;TableA&gt; rowMapper = new BeanPropertyRowMapper&lt;TableA&gt;(TableA.class); return namedJdbcTemplate.query(sql,rowMapper); } and of course I got exception: ... at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:474) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1119) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:902) at org.springfram…
tagged with: spring
tagged with: java-8
score: 8
type: AnsweredQuestion
tagged with: spring-jdbc
has answer: http://stackoverflow.com/a/25539723
answer count: 2
has title: Spring JDBC + Postgres SQL + Java 8 - conversion from/to LocalDate
tagged with: java
downvote count: 0
favorite count: 0
type: Question
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/25539723
upvote count: 8
has answer: http://stackoverflow.com/a/39132545
possible better answer: http://stackoverflow.com/a/39132545

http://stackoverflow.com/comment/39625587
comment on: http://stackoverflow.com/q/25403911
has text: @VishalJain Read the accepted answer. Either use JDK 1.7 or use Spring4. Spring 3 doesn't work with JDK 1.8. (Although you might get lucky with 3.2.9 or up).
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25498320
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39804919
has title: What can I do with the FileManager of Struts2?
has body: I am reading the source of Struts2, and I found when the Dispatcher is initialized, it will init FileManager. It looks like be used to monitor files, but I don't know how to use it to monitor file. try { ***init_FileManager();*** init_DefaultProperties(); // [1] init_TraditionalXmlConfigurations(); // [2] init_LegacyStrutsProperties(); // [3] init_CustomConfigurationProviders(); // [5] init_FilterInitParameters() ; // [6] init_AliasStandardObjects() ; // [7] Container container = init_PreloadConfiguration(); container.inject(this); init_CheckWebLogicWorkaround(container); if (!dispatcherListeners.isEmpty()) { for (DispatcherListener l : dispatcherListeners) { l.dispatcherInitialized(this); } } } catch (Exception ex) { if (LOG.isErrorEnabled()) LOG.error("Dispatcher initialization failed", ex); throw new StrutsException(ex); } Can someone tells me? Many thanks!
tagged with: struts2
score: 0
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39804297

http://stackoverflow.com/a/25469902
downvote count: 0
has comment: http://stackoverflow.com/comment/39747561
answers question: http://stackoverflow.com/q/25469703
has body: I don't have the full code or the data, so these might not solve it, but I can see areas to improve: Code like this, spinning though every entry so far and setting a count to 0 is just going to get slower and slower. Remove it and handle the absence later on and treat as 0. //remove this for(String key : transitionTable.keySet()) { Row row = transitionTable.get(key); row.tagCount.put(tag, 0f); } //Handle later on: private void updateTranstionTable(String previousTag,String currentTag) { Row row = transitionTable.get(previousTag); Integer tagCount = row.tagCount.get(currentTag); int newTagCount = tagCount==null ? 1 : tagcount.intValue() + 1; row.tagCount.put(currentTag, newTagCount); } This is more efficient in terms of memory as you don't store loads of entries for 0s that will never get incremented. Plus it saves time placing those 0's in the Maps in the first place.
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/comment/39822640
type: Comment
type: QuestionComment
has text: Just as a side note, thanks to those who helped format my original question.
score: 0
comment on: http://stackoverflow.com/q/25510173

http://stackoverflow.com/comment/39885542
comment on: http://stackoverflow.com/a/25527294
has text: The portlet is just there on the user's login page, and hence doView will be called first. There is no way to call processAction directly. processAction will only be called once user does any action on that portlet. Also refer - http://stackoverflow.com/questions/11330969/understanding-the-execution-of-action-phase-and-render-phase
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/103375191
comment on: http://stackoverflow.com/a/25442825
type: AnswerComment
has text: this doesn't anwer the question, it's only a link to action bar official documentation.
score: 1
type: Comment

http://stackoverflow.com/comment/39852438
comment on: http://stackoverflow.com/q/25526783
score: 0
type: Comment
type: QuestionComment
has text: What version of hibernate are you using? Also are you using hibernate annotations or javax.persistence annotations?

http://stackoverflow.com/comment/39772131
score: 0
has text: Kindly suggest my bugs so i will take care of them in future
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25443401

ipv6
tag name: ipv6
tags question: http://stackoverflow.com/q/25446287
type: Tag

http://stackoverflow.com/comment/39614130
has text: Thanks for specific explanation. now I got it! bb
comment on: http://stackoverflow.com/a/25398197
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25530653
tagged with: amazon-mws
tagged with: java
has answer: http://stackoverflow.com/a/25603590
type: Question
has title: why Current Status of Listings is inactive amazon seller account
linked to: http://stackoverflow.com/q/17423769
type: UnansweredQuestion
answer count: 1
tagged with: amazon-web-services
has body: I have created a seller account and successfully created an item, but after 15 minutes it is not showing to buy on amazon portal. When we check Account info, then Current Status of Listings: Inactive (Listings not available for sale on Amazon) Why is current status of listing inactive?
score: 0

http://stackoverflow.com/comment/39782981
type: Comment
comment on: http://stackoverflow.com/q/25488572
type: QuestionComment
has text: any exceptions raised?
score: 0

http://stackoverflow.com/comment/39681198
comment on: http://stackoverflow.com/q/25434380
score: 0
has text: See java spec for initialization of fields: http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.3.2
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25515191
answers question: http://stackoverflow.com/q/25515113
has body: String var1 = "1"; String var2 = "2"; String var3 = String.valueOf(Integer.parseInt(var1) + Integer.parseInt(var2));
upvote count: 2
score: 1
downvote count: 1
type: Answer

selenium
tags question: http://stackoverflow.com/q/25536039
tags question: http://stackoverflow.com/q/25511938
tags question: http://stackoverflow.com/q/25487468
tags question: http://stackoverflow.com/q/25486381
tags question: http://stackoverflow.com/q/25475925
tags question: http://stackoverflow.com/q/25506472
tags question: http://stackoverflow.com/q/25468614
tags question: http://stackoverflow.com/q/25498303
tags question: http://stackoverflow.com/q/25525209
tags question: http://stackoverflow.com/q/25445423
tags question: http://stackoverflow.com/q/25475622
tags question: http://stackoverflow.com/q/25509155
tags question: http://stackoverflow.com/q/25444708
tags question: http://stackoverflow.com/q/25525421
tags question: http://stackoverflow.com/q/25397122
tags question: http://stackoverflow.com/q/25534338
tags question: http://stackoverflow.com/q/25538923
tags question: http://stackoverflow.com/q/25516285
tags question: http://stackoverflow.com/q/25549044
tags question: http://stackoverflow.com/q/25494924
tags question: http://stackoverflow.com/q/25506618
tags question: http://stackoverflow.com/q/25500342
tags question: http://stackoverflow.com/q/25430174
tags question: http://stackoverflow.com/q/25485515
tags question: http://stackoverflow.com/q/25543910
type: Tag
tags question: http://stackoverflow.com/q/25401293
tags question: http://stackoverflow.com/q/25431380
tags question: http://stackoverflow.com/q/25397552
tags question: http://stackoverflow.com/q/25419896
tags question: http://stackoverflow.com/q/25430104
tag name: selenium
tags question: http://stackoverflow.com/q/25502261
tags question: http://stackoverflow.com/q/25549866
tags question: http://stackoverflow.com/q/25427975
tags question: http://stackoverflow.com/q/25427193
tags question: http://stackoverflow.com/q/25399971
tags question: http://stackoverflow.com/q/25393995
tags question: http://stackoverflow.com/q/25521179
tags question: http://stackoverflow.com/q/25448425
tags question: http://stackoverflow.com/q/25404062
tags question: http://stackoverflow.com/q/25499729

http://stackoverflow.com/q/25478758
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25478945
has title: Unable to write multiple values into excel from Java code
score: 0
answer count: 1
tagged with: excel
has body: I am reading a value from excel and then after some logic writing some values into an excel file. The problem is only the last value is being written in the excel. I am calling writeExcel method each time I have to write a row in the excel. Below is the code. FileOutputStream fileOut = new FileOutputStream("poc-test.xls"); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet worksheet = workbook.createSheet("POC Worksheet"); public void writeExcel(String str) throws Exception{ HSSFRow row1 = worksheet.createRow((short) i++); HSSFCell cellA1 = row1.createCell((short) 0); cellA1.setCellValue(str); workbook.write(fileOut); }
type: Question

http://stackoverflow.com/comment/39859687
type: QuestionComment
has text: Try java -Xms512m -Xmx2048
comment on: http://stackoverflow.com/q/25530538
score: 1
type: Comment

http://stackoverflow.com/comment/39801532
type: QuestionComment
has text: Could you try a breakpoint inside the catch? The System.err showing up is no certain thing.
comment on: http://stackoverflow.com/q/25472534
score: 0
type: Comment

http://stackoverflow.com/a/25513840
has body: Using the ternary operator is the most simple, most efficient, and most readable way to do what you want. I encourage you to use this solution. However, I can't resist to propose an alternative, contrived, inefficient, unreadable solution. int boolToInt(Boolean b) { return b.compareTo(false); }
type: Answer
has comment: http://stackoverflow.com/comment/39829265
answers question: http://stackoverflow.com/q/25513763
score: 0

http://stackoverflow.com/a/25409575
answers question: http://stackoverflow.com/q/25409533
has body: This u1::printName is a method reference to be invoked on the object referenced by ui. The compiler doesn't know how to interpret the argument it should pass to the Consumer lambda. Its best guess is that it should be passed as u1.printName(arg); but such a method doesn't exist.
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/39883796
has text: you can refer the link http://www.java2s.com/Code/Java/Collections-Data-Structure/SortanHashMapbasedonthekeys.htm for sorting.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25543975

http://stackoverflow.com/q/25392353
has answer: http://stackoverflow.com/a/25392409
favorite count: 0
type: Question
answer count: 2
upvote count: 1
has body: How can I get all the CATALINA_OPTS and/or JAVA_OPTS parameters in a Java web app? I know I can read System.getProperties() to get all the system properties. However, it will just show all system properties, including the -D parameters passed via CATALINA_OPTS. Not any parameters like -Xmx, -Xms, etc. I know I can read ManagementFactory.getRuntimeMXBean() to get all the Java parameters. However, this also shows just the -D parameters. Not any parameters like -Xmx, -Xms, etc.
tagged with: tomcat
has title: Get catalina_opts in java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25392421
accepted answer: http://stackoverflow.com/a/25392421
possible better answer: http://stackoverflow.com/a/25392409
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/25480357
has comment: http://stackoverflow.com/comment/39767489
has comment: http://stackoverflow.com/comment/39768573
has comment: http://stackoverflow.com/comment/39767858
has comment: http://stackoverflow.com/comment/39766936
has comment: http://stackoverflow.com/comment/39766869
has comment: http://stackoverflow.com/comment/39766813
has body: I want to display notification pop up when user attempts to run application second time , So I create NotificationPop obj and call the method to display the dialog within my single instance class ,but , it doesn't display popup when application runs second time there is no problem with my NotificationPop window it functions normal however when I call it within Single Instance doesn't display. in output window of Netbeans it displays dialog is closed as well. Do i miss any step here ? import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; public class SingleInstance { public static File f; public static FileChannel channel; public static FileLock lock; public static TrayCon trayobj; public static boolean checkstatus; public static NotificationPop obj; public static void main(String args[]) throws IOException { try { f = new File("key"); if (f.exists()) { f.delete(); } channel = new RandomAccessFile(f, "rw").getChannel(); lock = channel.tryLock(); if (lock == null) { obj = new NotificationPop(); obj.displaypopupmessage(); System.exit(0); channel.close(); throw new RuntimeException("Only 1 instance can run"); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { trayobj = new TrayCon(); trayobj.CreateTrayCon(trayobj); } }); } catch (IOException ex) { } } }
tagged with: single-instance
has comment: http://stackoverflow.com/comment/39767093
has comment: http://stackoverflow.com/comment/39767290
has comment: http://stackoverflow.com/comment/39767009
linked to: http://stackoverflow.com/q/15747277
has comment: http://stackoverflow.com/comment/39766975
has comment: http://stackoverflow.com/comment/39766846
has comment: http://stackoverflow.com/comment/39767278
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25481523
accepted answer: http://stackoverflow.com/a/25481523
has title: Notification popup doesn't run with single instance
tagged with: java
has comment: http://stackoverflow.com/comment/39768511
answer count: 1
has comment: http://stackoverflow.com/comment/39767193
has comment: http://stackoverflow.com/comment/39767042
has comment: http://stackoverflow.com/comment/39767693
has comment: http://stackoverflow.com/comment/39766727
tagged with: swing
has comment: http://stackoverflow.com/comment/39766941
has comment: http://stackoverflow.com/comment/39766800
has comment: http://stackoverflow.com/comment/39767235
type: Question

http://stackoverflow.com/comment/39617366
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25399642
type: QuestionComment
has text: The example char is [1,2,3, , , , , ,], the resulting String should be 123 (no spaces left).

http://stackoverflow.com/q/25434614
tagged with: rest
tagged with: grizzly
has answer: http://stackoverflow.com/a/25434921
tagged with: java
downvote count: 1
score: -1
upvote count: 0
tagged with: jersey
type: UnansweredQuestion
has body: This is what I have in order to upload a file @POST @Path("/uploadFile") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.TEXT_PLAIN) public Response uploadFileSuite(@HeaderParam("Access-Control-Allow-Origin") @FormParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail, @QueryParam("key") String key) { //path = global variable String uploadedFileLocation = PATH + fileDetail.getFileName(); // save it writeToFile(uploadedInputStream, uploadedFileLocation); String output = "File uploaded to : " + uploadedFileLocation; return Response.status(200).entity(output).build(); } However, when I try compiling i keep getting the following error: SEVERE: Missing dependency for method public javax.ws.rs.core.Response Project.MyResource.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition,java.lang.String) at parameter at index 0 SEVERE: Missing dependency for method public javax.ws.rs.core.Response Project.MyResource.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition,java.lang.String) at parameter at index 1 SEVERE: Missing dependency for method public javax.ws.rs.core.Response Project.MyResource.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition,java.lang.String) at parameter at index 0 SEVERE: Missing dependency for method public javax.ws.rs.core.Response Project.MyResource.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition,java.lang.String) at parameter at index 1 SEVERE: Method, public javax.ws.rs.core.Response Project.MyResource.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition,java.lang.String), annotated with POST of resource, class Project.MyResource, is not recognized as valid resource method. I tried everything to fix it, but nothing seems to work. Any help would be greatly appreciated. Here is my pom.xml com.sun.jersey jersey-grizzly ${jers…
answer count: 1
favorite count: 0
type: Question
has title: Jersey REST + Grizzly webservice, Uploading file error

http://stackoverflow.com/a/25442043
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25441723
upvote count: 1
has body: This is wrong for (Entry&lt;Integer, String&gt; entry : myMap.entrySet()) { if (entry.getValue().contains("EnterStringHere")) { myMap.remove(entry); // you should pass the key to remove } } But you can't use this way to remove element. You will get ConcurrentModificationException. You can try this way using iterator to remove element while iterating. Map&lt;Integer,String&gt; map=new HashMap&lt;&gt;(); map.put(1,"EnterStringHere"); map.put(2,"hi"); map.put(3,"EnterStringHere"); Iterator&lt;Map.Entry&lt;Integer,String&gt;&gt; iterator=map.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry&lt;Integer,String&gt; entry=iterator.next(); if(entry.getValue().equals("EnterStringHere")){ iterator.remove(); } } System.out.println(map); Out put: {2=hi} You really need to see HashMap#remove()
type: Answer
accepted answer of: http://stackoverflow.com/q/25441723
score: 1

http://stackoverflow.com/a/25399883
has comment: http://stackoverflow.com/comment/39617048
upvote count: 5
has comment: http://stackoverflow.com/comment/39638771
type: Answer
accepted answer of: http://stackoverflow.com/q/25399798
answers question: http://stackoverflow.com/q/25399798
score: 5
has comment: http://stackoverflow.com/comment/39617086
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39616942
downvote count: 0
has body: Proper use any JSON parsing library such as GSON or Jackson and convert it into Java Object. Note: It returns java.util.LinkedHashMap that maintains the order. Sample code: GSON String jsonString="[{\"tag\":\"rat\",\"score\":0.7973},{\"tag\":\"lion\",\"score\":0.7184},{\"tag\":\"dog\",\"score\":0.2396},{\"tag\":\"woof\",\"score\":0.1944},{\"tag\":\"cat\",\"score\":0.1157}]"; Type type = new TypeToken&lt;ArrayList&lt;Map&lt;String, String&gt;&gt;&gt;() {}.getType(); ArrayList&lt;Map&lt;String, String&gt;&gt; data = new Gson().fromJson(jsonString, type); for (Map&lt;String, String&gt; map : data) { System.out.println(map.get("tag")); } Jackson String jsonString="[{\"tag\":\"rat\",\"score\":0.7973},{\"tag\":\"lion\",\"score\":0.7184},{\"tag\":\"dog\",\"score\":0.2396},{\"tag\":\"woof\",\"score\":0.1944},{\"tag\":\"cat\",\"score\":0.1157}]"; TypeReference&lt;ArrayList&lt;Map&lt;String, String&gt;&gt;&gt; typeRef = new TypeReference&lt;ArrayList&lt;Map&lt;String, String&gt;&gt;&gt;() {}; ObjectMapper mapper = new ObjectMapper(); try { ArrayList&lt;Map&lt;String, String&gt;&gt; data = mapper.readValue(jsonString, typeRef); for (Map&lt;String, String&gt; map : data) { System.out.println(map.get("tag")); } } catch (Exception e) { System.out.println("There might be some issue with the JSON string"); } output: rat lion dog woof cat
has comment: http://stackoverflow.com/comment/39616911

http://stackoverflow.com/comment/39611940
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25396695
type: Comment
has text: oh ok I get what you try to explain now thanks so much but the part I still don't get it is in the `while loop`, all it has to do is to go through each token of the file and if it's an int then add up to the sum but why would we need to setup the else statement there?

http://stackoverflow.com/a/33003673
accepted answer of: http://stackoverflow.com/q/25536500
type: Answer
answers question: http://stackoverflow.com/q/25536500
has body: Edit: I should add that these are nanoseconds not milliseconds. I feel these answers don't really answer the question using the Java 8 SE Date and Time API as intended. I believe the truncatedTo method is the solution here. LocalDateTime now = LocalDateTime.now(); System.out.println("Pre-Truncate: " + now); DateTimeFormatter dtf = DateTimeFormatter.ISO_DATE_TIME; System.out.println("Post-Truncate: " + now.truncatedTo(ChronoUnit.SECONDS).format(dtf)); Output: Pre-Truncate: 2015-10-07T16:40:58.349 Post-Truncate: 2015-10-07T16:40:58 Alternatively, if using Time Zones: LocalDateTime now = LocalDateTime.now(); ZonedDateTime zoned = now.atZone(ZoneId.of("America/Denver")); System.out.println("Pre-Truncate: " + zoned); DateTimeFormatter dtf = DateTimeFormatter.ISO_OFFSET_DATE_TIME; System.out.println("Post-Truncate: " + zoned.truncatedTo(ChronoUnit.SECONDS).format(dtf)); Output: Pre-Truncate: 2015-10-07T16:38:53.900-06:00[America/Denver] Post-Truncate: 2015-10-07T16:38:53-06:00
upvote count: 78
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/118997720
score: 78

http://stackoverflow.com/comment/39822459
type: Comment
type: AnswerComment
has text: Nope that's not the solution. `id's` don't need to be unqiue across the application.
score: 3
comment on: http://stackoverflow.com/a/25510008

http://stackoverflow.com/a/25476165
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25473626
type: Answer
answers question: http://stackoverflow.com/q/25473626
has body: Or maybe my approach from the very beginning is invalid and I should have only written a test for isValid() method Yes, this. So you write something like this as a starting point: public static boolean isValid(String passwordToValidate) { return false; } Then you can write your first test: @Test public void returnsTrueWhenPasswordIsAtLeastEightCharsLong() { assertTrue(isValid(EIGHT_CHARACTERS_LONG_PASSWORD)); } Which will fail: RED. So you make the simplest change to the code under test to get it to pass: public static boolean isValid(String passwordToValidate) { return true; } Then the test will pass: GREEN. But you haven't fully tested the 8-character limit yet: @Test public void returnsFalseWhenPasswordIsLessThanEightCharsLong() { assertFalse(isValid(SEVEN_CHARACTERS_LONG_PASSWORD)); } This will fail -- RED -- because the method under test always returns true now. So you make the smallest change to make all the tests pass: public static boolean isValid(String passwordToValidate) { return passwordToValidate.length() &gt;= 8; } And you're GREEN again. And you proceed like this, adding other tests and each time changing the code you're testing as little as possible to get the tests to pass. You might find it useful to refactor your isValid method at some stage by splitting it up into some private methods that you call. That's fine: it's part of the refactor step, and your tests should still pass since the public interface hasn't changed.
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/39617008
has text: Global variables use is not a good practice. Try to avoid it. Return values and local variables is always better.
comment on: http://stackoverflow.com/q/25399982
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25475188
type: Answer
has body: How can I call function after 5 seconds of last key pressed in java This statement implies that the user might be pressing multiple keys and you only want to do the function 5 seconds after the user has stopped pressing keys. So the solution would be to use a KeyListener on your component to listen for KeyEvents. Then whenever a key is press you restart a Swing Timer. Once the user stops pressing keys the Timer will generate and event and you can invoke your function. For an example of this approach check out Application Inactivity. It uses this concept to listen for activity for the entire application (key events and mouse events). Without more detail regarding your specify requirement we can only provide a general approach.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25474760

http://stackoverflow.com/comment/39865471
has text: as i see, you have option to setMap exposed from B, just create concurrent hashmap in A and then set it to B.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25533908
type: Comment

http://stackoverflow.com/q/25486488
has body: I tried to found a solution for this, even found numerous solutions but none resolved my issue. I am trying to implement a Java client which will consume a Restful web service . I want to set parameters inside header which I can retrieve on my web server. My code is; URL url = new URL("http://servierIP/address"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("GET"); conn.setRequestProperty("firstParam", "hi"); conn.addRequestProperty("secondParam","12345" ); conn.setRequestProperty("Content-Type", "application/xml"); conn.connect(); However, when I try to get values from header, I get NULL . I tried to do it with addRequestProperty and setRequestProperty both, but still the values are not getting set inside my header. and the output I am getting when I try to fetch header value is: null : [HTTP/1.1 200 OK] Expires : [Thu, 19 Nov 1981 08:52:00 GMT] Access-Control-Allow-Orgin : [*] Set-Cookie : [dsfjskfjdsfjskf ---- some value] Access-Control-Allow-Methods : [*] Connection : [Keep-Alive] Server : [Apache/2.2.15 (CentOS)] X-Powered-By : [PHP/5.3.3] Cache-Control : [no-store, no-cache, must-revalidate, post-check=0, pre-check=0, public, public] Pragma : [no-cache, public, public] Date : [Tue, 26 Aug 2014 05:33:10 GMT] Transfer-Encoding : [chunked] Content-Type : [application/xml; charset=utf-8] If anyone can resolve the issue, I would be very grateful.. Thank you.
has answer: http://stackoverflow.com/a/25499382
type: Question
has comment: http://stackoverflow.com/comment/39799649
score: 0
tagged with: header
type: UnansweredQuestion
answer count: 1
linked to: http://stackoverflow.com/q/12732422
has comment: http://stackoverflow.com/comment/39777592
tagged with: rest
has title: Unable to set property in header using HTTPUrlConnection in GET request
tagged with: java

http://stackoverflow.com/q/25411904
score: 0
has comment: http://stackoverflow.com/comment/39639785
has comment: http://stackoverflow.com/comment/39639738
type: UnansweredQuestion
answer count: 1
has body: i'm trying to import a CoGroo project, but i cannot do that. Then i try to import i press File>New>Java Project> un-check User Default Location (Eclipse Luna) > Search the folder "cogroo-4.0.0-src" and all the project are inside of that> then when i open my project a lot of "x" stay in the folders and in the projects! what should i do? someone help please!!! image of when i try to Run it! i have already tried to import and run this sometimes [enter image description here][1] then i try to "import" and i recieve that image! [2]: https://i.sstatic.net/W1HZc.png
has answer: http://stackoverflow.com/a/25411958
tagged with: java
has comment: http://stackoverflow.com/comment/39639722
has title: Many "cannot be resolved to a type" errors when opening CoGroo project
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39639712
type: Question

http://stackoverflow.com/q/25550480
answer count: 1
has title: Find out if android java class is used inside a plugin
type: Question
has body: I have a jar library for Android which can be used directly, or inside another wrapper such as PhoneGap or Xamarin. Is there a reliable way to check the environment from a class inside that library, and report if the library is being used inside a wrapper?
tagged with: android
score: 0
tagged with: cordova
has answer: http://stackoverflow.com/a/25550635
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/39760779
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25477134
has text: Sorry I am new here and have some issues with formatting my replies
type: QuestionComment

http://stackoverflow.com/comment/39899179
type: Comment
comment on: http://stackoverflow.com/a/25541857
type: AnswerComment
has text: @Holger so I mean is bytecode verifier not a part of Classloader?
score: 0

http://stackoverflow.com/a/25426858
has body: When an actor fails out and is restarted, if it was processing a message, no response will be automatically sent to that sender. If you want to send that sender a message on that particular failure then catch that exception explicitly and respond back to that sender with a failed result, making sure to capture the sender first before you go into any future callbacks to avoid closing over this mutable state. You could also try to do this in the preRestart, but that's not very safe as by that time the sender might have changed if you are using futures inside the actor.
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25424650
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25424650
type: Answer
has comment: http://stackoverflow.com/comment/39670606

http://stackoverflow.com/comment/39627750
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25399576
has text: I guess XSLT is "a sort of rule engine with XQuery for customization". If you want something less powerful than XSLT then one approach is to define a mini-transformation language that does the transformations you actually need, and then translate that into XSLT for execution. As for the performance, putting a powerful tool into the hands of people who don't understand it fully is always inviting tehm to produce something that works but performs badly.

http://stackoverflow.com/comment/39618566
has text: No, it'll be run in parallel. You can put a delay, so it'll be run after 2 seconds for example.
type: QuestionComment
comment on: http://stackoverflow.com/q/25400355
score: 0
type: Comment

http://stackoverflow.com/comment/39697024
comment on: http://stackoverflow.com/q/25437447
type: QuestionComment
score: 0
has text: "Implementations are free to ignore the hints completely…"—[`RenderingHints`](http://docs.oracle.com/javase/8/docs/api/java/awt/RenderingHints.html)
type: Comment

http://stackoverflow.com/q/25532395
type: Question
has title: Ant - Pathelement with wildcard only works in Javac forked mode
has body: I encountered below issue when using Ant. My ANT script snippets: <pathelement location="src/compile_lib1/*" /> <pathelement location="src/compile_lib2/*" /> <include name="**/*.java"/> When set fork=”true” in javac task, the wildcard pathelement works fine, but when forked is set to false, Ant seems failed to interpret wildcard correctly. (compilation failed, due to classpath error). Any suggestions Thanks.
tagged with: ant
score: 4
has answer: http://stackoverflow.com/a/25532566
upvote count: 4
accepted answer: http://stackoverflow.com/a/25532566
type: AnsweredQuestion
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/39762226
comment on: http://stackoverflow.com/a/25477884
score: 0
type: Comment
type: AnswerComment
has text: @Lucase You seem to have forgotten to sort here.

http://stackoverflow.com/comment/39855363
comment on: http://stackoverflow.com/q/25528192
has text: Not really, this is quite heavy-weight solution.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/25449122
type: UnansweredQuestion
tagged with: android
score: 0
tagged with: java
tagged with: email
has comment: http://stackoverflow.com/comment/39708127
has body: I am using the code mentioned here: Sending Email in Android using JavaMail API without using the default/built-in app This is my code. When the user reaches a specific point the mail should be automatically sent but it's not happening. Permissions are perfect. if (User.TOTAL_POINTS &gt;= 2) { try { Mail m = new Mail("rubypawa1@gmail.com", "my password"); String[] toArr = {"suvinay123@gmail.com", "rubypawa1@gmail.com.com"}; m.setTo(toArr); m.setFrom("rubypawa1@gmail.com"); m.setSubject("This is an email sent using my Mail JavaMail wrapper from an Android device."); m.setBody("Email body."); if(m.send()) { Toast.makeText(MyActivity.this, "Email was sent successfully.", Toast.LENGTH_LONG).show(); } else { Toast.makeText(MyActivity.this, "Email was not sent.", Toast.LENGTH_LONG).show(); } } catch(Exception e) { //Toast.makeText(MailApp.this, "There was a problem sending the email.", Toast.LENGTH_LONG).show(); Log.e("MailApp", "Could not send email", e); } }
linked to: http://stackoverflow.com/q/2020088
type: Question
has comment: http://stackoverflow.com/comment/39708258
answer count: 0
has comment: http://stackoverflow.com/comment/39708168
has title: Sending email using javamail with if else statement

http://stackoverflow.com/q/25475124
answer count: 0
tagged with: java
tagged with: jax-rs
type: Question
has body: How do I get all mapping in RestEasy 3.0.8 Final with Guice? Can I get list without manually reflection all classes in class loader?
tagged with: resteasy
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39790735
linked to: http://stackoverflow.com/q/24852488
has title: RestEasy 3.0.8-Final List Mapping Guice
has comment: http://stackoverflow.com/comment/39792073
score: 0
has comment: http://stackoverflow.com/comment/39767754

http://stackoverflow.com/q/25497854
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/25498024
tagged with: java
has comment: http://stackoverflow.com/comment/39799390
has answer: http://stackoverflow.com/a/25512945
has answer: http://stackoverflow.com/a/25497957
accepted answer: http://stackoverflow.com/a/25512567
possible better answer: http://stackoverflow.com/a/25498131
type: Question
has answer: http://stackoverflow.com/a/25512567
has answer: http://stackoverflow.com/a/25498131
answer count: 5
tagged with: data-structures
has body: I was trying to implement a linked list in Java. I came up with the following simple implementation public class Node{ public String data; public Node next; public Node(String data){ this.data = data } } public class LinkedLst{ public Node currentNode; public void add(String data){ Node newNode = new Node(data); newNode.next = currentNode; currentNode = newNode; } public Node remove(){ Node temp = currentNode; currentNode = currentNode.next; return temp; } public void printList(){ Node temp = currentNode; while(temp!=null){ System.out.println(temp.data + ","); temp = temp.next; } } } But one obvious problem I see here is that the order of insertion gets reversed due to my design flaw. But in a LinkedList, the order of insertion should be maintained. How would I change this code to do that. I just could not think from a different perspective now.
has title: Custom LinkedList in Java with a maintained order of insertion

http://stackoverflow.com/q/25445056
tagged with: maven
tagged with: gwt
has body: I recently modified changed my GWT app from having a single project into a modular project using the maven archetype modular-webapp (https://github.com/tbroyer/gwt-maven-archetypes). While everything works well when using the SuperDevMode, I can't get the old DevMode working with the new structure. I'd like to use the project with the old DevMode again, because I feel more familiar with the debugging in eclipse. I follow the steps provided at the howto for the modular-webapp archetype: mvn clean install -Dgwt.compiler.skip In one terminal window: cd *-client && mvn gwt:run -Ddev In another terminal window: mvn tomcat7:run -Ddev All steps seem to succeed, though there i a warning in step 2: [WARNING] Your POM <outputdirectory> does not match your hosted webapp WEB-INF/classes folder for GWT Hosted browser to see your classes. But when I open the browser from the GWT window, I just get a blank page. So maybe there's something wrong with gwt-maven-plugin configuration: <gwt.genParam>false</gwt.genParam> http://localhost:8080 org.codehaus.mojo gwt-maven-plugin testproject.Project true ${gwt.genParam} true ${runTarget} maven-war-plugin false WEB-INF/** org.apache.tomcat.maven tomcat6-maven-plugin true org.apache.tomcat.maven tomcat7-maven-plugin true
type: AnsweredQuestion
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/39710590
has comment: http://stackoverflow.com/comment/39709664
has title: Running a Modular GWT in DevMode
has answer: http://stackoverflow.com/a/25450146
accepted answer: http://stackoverflow.com/a/25450146
type: Question
has comment: http://stackoverflow.com/comment/39704865

http://stackoverflow.com/comment/39609665
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25395753
type: QuestionComment
has text: @MadProgrammer You are correct.

http://stackoverflow.com/comment/39621694
comment on: http://stackoverflow.com/a/25397785
score: 0
type: Comment
type: AnswerComment
has text: And how are you storing your last position? My approach that seems to be working fine is store it into arguments of fragment in onPause and restore it in onResume .. like getArguments().putInt(POS_KEY, mListView.getFirstVisiblePosition());

http://stackoverflow.com/comment/39859916
type: QuestionComment
has text: to be able to show the toast, you need the Activity rather than a Context
type: Comment
comment on: http://stackoverflow.com/q/25530677
score: 0

http://stackoverflow.com/a/25417505
accepted answer of: http://stackoverflow.com/q/25417438
has comment: http://stackoverflow.com/comment/54171105
has comment: http://stackoverflow.com/comment/39651641
upvote count: 36
score: 36
has comment: http://stackoverflow.com/comment/39650484
downvote count: 0
type: AcceptedAnswer
has body: Ternary expressions, like any expression, have a type that is determined by the compiler. If the two sides of the ternary expression have what looks like different types, then the compiler will try and find a common base type using the least ambiguous of the two options. In your case, the -1 is least ambiguous, and so the type of the ternary expression is int. Sadly, the compiler doesn't use type inference based on the receiving variable. The expression rsrqs.get(boxedPci.toString()) is then evaluated and forced into type int to match the ternary expression, but because it's null it throws the NPE. By boxing the -1, the value of the ternary expression is Integer, and so you're null-safe.
has comment: http://stackoverflow.com/comment/39658580
answers question: http://stackoverflow.com/q/25417438
type: Answer

lucene
tags question: http://stackoverflow.com/q/25526560
tags question: http://stackoverflow.com/q/25444665
tags question: http://stackoverflow.com/q/25522063
tags question: http://stackoverflow.com/q/25453947
tags question: http://stackoverflow.com/q/25524888
type: Tag
tag name: lucene
tags question: http://stackoverflow.com/q/25488260
tags question: http://stackoverflow.com/q/25542968
tags question: http://stackoverflow.com/q/25401298
tags question: http://stackoverflow.com/q/25436340
tags question: http://stackoverflow.com/q/25495244

http://stackoverflow.com/comment/39759472
score: 1
type: Comment
has text: ahhhhhhh so my loop for doing it correctly needs to be outside of this at the end of the program. OK. that solves that, but now how do i get the intValue as the selection when i run this method?
comment on: http://stackoverflow.com/a/25475767
type: AnswerComment

http://stackoverflow.com/q/25530463
tagged with: jtree
type: Question
has answer: http://stackoverflow.com/a/25536797
has body: Is there any custom plugin(like JTreeTable with editable java components) in java, like in the above image. I know this can be done by Extending JTreeTable or JXTreeTable Class or using TreeCellEditor etcetera... But, I need a quite exact structure like shown in the above image, Please guide me and Thanks in advance.
upvote count: 5
has comment: http://stackoverflow.com/comment/39861157
score: 5
downvote count: 0
tagged with: swing
type: UnansweredQuestion
tagged with: jtreetable
answer count: 1
has comment: http://stackoverflow.com/comment/39860237
linked to: http://stackoverflow.com/q/13258150
has comment: http://stackoverflow.com/comment/39861073
tagged with: java
tagged with: jxtreetable
has comment: http://stackoverflow.com/comment/39865199
favorite count: 0
has title: A Table like JTreeTable with editable components like ComboBox, TextArea, CheckBox as Rows

http://stackoverflow.com/comment/39861346
has text: So your response should be no. It will not cause unpredictable problems, if you remember to also change `Float` to `Double` for the entire project.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25531458

http://stackoverflow.com/comment/39709980
comment on: http://stackoverflow.com/q/25448341
has text: I see this name the first time. I will Google it and see if it helps.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39752232
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25472511
has text: @CL. the result is sorting by _id (_id is a incremental field). For example, the result is like this: 1 Test 2 Abc Where 1, 2 are the _id and Test, Abc the title.
type: Comment

http://stackoverflow.com/comment/39836959
type: QuestionComment
comment on: http://stackoverflow.com/q/25511218
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal, Complete, Verifiable Example). 2) Provide ASCII art or a simple drawing of how the GUI should appear at default size and (if resizable) with extra width/height.
score: 0
type: Comment

http://stackoverflow.com/comment/39798037
type: QuestionComment
comment on: http://stackoverflow.com/q/25497040
type: Comment
score: 0
has text: but, if you still want to use reflection, I suggest you to take a look at http://code.google.com/p/reflections/

http://stackoverflow.com/q/25502573
has comment: http://stackoverflow.com/comment/39812380
tagged with: gmail-api
tagged with: google-api-java-client
type: UnansweredQuestion
tagged with: google-api
has comment: http://stackoverflow.com/comment/39836639
tagged with: maven
has comment: http://stackoverflow.com/comment/40264809
has body: I created a project using maven and followed the steps. But when i run the code i get the following error. Exception in thread "main" java.lang.IllegalArgumentException at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkArgument(Preconditions.java:76) at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:37) at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.getDetails(GoogleClientSecrets.java:80) at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow$Builder.<init>(GoogleAuthorizationCodeFlow.java:195) at com.vertoanalytics.external.mailfetcher.GmailApiQuickstart.main(GmailApiQuickstart.java:41) When I google it there are some ides about not having latest packges can cause this problem. Here is my meven dependency list related to the project com.google.api-client google-api-client 1.18.0-rc com.google.oauth-client google-oauth-client 1.19.0 com.google.apis google-api-services-gmail v1-rev7-1.19.0 com.google.http-client google-http-client-jackson 1.18.0-rc do i miss anything ?
score: 2
has comment: http://stackoverflow.com/comment/39840582
answer count: 0
upvote count: 2
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/25900906
has comment: http://stackoverflow.com/comment/39812942
has comment: http://stackoverflow.com/comment/40280665
favorite count: 0
type: Question
has title: IllegalArgumentException on trying out 'Quickstart: Run a Gmail App in Java'

http://stackoverflow.com/a/25445268
has body: Your ID class should be ... @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) @XmlRootElement(name = "ID") public class ID { @XmlElementRefs({ @XmlElementRef(name = "ID3", type = JAXBElement.class), @XmlElementRef(name = "ID2", type = JAXBElement.class), @XmlElementRef(name = "ID1", type = JAXBElement.class) }) @XmlMixed protected List<Serializable> content; @XmlAttribute(name = "entry-method") protected String entryMethod; /** * Gets the value of the content property. * * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set method for the content property. * * * For example, to add a new item, do as follows: * * getContent().add(newItem); * * * * * Objects of the following type(s) are allowed in the list * {@link String } * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link JAXBElement }{@code <}{@link String }{@code >} * * */ public List<Serializable> getContent() { if (content == null) { content = new ArrayList<Serializable>(); } return this.content; } /** * Gets the value of the entryMethod property. * * @return * possible object is * {@link String } * */ public String getEntryMethod() { return entryMethod; } /** * Sets the value of the entryMethod property. * * @param value * allowed object is * {@link String } * */ public void setEntryMethod(String value) { this.entryMethod = value; } } I tried this bean with this main method... public static void main(String[] args) throws JAXBException { final JAXBContext context = JAXBContext.newInstance(ID.class); final Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); final ID id = new ID(); id.setEntryMethod("method"); ObjectFactory o = new ObjectFactory(); id.getContent().add("sample text"); id.getContent().add…
has comment: http://stackoverflow.com/comment/39703348
has comment: http://stackoverflow.com/comment/39701941
type: Answer
upvote count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/39701636
answers question: http://stackoverflow.com/q/25438381

http://stackoverflow.com/comment/39619992
type: QuestionComment
comment on: http://stackoverflow.com/q/25401499
score: 2
type: Comment
has text: Please obey the Java naming conventions. Class names are upper camel case (`MyClass`), variable names lower camel case (`myVariable`), methods are lower camel case (`myMethod`), constants are upper case (`MY_CONSTANT`) and packages are lower case (`mypackage`).

http://stackoverflow.com/q/25541684
answer count: 3
has answer: http://stackoverflow.com/a/25542023
has title: How to remove trailing zero in a String value and remove decimal point
favorite count: 0
duplicate of: http://stackoverflow.com/q/703396
has comment: http://stackoverflow.com/comment/39882274
linked to: http://stackoverflow.com/q/17770886
has comment: http://stackoverflow.com/comment/39882140
upvote count: 14
has answer: http://stackoverflow.com/a/25541899
has comment: http://stackoverflow.com/comment/39879839
tagged with: double
downvote count: 0
tagged with: string
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39882109
has comment: http://stackoverflow.com/comment/39879928
tagged with: int
has body: How do I remove trailing zeros in a String value and remove decimal point if the string contains only zeros after the decimal point? I'm using the below code: String string1 = Double.valueOf(a).toString() This removes trailing zeros in (10.10 and 10.2270), but I do not get my expected result for 1st and 2nd inputs. Input 10.0 10.00 10.10 10.2270 Expected output 10 10 10.1 10.227
type: Question
score: 14
linked to: http://stackoverflow.com/q/703396
tagged with: java
has comment: http://stackoverflow.com/comment/39881848
has answer: http://stackoverflow.com/a/25541766

http://stackoverflow.com/q/25415601
has title: Play Framework's PathBindable on abstract parent class
tagged with: java
tagged with: playframework-2.2
has body: I'm using Play 2.2.x with Java and trying to use inheritance with PathBindable. Say I have an abstract parent class "Vehicle", with child classes "Car" and "Truck" (seen below). I'd like implement PathBindable on just the parent Vehicle class. However I cannot seem to get that to work where I can pass a variable of type Car as a URL parameter. When trying to compile, I get the error: [error] GET /open-trunk/:car controllers.CarThings.openTrunk(car: Car) [error] /xxx/routes:xxx: No URL path binder found for type Car. Try to implement an implicit PathBindable for this type. Passing a generic Vehicle variable compiles fine. Does anyone know how I can achieve this without having to pass a Car as a Vehicle and casting in the controller methods? Vehicle.java import play.mvc.PathBindable; public abstract class Vehicle implements PathBindable&lt;Vehicle&gt; { .... // Overrides for bind, unbind &amp; javascriptUnbind } Car.java public class Car extends Vehicle { .... public void openUpTrunk() { .... } } Truck.java public class Truck extends Vehicle { .... } routes .... GET /open-trunk/:car controllers.CarThings.openTrunk(car: Car) .... CarThings.java public class CarThings extends Controller { public static openTrunk(Car car) { car.openUpTrunk(); .... } } Thanks!
favorite count: 0
type: Question
upvote count: 2
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/39755740
has comment: http://stackoverflow.com/comment/39755756
tagged with: playframework-2.0
score: 2
answer count: 0

http://stackoverflow.com/a/25572342
score: 1
accepted answer of: http://stackoverflow.com/q/25509588
type: Answer
has body: edit the config file /etc/default/crate and put this code CRATE_HEAP_SIZE=4g MAX_OPEN_FILES=65535 MAX_LOCKED_MEMORY=unlimited edit /etc/security/limits.conf and put this params crate - nofile 65535 crate - memlock unlimited finally activate this parameter in the configuration file config.yml bootstrap.mlockall: true
type: AcceptedAnswer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25509588

http://stackoverflow.com/a/25414437
answers question: http://stackoverflow.com/q/25413245
score: 1
upvote count: 1
type: Answer
has body: You need to set up basic authentication. You can do it through plain Java or using Apache HttpClient. How to handle HTTP authentication using HttpURLConnection? http://www.baeldung.com/httpclient-4-basic-authentication
accepted answer of: http://stackoverflow.com/q/25413245
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/39796194
comment on: http://stackoverflow.com/q/25496051
type: Comment
type: QuestionComment
score: 0
has text: Just call it from the extending constructor. Like super(), super(a), and super(a,b)

http://stackoverflow.com/a/25502288
type: Answer
has body: The pattern you've created is a start. You need to write something that's called a "Lexer", that is capable of understanding the grammar of the language you're inputing. I'd start with having a way to determine whether the next part of the string is a number, or an AND( ? , ?) or an OR ( ? , ?) [these parts are called 'Tokens'] - whereas ? can be any token, you must balance the ( and ) to have it correct), and fed into your algorithm recursivley
answers question: http://stackoverflow.com/q/25501539
score: 0

http://stackoverflow.com/comment/39710116
type: Comment
has text: @1337 yes, but the object reference stored in those variables are in heap
comment on: http://stackoverflow.com/a/25450031
score: 0
type: AnswerComment

http://stackoverflow.com/q/25494511
tagged with: ognl
downvote count: 0
answer count: 1
tagged with: jsp
upvote count: 1
accepted answer: http://stackoverflow.com/a/25510965
has comment: http://stackoverflow.com/comment/39793839
favorite count: 0
linked to: http://stackoverflow.com/q/17733505
type: Question
has title: How to fetch a property into text field?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25510965
tagged with: struts2
type: AnsweredQuestion
has body: How to fetch <s:property value="userPojo.registerno"/> into text field? Code is here: <%@taglib uri="/struts-tags" prefix="s"%> User Edit form <s:form action="newuser"> <s:textfield name="regnumber" label="Registration Number" id="regnumber" value="<s:property value='userPojo.regnumber'/>"/> </s:form>

http://stackoverflow.com/a/25462487
score: 1
has comment: http://stackoverflow.com/comment/50104720
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/25458456
has body: With the outbound http adapter, user headers (in his case the json type information) are conveyed over HTTP as X-&lt;header&gt;... &lt;int-http:outbound-gateway request-channel="requestChannel" url="http://localhost:18080/http/receiveGateway" http-method="POST" mapped-request-headers="foo" expected-response-type="java.lang.String"/&gt; POST /http/receiveGateway HTTP/1.1 Accept: text/plain, */* X-foo: bar On the server side, the X- is not removed so you have to map it with the x... &lt;int-http:inbound-gateway request-channel="receiveChannel" path="/receiveGateway" mapped-request-headers="x-foo" supported-methods="POST"/&gt; You will then need a &lt;header-enricher/&gt; in your &lt;chain/&gt; before the transformer to set the headers (minus the 'x-')... &lt;int:header-enricher&gt; &lt;int:header name="json__TypeId__" expression="headers['x-json__TypeId__']" /&gt; ... &lt;/int:header-enricher&gt; (Note lower case x). EDIT: Or, on the sending side, you can configure the mapper to NOT prefix the custom header(s)... &lt;bean id="mapper" class="org.springframework.integration.http.support.DefaultHttpHeaderMapper"&gt; &lt;property name="outboundHeaderNames" value="foo,bar" /&gt; &lt;property name="userDefinedHeaderPrefix" value="" /&gt; &lt;/bean&gt;
type: Answer
has comment: http://stackoverflow.com/comment/39743270
has comment: http://stackoverflow.com/comment/39743282
has comment: http://stackoverflow.com/comment/39743229
has comment: http://stackoverflow.com/comment/39751354

http://stackoverflow.com/comment/39883098
type: AnswerComment
has text: After thorough tests, I discovered that specifying resources folders in profiles (that's the idea I got from your answer) didn't work. I posted the solution in my own answer. Thank for the help though.
score: 0
comment on: http://stackoverflow.com/a/25502424
type: Comment

http://stackoverflow.com/comment/39657773
score: 0
type: Comment
has text: this is a java problem, there is nothing wrong in the databases :)
comment on: http://stackoverflow.com/q/25420910
type: QuestionComment

http://stackoverflow.com/comment/48477341
type: AnswerComment
has text: Did you notify the Smack developers about this? Was a Smack issue assigned?
type: Comment
comment on: http://stackoverflow.com/a/25501507
score: 0

http://stackoverflow.com/comment/39820975
score: 0
has text: I'm sorry, what is your question? I don't understand.. :/ I am looking for boundaries, I'd like to set them by myself...if you know what I mean.
type: QuestionComment
comment on: http://stackoverflow.com/q/25509338
type: Comment

http://stackoverflow.com/q/25454673
score: 1
tagged with: java
tagged with: overriding
has body: This is my base class Vehicle with private instance variables. public class Vehicle { private int numPassengers; private String colour; Vehicle(int passengers, String colour) { this.numPassengers = passengers; this.colour = colour; } public String toString() { return colour + " " + numPassengers + " passengers"; } } Note that there are no accessor methods in this class and that I cannot edit this class in any way. I have a derived class Car with one additional instance variable numberOfDoors public class Car extends Vehicle { private int numberOfDoors; public Car(String newColour, int newNumberOfPassengers, int newNumberOfDoors) { super(newNumberOfPassengers, newColour); this.numberOfDoors = newNumberOfDoors; } @Override public String toString() { return colour + " " + numPassengers + " passengers " + numberOfDoors + " doors"; } } I can edit this class as I desire and I am aware of the different constructor method signature. Obviously, the return statement in toString() is giving me issues because this class has no access to the private instance variable in Vehicle. I know that if the instance variables in Vehicle has package/protected access, this wouldn't be an issue, but either my instructor has made a mistake or we are supposed to come up with a workaround. Is there a way around this that I'm missing?
type: Question
answer count: 1
downvote count: 0
has title: How do I override `toString` in my derived class and use the private instance variables from the base class?
upvote count: 1
tagged with: polymorphism
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/25454688
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25454688

http://stackoverflow.com/comment/79060380
type: Comment
has text: How about delete trigger? Are you able to capture the user id?
type: AnswerComment
comment on: http://stackoverflow.com/a/46050112
score: 0

http://stackoverflow.com/q/25475337
has comment: http://stackoverflow.com/comment/39757219
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/39758282
has body: Is there a public constant for the maximum TCP port number (65535) defined in java or a common library such as Apache Commons, that I could refer to from my code (instead of using the integer hardcoded)?
upvote count: 14
has comment: http://stackoverflow.com/comment/45935450
tagged with: tcp
has comment: http://stackoverflow.com/comment/39759474
tagged with: java
answer count: 1
favorite count: 0
type: Question
has title: Maximum tcp port number constant in java
has comment: http://stackoverflow.com/comment/39765501
has comment: http://stackoverflow.com/comment/39757218
accepted answer: http://stackoverflow.com/a/28832183
downvote count: 0
has answer: http://stackoverflow.com/a/28832183
score: 14

http://stackoverflow.com/a/25497269
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25494338
has comment: http://stackoverflow.com/comment/39804729
has body: Used One-JAR to build all dependencies into one executable JAR.
type: Answer
accepted answer of: http://stackoverflow.com/q/25494338
score: 0

http://stackoverflow.com/q/25513600
tagged with: arraylist
score: 0
tagged with: java
type: Question
has body: server will run the array which disconnect user after client press connect button public void run() { String message, connect = "Connect", disconnect = "Disconnect", chat = "Chat" ; String[] data; try { while ((message = reader.readLine()) != null) { outputTextArea.append("Received: " + message + "\n"); data = message.split(":"); for (String token:data) { outputTextArea.append(token + "\n"); } if (data[2].equals(connect)) { tellEveryone((data[0] + ":" + data[1] + ":" + chat)); userAdd(data[0]); } else if (data[2].equals(disconnect)) { tellEveryone((data[0] + ":has disconnected." + ":" + chat)); userRemove(data[0]); } else if (data[2].equals(chat)) { tellEveryone(message); } else { outputTextArea.append("No Conditions were met. \n"); } } // end while } // end try catch (Exception ex) { outputTextArea.append("Lost a connection. \n"); ex.printStackTrace(); clientOutputStreams.remove(client); } // end catch } // end run() } // end class ClientHandler public void userAdd (String data) { String message, add = ": :Connect", done = "Server: :Done", name = data; outputTextArea.append("Before " + name + " added. \n"); onlineUsers.add(name); outputTextArea.append("After " + name + " added. \n"); String[] tempList = new String[(onlineUsers.size())]; onlineUsers.toArray(tempList); for (String token:tempList) { message = (token + add); tellEveryone(message); } tellEveryone(done); } public void userRemove (String data) { String message, add = ": :Connect", done = "Server: :Done", name = data; onlineUsers.remove(name); String[] tempList = new String[(onlineUsers.size())]; onlineUsers.toArray(tempList); for (String token:tempList) { message = (token + add); tellEveryone(message); } tellEveryone(done); } public void tellEveryone(String message) { // sends message to everyone connected to server Iterator it = clientOutputStreams.iterator(); while (it.hasNext()) { try { PrintWriter writer = (PrintWriter) it.next(); writer.println(message); writer.flush(); outputTextArea.setCaretPositio…
tagged with: client-server
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25513721
answer count: 1
has title: Server side auto disconnect user connection and array index outofbounds error

http://stackoverflow.com/comment/39786474
type: AnswerComment
comment on: http://stackoverflow.com/a/25490819
type: Comment
has text: @user3843164 The thread scheduler is just not something you can control. You can give it hints, but that's it.
score: 0

http://stackoverflow.com/comment/39846550
comment on: http://stackoverflow.com/q/25523036
type: Comment
type: QuestionComment
has text: In my eyes it is a strange code and I think the datatype of value is not compatible with the datatype that the component -to create a checkbox- need. I just recommend make it simple as nessacary and write 'true' or 'false' or try to convert it into primitiv boolean.
score: 0

http://stackoverflow.com/q/25437341
tagged with: google-app-engine
has title: GAE w/ Objectify - Can you query a HashMap?
tagged with: java
linked to: http://stackoverflow.com/q/45322198
possible better answer: http://stackoverflow.com/a/41983054
has answer: http://stackoverflow.com/a/25438926
type: AnsweredQuestion
answer count: 3
upvote count: 3
tagged with: google-cloud-datastore
accepted answer: http://stackoverflow.com/a/25439799
downvote count: 0
has answer: http://stackoverflow.com/a/25439799
has answer: http://stackoverflow.com/a/41983054
favorite count: 0
type: Question
has body: In GAE, when using Objectify, can you query a HashMap? If so how would would you write it? ofy().load().type(MyClass.class).filter("hashMapfieldName", "keyQueryinggFor").list(); Does not seem to work where the hashMapfieldName is a HashMap&lt;String, String&gt;. I am looking to find entities where hashMapfieldName contains a certain key.
score: 3
tagged with: objectify

http://stackoverflow.com/a/25545698
has comment: http://stackoverflow.com/comment/40482853
score: 7
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25545242
upvote count: 7
answers question: http://stackoverflow.com/q/25545242
type: Answer
has body: The first thing to know is that (as stated in the JLS) the following enhanced for loop: for (String s : list) { // Do something with s } Is equivalent to: for (Iterator&lt;String&gt; it = list.iterator(); it.hasNext();) { String s = it.next(); // Do something with s } If you have a look at the implementation of the iterator in AbstractList, you will see that: hasNext() doesn't check for concurrent modification, and just check if we are at the end of the list, using its size: public boolean hasNext() { return cursor != size(); } the first thing done by next() is to call checkForComodification() to see if the list was modified while we are iterating: public E next() { checkForComodification(); try { E next = get(cursor); lastRet = cursor++; return next; } catch (IndexOutOfBoundsException e) { checkForComodification(); throw new NoSuchElementException(); } } final void checkForComodification() { if (modCount != expectedModCount) throw new ConcurrentModificationException(); } So, when you are iterating and removing the penultimate element of your list, the next instruction will be a call to hasNext(), which will return false, because removing one element caused the size of the list to be one less, and your iteration will stop without calling next() and throwing an Exception. By the way, all of this is just an implementation detail, you should not rely on it as it can change, and use it.remove() to remove an element from the list while you are iterating.

http://stackoverflow.com/comment/39703348
type: Comment
has text: @milltj let me know if works fine else you put more informations in order to help you :)
comment on: http://stackoverflow.com/a/25445268
score: 0
type: AnswerComment

fragment
tag name: fragment
tags question: http://stackoverflow.com/q/25545895
tags question: http://stackoverflow.com/q/25432005
tags question: http://stackoverflow.com/q/25526107
tags question: http://stackoverflow.com/q/25506033
type: Tag

http://stackoverflow.com/comment/39719537
type: AnswerComment
comment on: http://stackoverflow.com/a/25454299
has text: wow, that did the trick small errors never cease to amaze me, thanks a lot!
score: 0
type: Comment

freemarker
tags question: http://stackoverflow.com/q/25520207
tag name: freemarker
type: Tag
tags question: http://stackoverflow.com/q/25444360
tags question: http://stackoverflow.com/q/25448855
tags question: http://stackoverflow.com/q/25527080

http://stackoverflow.com/a/25539414
accepted answer of: http://stackoverflow.com/q/25539405
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You could use a negative lookbehind, Regex: (?<!^)([A-Z][a-z]) Replacement string: -$1 DEMO Explanation: (?<!^) Negative lookbehind is used here , which asserts what proceeds the characters [A-Z](uppercase) and also the following [a-z](lowercase) is not a starting anchor. An uppercase letter and the following lowercase letter will be matched only if it satisfies the above mentioned condition.() capturing groups are used to capture the matched characters, captured chars are stored into groups. Later you could get the captured chars by referring it's group index number. Code: System.out.println("WorkInProgress".replaceAll("(?<!^)([A-Z][a-z])", "-$1")); System.out.println("NotComplete".replaceAll("(?<!^)([A-Z][a-z])", "-$1")); System.out.println("CIInProgress".replaceAll("(?<!^)([A-Z][a-z])", "-$1")); Output: Work-In-Progress Not-Complete CI-In-Progress
has comment: http://stackoverflow.com/comment/39876092
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/25539405

http://stackoverflow.com/q/25410591
favorite count: 0
type: Question
tagged with: jlabel
has comment: http://stackoverflow.com/comment/39637329
has comment: http://stackoverflow.com/comment/39637799
has comment: http://stackoverflow.com/comment/39637204
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25411106
has answer: http://stackoverflow.com/a/25411080
has comment: http://stackoverflow.com/comment/39637893
tagged with: swing
score: -1
has comment: http://stackoverflow.com/comment/39637072
has comment: http://stackoverflow.com/comment/39637663
has title: JLabel array setIcon() cause Null Pointer Exception
has comment: http://stackoverflow.com/comment/39637713
has comment: http://stackoverflow.com/comment/39637672
tagged with: nullpointerexception
answer count: 3
has comment: http://stackoverflow.com/comment/39637384
tagged with: java
has answer: http://stackoverflow.com/a/25411089
has body: I am writing a card game where I need to replace the existing cards with the cards selected by user. First, I have 14 cards displayed in a panel which is a JLabel array declared and initialized in my GUI class as: public JLabel[] cardsLabel; //as class variable cardsLabel = new JLabel[14]; //inside constructor and the cards are displayed in a panel with the code below which is perfectly working fine. for (int index=0; index&lt;cardsLabel.length; index++) { cardsLabel[index] = new JLabel(); cardsLabel[index].setIcon(backOfCard); cardsContainer1.add(cardsLabel[index]); game.add(cardsContainer1, BorderLayout.EAST); //add cards to east of game container } I have another game class from which I am passing user selection index to a method in my GUI class public void cardFlip(int c1, int c2) { ImageIcon cardOne = new ImageIcon(resizeImage(new ImageIcon(table.getCard(c1).getImg()),100,120)); ImageIcon cardTwo = new ImageIcon(resizeImage(new ImageIcon(table.getCard(c2).getImg()),100,120)); cardsLabel[c1].setIcon(cardOne); //this is where I'm getting Null Pointer Exception error cardsLabel[c2].setIcon(cardTwo); } I am getting Null Point Error with the JLabel array. Here's the first few lines of error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at game.GameTableFrame.cardFlip(GameTableFrame.java:162) at game.FishingGame.gamePlay(FishingGame.java:80) at game.GameTableFrame.&lt;init&gt;(GameTableFrame.java:152) at game.GameModule$1.actionPerformed(GameModule.java:95) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) So I have been reading others posts and it could be due to the array not properly initialized but I have done that so I can't figure out what is causing this error. Would appreciate…
downvote count: 1

http://stackoverflow.com/comment/71788184
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25437913
has text: I just ran into this problem after porting a class. Going off of Peter's info: removing the `.gradle` directory within the project took care of it (maybe a little heavy-handed, but effective).
type: Comment

http://stackoverflow.com/q/25440479
possible better answer: http://stackoverflow.com/a/25442570
score: 2
tagged with: jtable
type: AnsweredQuestion
has body: I add full code Here. Check the following code which I am using to create the table. While executing the program, Values are displaying clearly, but the header is not displaying. public class Table extends JFrame implements ActionListener { JFrame f; JPanel p1; JPanel jPanel1; JTable jTable1; Table() { f=new JFrame("Home123"); f.setSize(getMaximumSize()); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(null); p1=new JPanel(); p1.setBackground(Color.red); p1.setVisible(true); p1.setLayout(null); f.add(p1); String[] headers = {"First Name","Last Name","Age"}; Object[][] data = { {"Kathy", "Smith",new Integer(25)}, }; jTable1 =new JTable(data, headers); JScrollPane scrollPane = new JScrollPane(jTable1); p1.add(jTable1); p1.setBounds(200, 100, 500, 500); jTable1.setBounds(70,250, 375,80); } public static void main(String[] args) { new Table(); } }
downvote count: 0
has answer: http://stackoverflow.com/a/25441859
tagged with: java
accepted answer: http://stackoverflow.com/a/25441859
answer count: 4
favorite count: 0
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/2320812
has answer: http://stackoverflow.com/a/25441710
has comment: http://stackoverflow.com/comment/39691933
has comment: http://stackoverflow.com/comment/39691975
has comment: http://stackoverflow.com/comment/39694431
tagged with: jtableheader
has title: Table Header is not displaying on Java Swing
tagged with: swing
has comment: http://stackoverflow.com/comment/39692896
has answer: http://stackoverflow.com/a/25441713
has comment: http://stackoverflow.com/comment/39693153
has answer: http://stackoverflow.com/a/25442570

http://stackoverflow.com/comment/39669734
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25427716
has text: This question is very similar to http://stackoverflow.com/questions/24918252/what-jvm-synchronization-practices-can-i-ignore-assuming-i-know-i-will-run-on-x6/25076347#25076347
type: Comment

http://stackoverflow.com/q/25498022
duplicate of: http://stackoverflow.com/q/5667371
has comment: http://stackoverflow.com/comment/39799789
has answer: http://stackoverflow.com/a/25498127
linked to: http://stackoverflow.com/q/15689945
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39799682
has comment: http://stackoverflow.com/comment/39800083
has comment: http://stackoverflow.com/comment/39799669
has comment: http://stackoverflow.com/comment/39799691
has answer: http://stackoverflow.com/a/25498103
score: 0
has body: I have a string input by the user that should represent an IP address like: 123.234.12.8 but being a silly person as they can be sometimes what if they enter: 12#.234.1@.8 I've figured out how check for characters and symbols by looping through the string and making temporary chars/ints using: tempChar = ipString.charAt(i); tempInt = Character.getNumericValue(tempChar); I can flag a 'a' or a 'q' but I can't differentiate between the '.' symbol and others such as '#' or '&amp;' because they're all given the int value -1. Is there an existing method for preventing users entering any symbol except a '.' or can someone point me in the right direction if I'm going about this wrong? EDIT: This is in Java.
has title: checking String for symbols
answer count: 3
has comment: http://stackoverflow.com/comment/39799856
tagged with: java
has comment: http://stackoverflow.com/comment/39799739
linked to: http://stackoverflow.com/q/5667371
linked to: http://stackoverflow.com/q/21074485
tagged with: error-handling
linked to: http://stackoverflow.com/q/4581877
tagged with: character
type: Question
has answer: http://stackoverflow.com/a/25498590

http://stackoverflow.com/q/25459915
has title: How can I make a view active among multiple views in RCP eclipse
type: Question
has comment: http://stackoverflow.com/comment/39729351
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/39730627
has comment: http://stackoverflow.com/comment/39730643
has body: I am building a RCP application in which I am using two views say viewA and viewB and one editor. I added listener to viewB which listens any selection from viewA and displays it, and I added one listener to editor which listens double click events from viewA and display the clicked details for editing. Here the problem is when I double click the viewA, details appear in editor for editing but after this viewB does not listen selection events until I click on viewB and make it active. Please suggest me some solution.
tagged with: rcp
tagged with: eclipse
score: 0
answer count: 0
tagged with: java

http://stackoverflow.com/comment/39920255
type: Comment
has text: @ManishMulimani, thank you very much. I have just changed getFragmentManager to getChildFragmentManager. This solved my problem. Can you post this as answer?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25499207

http://stackoverflow.com/comment/39812036
type: Comment
has text: @Abx yes, i make for phone and tablet different activity . but in my main activity how can i define and call activity.. if you have code or link then pls share with me.
type: QuestionComment
comment on: http://stackoverflow.com/q/25504114
score: 0

http://stackoverflow.com/a/25408699
type: Answer
has body: Firstly,if you are using the values of cases as hardcoded strings,it will really be difficult to select some case randomly. You could store your phrases related to a specific mood in different ArrayList objects, For example, ArrayList&lt;String&gt; positiveAnswers = new ArrayList&lt;String&gt;(); positiveAnswers.add("good"); positiveAnswers.add("great"); positiveAnswers.add("awesome"); //add everything you want as a postive answer in this list and then retrieve them using the code I have given Use the below method to get random numbers within range max and min import java.util.Random; public static int randInt(int min, int max) { // NOTE: Usually this should be a field rather than a method // variable so that it is not re-seeded every call. Random rand = new Random(); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive int randomNum = rand.nextInt((max - min) + 1) + min; return randomNum; } Use the returned randomNum for selecting a phrase from that specific ArrayList object. i.e. positiveAnswers.get(randomNum);
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25408330
score: 3
has comment: http://stackoverflow.com/comment/39633684

http://stackoverflow.com/comment/39748030
type: QuestionComment
comment on: http://stackoverflow.com/q/25470211
type: Comment
score: 0
has text: @glass you also remove the constructor for both activity and fragment and read the docs

http://stackoverflow.com/comment/39833375
type: QuestionComment
comment on: http://stackoverflow.com/q/25472563
has text: Can you provide your `build.sbt` file? Also have you run `play update`/`activator update`?
score: 0
type: Comment

http://stackoverflow.com/a/25404631
score: 2
has comment: http://stackoverflow.com/comment/39625472
upvote count: 2
has comment: http://stackoverflow.com/comment/39625565
type: AcceptedAnswer
downvote count: 0
has body: You can go into arcives in the top-left corner and click on projects to see if it's the correct project folder. Another thing you can do is to check if the project-files are still in the folder where you have your workspace. If they are there it can help to create a "new" project with the same name and all the files will automaticlly be in the project again. :)
type: Answer
answers question: http://stackoverflow.com/q/25404420
accepted answer of: http://stackoverflow.com/q/25404420

http://stackoverflow.com/a/27538461
type: AcceptedAnswer
score: 5
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25503005
has body: Just ran into similar issues, and for me it was all fixed by replacing mapper.readValue(jp, requestClass) with mapper.treeToValue(root, requestClass)
has comment: http://stackoverflow.com/comment/43561902
answers question: http://stackoverflow.com/q/25503005
downvote count: 0

http://stackoverflow.com/comment/39825224
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25511604
has text: There are also cases where I am serializing an array with two different people in the array, and I need to remove different things from each.
score: 0

http://stackoverflow.com/comment/39848756
comment on: http://stackoverflow.com/q/25524747
has text: You'd actually better use `MessageFormat`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25395114
tagged with: expectj
answer count: 0
tagged with: java
downvote count: 0
score: 1
upvote count: 1
favorite count: 0
type: Question
type: UnansweredQuestion
has body: I've been using expectJ to automate some administrative tasks over ssh (jsch) for some time. It has been working well. Now I am facing an interface that accepts commands triggered by control characters. Such as CTRL+B for example. For non-interactive automation tasks, it works well if I just send the unicode character, like if (request.contains("&lt;CTRL-B&gt;")){ request = request.replaceAll("&lt;CTRL-B&gt;", "\u0002"); } The problem is expectJ "interactive mode", which wires stdin and stdout into two thread loops (inside a undocumented class called expectj.StreamPiper, which does exactly that, pipes from one stream into another). Running from command line, I just don't know how to send a CTRL-B from Java command line (stdin). So my question is: how do I send control chars from System.in to expectJ in interactive mode? Ps. one workaroud, it seems, is to "remap" these control characters somehow. For example, one command is triggered by a CTRL-Z, but issuing CTRL-Z in a unix environment will immediately send the current process to background. In this case, how could I do that? update -- I've been using this. I hope there's a better way (I am not talking about refactoring this code, of course). Snippet from expectj.StreamPiper /** * Thread method that reads from the stream and writes to the other. */ public void run() { byte[] buffer = new byte[1024]; int bytes_read; try { while(getContinueProcessing()) { bytes_read = inputStream.read(buffer); if (bytes_read == -1) { LOG.debug("Stream ended, closing"); inputStream.close(); outputStream.close(); return; } String stringRead = new String(buffer, 0, bytes_read); if (stringRead.startsWith("CTRL+B")) { outputStream.write("\u0002".getBytes()); sCurrentOut.append("\u0002"); if (copyStream != null &amp;&amp; !getPipingPaused()) { copyStream.write("\u0002".getBytes()); copyStream.flush(); } }else if (stringRead.startsWith("CTRL+Z")) { outputStream.write("\u001A".getBytes()); sCurrentOut.append("\u001A"); if (copyStream != null …
has title: How to send control chars using ExpectJ in interactive mode?
tagged with: system.in

http://stackoverflow.com/a/25547562
answers question: http://stackoverflow.com/q/25546522
type: Answer
has body: try giving the .execute() of the second async task in the onpostexecute() of the first async task.
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/39685673
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25436538
has text: @JBNizet The particular application I am working on very likely needs MD5 because it is very sensitive to the bucketing/randomization algorithm. The question is more about the best way of getting from MD5 to (Integer) buckets.
type: QuestionComment

http://stackoverflow.com/comment/39844815
comment on: http://stackoverflow.com/q/25522309
type: Comment
has text: i am receiving an object as json and directly converting it in to my hibernate pojo. the hibernate pojo works in byte array format. the GSON library converts string to object and seems to be failing to convert the byte[]
type: QuestionComment
score: 0

http://stackoverflow.com/a/25521658
has body: This should solve your problem: String wholetext = "Place Then Pin- **110065 Name and address** Alias 1 ID of customer-123 Some Place "; String textafter = "110065 Name and address"; String textbefore = "ID of customer"; int index1 = wholetext.indexOf(textbefore); int index2 = wholetext.indexOf(textafter) + textafter.length(); String namerequired = wholetext.substring(index2, index1); System.out.println(namerequired); Output: Alias 1 But using a regex or String matcher would probably be better.
score: 1
type: AcceptedAnswer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25521190
has comment: http://stackoverflow.com/comment/39843482
answers question: http://stackoverflow.com/q/25521190
type: Answer
has comment: http://stackoverflow.com/comment/39843339

http://stackoverflow.com/comment/39681763
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25434353
has text: no luck :( any other recommendations ? need anymore of the code ?

transparency
tags question: http://stackoverflow.com/q/25498148
tags question: http://stackoverflow.com/q/25493686
tag name: transparency
type: Tag

http://stackoverflow.com/comment/39871546
score: 0
type: Comment
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60121/discussion-between-naresh-vavilala-and-codemed).
comment on: http://stackoverflow.com/q/25454703

http://stackoverflow.com/q/25411087
has answer: http://stackoverflow.com/a/62924405
favorite count: 0
type: Question
score: 20
upvote count: 20
has comment: http://stackoverflow.com/comment/39638014
has answer: http://stackoverflow.com/a/25431625
accepted answer: http://stackoverflow.com/a/25431625
has comment: http://stackoverflow.com/comment/39638248
tagged with: multithreading
has body: As we know, java's ConcurrentHashMap has a number of internal locks, and each of them guards some region of the bucket's array. A question is: why cannot we create a lock for each bucket? A similair question was already asked: Disadvantage of increasing number of partition in Java ConcurrentHashMap? According to the answer, there are several reasons: the maximum number of threads running simultaneously is limited by the number of cores of the processor. Is this correct? Can we ALWAYS state that if we have 8-core processor we do not need more than 8 locked regions in ConcurrentHashMap? There is a waste of L2 cache. Why? There is a waste of memory. Looks like this is because of additional lock creation. Is there any more reasons?
possible better answer: http://stackoverflow.com/a/25414823
tagged with: concurrenthashmap
linked to: http://stackoverflow.com/q/17233924
has comment: http://stackoverflow.com/comment/39638879
has comment: http://stackoverflow.com/comment/39638675
type: AnsweredQuestion
answer count: 3
downvote count: 0
tagged with: java
has title: Why ConcurrentHashMap cannot have a lock for each bucket?
tagged with: concurrency
has answer: http://stackoverflow.com/a/25414823

http://stackoverflow.com/q/25536165
has body: Via a Domino Java agent, I use Apache POI to generate an Excel spreadsheet. The code first saves the file to a drive; I've verified I can open the file there and the file contains information. However, when I attach it to an email message through MIME, I get a message stating "Excel cannot open the file spreadsheet.xlxs" and "file format or file extension is not valid". Here's the code I'm using: MIMEEntity ebody = maildoc.createMIMEEntity(); Stream outStream = session.createStream(); Stream inStream = session.createStream(); inStream.open(entry.getValue(),"binary"); do { byte[] buffer = inStream.read(32767); outStream.write(buffer); } while(!inStream.isEOS()); inStream.close(); MIMEEntity child = ebody.createChildEntity(); child.setContentFromBytes(outStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", MIMEEntity.ENC_IDENTITY_BINARY); MIMEHeader cdHeader = child.createHeader("Content-Disposition"); cdHeader.setHeaderVal("attachment; filename="spreadsheet.xlxs"); MIMEHeader idHeader = child.createHeader("Content-ID"); idHeader.setHeaderVal("spreadsheet.xlxs"); outStream.truncate(); outStream.close(); Any ideas where I went wrong?
tagged with: excel
score: 0
tagged with: attachment
tagged with: java
answer count: 1
tagged with: mime
tagged with: lotus-domino
has title: Cannot Open Streamed File Attachment
type: Question
has answer: http://stackoverflow.com/a/25536220
type: UnansweredQuestion

http://stackoverflow.com/q/25527342
tagged with: serialization
tagged with: static
tagged with: scjp
answer count: 1
accepted answer: http://stackoverflow.com/a/25527633
has answer: http://stackoverflow.com/a/25527633
has title: Serialization With HashCode Method
type: AnsweredQuestion
score: 0
tagged with: java
has body: I have code for Testing Serialization with One Static Member. Here Is the Car Class public class Car implements Serializable { private String number; private String color; private String model; static int y = 23; public boolean equals(Object object) { System.out.println("Equals Called..."); if(object instanceof Car) { Car car = (Car) object; if(car.getNumber() == this.number) { return true; } } return false; } public String toString() { System.out.println("ToString Called..."); return "Number : "+this.number+" Color : "+this.color+" Model : "+this.model+" Y : "+this.y; } public int hashCode() { return this.y * 23; } Getters And Setters } And Here is My Main Class public static void main(String args[]) { Car car1 = new Car(); car1.setColor("red"); car1.setModel("23023"); car1.setNumber("1212"); System.out.println(car1.toString()); Car car2 = new Car(); car2.setColor("red"); car2.setModel("23023"); car2.setNumber("1212"); System.out.println(car2.toString()); Map&lt;Car, String&gt; map = new HashMap&lt;Car, String&gt;(); map.put(car1, "Kshitij_1"); System.out.println("Map : "+map.toString()); System.out.println(map.get(car2)); System.out.println(car2.getY()); System.out.println("---------------------------------------------Before"); try { FileOutputStream fout = new FileOutputStream("D://map.ser"); ObjectOutputStream objectOutputStream = new ObjectOutputStream(fout); objectOutputStream.writeObject(map); objectOutputStream.close(); FileInputStream fin = new FileInputStream("D://map.ser"); ObjectInputStream inputStream = new ObjectInputStream(fin); map = (Map&lt;Car, String&gt;) inputStream.readObject(); inputStream.close(); } catch(Exception e) { e.printStackTrace(); } System.out.println("Map : "+map.toString()); System.out.println(map.get(car2)); System.out.println(car2.getY()); System.out.println("---------------------------------------------After"); } My Expectation is That result should be Same Before And After. But I am Getting Null Output ToString Called... Map : …
type: Question

http://stackoverflow.com/q/25546869
downvote count: 0
upvote count: 1
score: 1
has title: How I can write a file using relative path in Java
favorite count: 0
tagged with: netbeans
has answer: http://stackoverflow.com/a/25547095
answer count: 2
tagged with: relative-path
type: Question
possible better answer: http://stackoverflow.com/a/25546931
accepted answer: http://stackoverflow.com/a/25547095
has answer: http://stackoverflow.com/a/25546931
tagged with: d2rq
tagged with: file-io
type: AnsweredQuestion
tagged with: java
has body: I have a question: I have this Java Code: public void generate_mapping() throws FileNotFoundException { String fileMapping = "./src/mappingFile.ttl"; SystemLoader loader = new SystemLoader(); File f = new File(mappingFile); try { f.createNewFile(); } catch (IOException ex) { Logger.getLogger(Prova.class.getName()).log(Level.SEVERE, null, ex); } PrintStream out; out = new PrintStream(new FileOutputStream(f)); MappingGenerator generator = loader.openMappingGenerator(); try { generator.setInstanceNamespaceURI("http://Group"); generator.setVocabNamespaceURI("http://relation"); generator.writeMapping(out); } finally { loader.closeMappingGenerator(); } } this code generates a mapping and uses D2RQ library. When I execute this code, I get this error given from the relative path: java.io.IOException: Impossibile trovare il percorso specificato at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1006) at MyPackage.Prova.generate_mapping(Prova.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081) at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153) at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4695) at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:630) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822) at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582) at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth…

http://stackoverflow.com/comment/39671103
comment on: http://stackoverflow.com/q/25424420
score: 0
type: QuestionComment
has text: Never tried that, but I think I would try to avoid cascading transactions even on different datasources. Something like `[outside transactions] Service.copy() { data = service1.read(); service2.write(data); }` `@Transactional("t1") public class Service1` `@Transactional("t2") public class Service2`
type: Comment

http://stackoverflow.com/comment/39826252
has text: That is outside of a signed 32 bit int? I thought that was was scalas int type was?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25510704
score: 0

instantiation
type: Tag
tags question: http://stackoverflow.com/q/25420848
tag name: instantiation

http://stackoverflow.com/comment/39727583
type: AnswerComment
has text: Its Working.. Thanks , there is problem with two enteries 1.cursor.getString(cursor.getColumnIndex("city_rowoffset"))to cursor.getString(cursor.getColumnIndex("city_rawoffset")),
type: Comment
comment on: http://stackoverflow.com/a/25458875
score: 0

http://stackoverflow.com/q/25396173
has answer: http://stackoverflow.com/a/25396427
has title: How to show the LayoutInflater in alert message?
tagged with: java
linked to: http://stackoverflow.com/q/17338362
tagged with: eclipse
has body: This is my code for layoutInflater in alert message. When running on device, only OK and CANCEL buttons appear. The popup.xml (for layout) does not exist. This is my code public void onClick(View view) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(reconfirm.this); LayoutInflater layoutInflater = (LayoutInflater) getBaseContext() .getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.popup, null, false); alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intObj = new Intent(getApplicationContext(), agree.class); startActivity(intObj); } }); alertDialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intObj = new Intent(getApplicationContext(), IntentExampleActivity.class); startActivity(intObj); } }); AlertDialog alertDialog = alertDialogBuilder.create(); // show it alertDialog.show(); } this is my popup.xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.12" android:text="By using any of the websites" /> <TextView android:id="@+id/more" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.12" android:linksClickable="true" android:text="More" /> <CheckBox android:id="@+id/checkBox1" android:layout_width="match_parent" android:layout_height="92dp" android:layout_weight="0.21" android:text="I have read and agree to the Terms and Conditions." />
has answer: http://stackoverflow.com/a/25396212
type: Question
type: UnansweredQuestion
tagged with: android
score: 0
answer count: 2

http://stackoverflow.com/comment/39879136
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25523795
has text: Sorry, I was modifying and old project by someone else and found that import and it was showing error. I was in trouble to fix and run. BTW Thanks.
type: Comment

http://stackoverflow.com/comment/80164750
score: 0
type: Comment
type: AnswerComment
has text: What do you mean by "batch mode"? I cannot comment on this being faster or not. You need to benchmark this on your database.
comment on: http://stackoverflow.com/a/25440979

http://stackoverflow.com/comment/39742122
score: 4
has text: Welcome to the wonderful world of obfuscation. There is a market for automated bytecode obfuscation tools should you feel the need. Using one of those would probably be more effective and maintenance-friendly than manual obfuscation. However, be aware that **nothing** will stop determined reverse engineering when the program is accessible to the attacker (and sometimes even when not). Your security should be strong even when every detail of the algorithm and implementation are exposed.
comment on: http://stackoverflow.com/q/25467037
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/103224963
comment on: http://stackoverflow.com/q/25397377
type: QuestionComment
has text: use cell.getRawValue() for numeric type to get string : https://stackoverflow.com/questions/13563747/p/58442764
score: 0
type: Comment

http://stackoverflow.com/a/25406213
score: 22
answers question: http://stackoverflow.com/q/25406157
type: Answer
upvote count: 22
has body: If we consider the traditional Java approach the answer can be deducted from the quote bellow as being much slower: Because reflection involves types that are dynamically resolved, certain Java virtual machine optimizations can not be performed. Consequently, reflective operations have slower performance than their non-reflective counterparts, and should be avoided in sections of code which are called frequently in performance-sensitive applications. Quoted from the JavaDoc about reflection - http://java.sun.com/docs/books/tutorial/reflect/index.html So since Spring uses Reflection with the getBean() method the SpringContext.getBean(SomeClass.class); approach should be slower. EDIT: Also note that the ThreadLocal also has caching embedded so as long as you reuse information in those threads it's for sure faster.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25406157

http://stackoverflow.com/a/25493604
answers question: http://stackoverflow.com/q/25493569
downvote count: 0
score: 1
upvote count: 1
has body: One can install JDK..which has JRE also.
type: Answer

http://stackoverflow.com/a/25411500
accepted answer of: http://stackoverflow.com/q/25411319
has comment: http://stackoverflow.com/comment/39639206
has comment: http://stackoverflow.com/comment/39639657
has comment: http://stackoverflow.com/comment/39639916
answers question: http://stackoverflow.com/q/25411319
score: 3
has comment: http://stackoverflow.com/comment/39639275
has comment: http://stackoverflow.com/comment/39639585
type: Answer
has comment: http://stackoverflow.com/comment/39639406
upvote count: 3
has body: Not sure if I understood correctly what you wanted but an answer to my interpretation: You could find the last space before your character limit with lastIndexOf and then check if you are close enough to your limit (for text without whitespace) i.e.: int arrayLength = 0; arrayLength = (int) Math.ceil(((mText.length() / (double) charLimit))); String[] result = new String[arrayLength]; int j = 0; int tolerance = 10; int splitpoint; int lastIndex = result.length - 1; for (int i = 0; i &lt; lastIndex; i++) { splitpoint = mText.lastIndexOf(' ' ,j+charLimit); splitpoint = splitpoint &gt; j+charLimit-tolerance ? splitpoint:j+charLimit; result[i] = mText.substring(j, splitpoint).trim(); j = splitpoint; } result[lastIndex] = mText.substring(j).trim(); this will search for the last space before charLimit (example value) and either split the string there if it is less then tolerance away or split at charLimit if it isn't. Only problem with this solution is that the last Stringtoken can be longer than charLimit so you might need to adjust arrayLength and loop while (mText - j &gt; charLimit) Edit running sample code: public static void main(String[] args) { String mText = "I am able to break up paragraphs of text into substrings based upon nth given character limit. The conflict I have is that my algorithm is doing exactly this, and is breaking up words. This is where I am stuck. If the character limit occurs in the middle of a word, how can I back track to a space so that all my substrings have entire words?"; int charLimit = 40; int arrayLength = 0; arrayLength = (int) Math.ceil(((mText.length() / (double) charLimit))); String[] result = new String[arrayLength]; int j = 0; int tolerance = 10; int splitpoint; int lastIndex = result.length - 1; for (int i = 0; i &lt; lastIndex; i++) { splitpoint = mText.lastIndexOf(' ' ,j+charLimit); splitpoint = splitpoint &gt; j+charLimit-tolerance ? splitpoint:j+charLimit; result[i] = mText.substring(j, splitpoint); j = splitpoint; } result[…
downvote count: 0
has comment: http://stackoverflow.com/comment/39639529
type: AcceptedAnswer

http://stackoverflow.com/a/25485361
has comment: http://stackoverflow.com/comment/39775950
answers question: http://stackoverflow.com/q/25485271
type: Answer
has body: If you go with Case 1, and you already have client code written against the type A, it will fail to work with instances of classes which implement B, and for a purely red-tape reason: B is conceptually an extension of A, but modeled in the Java type system as a disparate type. Example: static void existingMethod(A a) { ...work with a ... } class ImplB implements B { ... } public static void main(String... args) { B b = new B(); existingMethod(b); // compile error for Case 1; Case 2 compiles fine. } Therefore it would make much more sense to have your B type extend A.
score: 1
downvote count: 0
upvote count: 1

http://stackoverflow.com/a/25468864
has body: There is a caching technique used by the JVM for some range of autoboxing value. As specified in the spec ( http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.1.7 ) If the value p being boxed is true, false, a byte, or a char in the range \u0000 to \u007f, or an int or short number between -128 and 127 (inclusive), then let r1 and r2 be the results of any two boxing conversions of p. It is always the case that r1 == r2. Ideally, boxing a given primitive value p, would always yield an identical reference. In practice, this may not be feasible using existing implementation techniques. The rules above are a pragmatic compromise. The final clause above requires that certain common values always be boxed into indistinguishable objects. The implementation may cache these, lazily or eagerly. For other values, this formulation disallows any assumptions about the identity of the boxed values on the programmer's part. This would allow (but not require) sharing of some or all of these references. This ensures that in most common cases, the behavior will be the desired one, without imposing an undue performance penalty, especially on small devices. Less memory-limited implementations might, for example, cache all char and short values, as well as int and long values in the range of -32K to +32K. So 1L is in this cached values and then the autoboxing give the exact same reference, but in the case of the number outside of this range (like the Long.MIN_VALUE) it isn'T cached and thus a different instance/reference is given. In any case, when comparing object you should always use .equals()
accepted answer of: http://stackoverflow.com/q/25468794
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25468794
downvote count: 0
type: AcceptedAnswer
score: 4

http://stackoverflow.com/comment/39783225
type: Comment
score: 0
has text: Hey. I didnt get time to try it out but it should be compatible with node js version 1.0+ as I read on posts on stackoverflow. If you are trying it out then do give me feedback as well.
type: AnswerComment
comment on: http://stackoverflow.com/a/25450699

http://stackoverflow.com/q/25488626
has comment: http://stackoverflow.com/comment/39782692
tagged with: java
tagged with: subtraction
has comment: http://stackoverflow.com/comment/39783196
type: Question
type: UnansweredQuestion
has body: how could i subtract a value based on the input on the text field directly to my database? and how can i execute two queries at the same time i tried doing this but i had no luck heres the code i am trying to execute String sql1 = "select seat from passenger_details where seat = '"+seats+"'"; resultset = statement.executeQuery(sql1); int count = 0; while(resultset.next()) { count = count + 1; } if(cc.equals("")||add.equals("")) { JOptionPane.showMessageDialog(null,"Please Complete the form"); } else { sql1 = "INSERT INTO passenger_details(fname,lname,gender,address,cc_no,bank_name,no_of_tickets,seat) VALUES('"+fnm+"','"+lnm+"','"+gnd+"','"+add+"','"+cc+"','"+bank+"','"+tckts+"','"+seats+"'),('"+fnm+"','"+lnm+"','"+gnd+"','"+add+"','"+cc+"','"+bank+"','"+tckts+"','"+seats2+"'),('"+fnm+"','"+lnm+"','"+gnd+"','"+add+"','"+cc+"','"+bank+"','"+tckts+"','"+seats3+"'),('"+fnm+"','"+lnm+"','"+gnd+"','"+add+"','"+cc+"','"+bank+"','"+tckts+"','"+seats4+"'),('"+fnm+"','"+lnm+"','"+gnd+"','"+add+"','"+cc+"','"+bank+"','"+tckts+"','"+seats5+"')"; String sql2 = "Update flight_details set seats_avail= seats_avail-'"+tckts+" Where route_name = '"+dest+"'"; statement.addBatch(sql1); statement.addBatch(sql2); statement.executeBatch(); JOptionPane.showMessageDialog(null,"Sucess"); }
tagged with: database
has comment: http://stackoverflow.com/comment/39782335
score: 0
answer count: 0
has title: Java - Subtracting Value from database and executing multiple queries

http://stackoverflow.com/comment/39609204
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25393995
has text: If you add driver.manage.refresh() (believe thats the call) does it work if you refresh page?
type: Comment

http://stackoverflow.com/comment/39862871
score: 0
comment on: http://stackoverflow.com/a/25517234
type: AnswerComment
has text: do you have any other suggestions?
type: Comment

http://stackoverflow.com/a/25436352
has comment: http://stackoverflow.com/comment/39685176
accepted answer of: http://stackoverflow.com/q/25436285
has comment: http://stackoverflow.com/comment/39685060
has comment: http://stackoverflow.com/comment/39685296
has comment: http://stackoverflow.com/comment/39685237
type: Answer
has comment: http://stackoverflow.com/comment/39685246
score: 0
has body: Why not just go with position.x = ballPong.getPosition().x; ?
has comment: http://stackoverflow.com/comment/39685126
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25436285

http://stackoverflow.com/comment/39736975
type: Comment
type: QuestionComment
has text: Your repository may find results but that doesn't mean the `categoryList` field gets initialized. AFAIK when working with Hibernate one always needs to initialize collections.
comment on: http://stackoverflow.com/q/25464181
score: 0

http://stackoverflow.com/comment/39727452
comment on: http://stackoverflow.com/q/25459014
type: Comment
type: QuestionComment
score: 0
has text: Exception in thread "main" java.lang.NullPointerException at com.unicyde.mixell.flow.Flow.clearColons(Flow.java:190) at com.unicyde.mixell.flow.Flow.declareVar(Flow.java:164) at com.unicyde.mixell.flow.Flow.keywordSwitcher(Flow.java:118) at com.unicyde.mixell.flow.Flow.mainLoop(Flow.java:95) at com.unicyde.mixell.flow.Flow.main(Flow.java:68) Java Result: 1

http://stackoverflow.com/comment/39846187
type: AnswerComment
has text: I edited the question after your answer, Now can you tell me about writing the driver for my printer to print according to my need.
score: 0
comment on: http://stackoverflow.com/a/25422332
type: Comment

http://stackoverflow.com/comment/39739080
comment on: http://stackoverflow.com/a/25465235
score: 0
type: AnswerComment
has text: @IsraelCohen You _probably_ could use some functor type and roll your own style of control flow, but you wouldn't be able to change the fundamentals of the JVM. _What is your use case here? Why do you want to do this?_
type: Comment

http://stackoverflow.com/comment/39798165
has text: Can you provide some example code? I have very minimal exp with OAuth and JSON
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25496729
score: 0

http://stackoverflow.com/comment/39754115
has text: Show us some code with context on what exactly you're having trouble with. Multiple types of local classes exist.
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25473649

http://stackoverflow.com/q/25409963
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/39635816
has answer: http://stackoverflow.com/a/25410023
type: Question
accepted answer: http://stackoverflow.com/a/25410023
answer count: 1
has comment: http://stackoverflow.com/comment/39635866
has title: ProgressBar inside of Fragment class causing NullPointerException at setMax method?
type: AnsweredQuestion
score: 0
tagged with: nullpointerexception
tagged with: android-fragments
has body: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.analogin_fragment, container, false); AITVVOLT0 = (TextView) rootView.findViewById(R.id.aintvvolt0); AITVVOLT1 = (TextView) rootView.findViewById(R.id.aintvvolt1); AITVVOLT2 = (TextView) rootView.findViewById(R.id.aintvvolt2); AITVVOLT3 = (TextView) rootView.findViewById(R.id.aintvvolt3); AITVVOLT4 = (TextView) rootView.findViewById(R.id.aintvvolt4); AITVVOLT5 = (TextView) rootView.findViewById(R.id.aintvvolt5); AIVOLTBAR0 = (ProgressBar) rootView.findViewById(R.id.aintvvoltbar0); AIVOLTBAR0 = (ProgressBar) rootView.findViewById(R.id.aintvvoltbar1); AIVOLTBAR0 = (ProgressBar) rootView.findViewById(R.id.aintvvoltbar2); AIVOLTBAR0 = (ProgressBar) rootView.findViewById(R.id.aintvvoltbar3); AIVOLTBAR0 = (ProgressBar) rootView.findViewById(R.id.aintvvoltbar4); AIVOLTBAR0 = (ProgressBar) rootView.findViewById(R.id.aintvvoltbar5); AIVOLTBAR0.setMax(100); AIVOLTBAR1.setMax(100); AIVOLTBAR2.setMax(100); AIVOLTBAR3.setMax(100); AIVOLTBAR4.setMax(100); AIVOLTBAR5.setMax(100); AIVOLTBAR0.setProgress(0); AIVOLTBAR1.setProgress(0); AIVOLTBAR2.setProgress(0); AIVOLTBAR3.setProgress(0); AIVOLTBAR4.setProgress(0); AIVOLTBAR5.setProgress(0); return rootView; } The AIVOLTBAR#.setMax(); methods are causing a NullPointerException - but the ProgressBars are not null (Tested with a log as well as commenting out the setMax causes the program to work). Logcat: 08-20 16:23:18.409: E/AndroidRuntime(1332): Process: com.nanospark.androidapp, PID: 1332 08-20 16:23:18.409: E/AndroidRuntime(1332): java.lang.NullPointerException 08-20 16:23:18.409: E/AndroidRuntime(1332): at com.nanospark.androidapp.MainActivity$AnalogInputFragment.onCreateView(MainActivity.java:218) 08-20 16:23:18.409: E/AndroidRuntime(1332): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 08-20 16:23:18.409: E/AndroidRuntime(1332): at android.support.v4.ap…
tagged with: android-progressbar

http://stackoverflow.com/comment/39676249
comment on: http://stackoverflow.com/q/25431721
score: 2
type: Comment
type: QuestionComment
has text: When you have a file that big, maybe its a good idea to not keep it whole in memory.

http://stackoverflow.com/comment/39623796
type: QuestionComment
comment on: http://stackoverflow.com/q/25403765
score: 0
has text: `batch` file for `Linux` is generally called `script` in Linux!
type: Comment

http://stackoverflow.com/comment/39657101
comment on: http://stackoverflow.com/q/25421016
has text: @DanishAshfaq I agree in principle, but the OP wants to be able to create one button per item in the list/table. If the list is huge and you create them directly instead of on demand, you might run into other problems.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25477423
downvote count: 0
has comment: http://stackoverflow.com/comment/39763393
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/39763739
accepted answer: http://stackoverflow.com/a/25479798
has answer: http://stackoverflow.com/a/25479798
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/438146
tagged with: spring
tagged with: spring-mvc
has title: How to deploy application updates to a production Spring/Hibernate Application?
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/221379
has body: Up until this point, I've been using Spring in a development mode of sorts with hbmddl2 properties which drop all the tables and start again when I deploy the application to glassfish. It works well as a development config, since I know exactly what my database is going to contain when I run my app. However, this isn't appropriate for an application with a rolling release cycle and I'm not exactly sure how to proceed in changing it so it would be suitable in a production environment. Googling it just gives me resources on how to update Spring or Hibernate itself, but nothing on maintaining a server. I'm getting the feeling I'm going to have to start creating XML object property mappings for Hibernate, but I think that's a little over the top when all I want to do is update a schema with new tables and new columns with default values. Thanks in advance for any answers, I'm completely stuck on this.
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/25486301
has answer: http://stackoverflow.com/a/25486517
has body: I'm not sure why, but when I execute this code, I have to enter a number twice before the code will move on to the next piece, while it should only need to be entered once. import java.util.Scanner; public class Rectangle { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Scanner reader = new Scanner(System.in); double l; //length double w; //width double p; //perimeter double a; //area boolean r = true; boolean run = true; System.out.print("Please Enter the Length of the Rectangle: "); do { l = scanner.nextDouble(); if (!(scanner.hasNextDouble())) { System.out.println("Please Enter A Number"); scanner.next(); } else if (l &lt;= 0) { System.out.println("Please Enter a Number Which Is Greater Than 0"); scanner.next(); } else { double length = l; System.out.print("Please Enter the Width of the Rectangle: "); w = reader.nextDouble(); if (!(reader.hasNextDouble())) { System.out.println("Please Enter A Number"); reader.next(); run = true; } else if (w &lt;= 0) { System.out.println("Please Enter a Number Which Is Greater Than 0"); reader.next(); run = true; } else { double width = w; r = false; } a = l * w; p = (2 * l) + (2 * w); System.out.println("The Area of the Rectangle is " + a); System.out.println("The Perimeter of the Rectangle is " + p); run = false; break; } } while (run); } }
has answer: http://stackoverflow.com/a/25486516
type: Question
has comment: http://stackoverflow.com/comment/39777159
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39777395
has answer: http://stackoverflow.com/a/25486548
has title: bug which makes me enter data twice
answer count: 4
has answer: http://stackoverflow.com/a/25487569
score: 0

http://stackoverflow.com/a/25426661
type: Answer
score: 0
type: AcceptedAnswer
has body: I found this in documentation, probably this is the problem: public int updatePeriodMillis Added in API level 3 How often, in milliseconds, that this AppWidget wants to be updated. The AppWidget manager may place a limit on how often a AppWidget is updated. This field corresponds to the android:updatePeriodMillis attribute in the AppWidget meta-data file. Note: Updates requested with updatePeriodMillis will not be delivered more than once every 30 minutes. I also found that there is a huge bug in android framework making configuration activity useless: https://code.google.com/p/android/issues/detail?id=3696
accepted answer of: http://stackoverflow.com/q/25421748
answers question: http://stackoverflow.com/q/25421748

http://stackoverflow.com/q/25527256
tagged with: spring
has comment: http://stackoverflow.com/comment/39854881
has comment: http://stackoverflow.com/comment/39854198
has comment: http://stackoverflow.com/comment/39853316
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/25522309
score: 0
has body: I am using Spring MVC 3.2.2.RELEASE, and this is my first attempt at using Spring's Java based configuration (@Configuration). I have a controller that I use to handle certain files. The content of the files is read by my service method MyContentService.getResource(String). At the moment, the content type is always text/html. How can I config my Spring MVC application so that it correctly sets the type of the content returned? The content type can only be determined at runtime. My controller at the moment, which incorrectly always sets the type to text/html: @Controller public class MyContentController { MyContentService contentService; @RequestMapping(value = "content/{contentId}") @ResponseBody public byte[] index(@PathVariable String contentId) { return contentService.getResource(contentId); } } EDIT: The following method works (with PNG and JPEG files), but I am not comfortable with URLConnection determining the content type (e.g. PDF, SWF, etc): @RequestMapping(value = "content/{contentId}/{filename}.{ext}") public ResponseEntity&lt;byte[]&gt; index2(@PathVariable String contentId, @PathVariable String filename, @PathVariable String ext, HttpServletRequest request) throws IOException { byte[] bytes = contentService.getResource(contentId); String mimeType = URLConnection.guessContentTypeFromName(filename + "." + ext); if (mimeType != null) { final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.valueOf(mimeType)); return new ResponseEntity&lt;byte[]&gt;(bytes, headers, HttpStatus.OK); } else { logger.warn("Unable to determine the mimeType for " + getRequestedUrl(request)); return new ResponseEntity&lt;byte[]&gt;(HttpStatus.NOT_FOUND); } }
tagged with: java
has comment: http://stackoverflow.com/comment/39854279
answer count: 1
tagged with: web-applications
has comment: http://stackoverflow.com/comment/39853302
has answer: http://stackoverflow.com/a/25528470
has comment: http://stackoverflow.com/comment/39854582
type: Question
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/51438
has comment: http://stackoverflow.com/comment/39853315
has title: Spring MVC - setting the content type of a byte[] @ResponseBody

http://stackoverflow.com/a/54182248
type: Answer
has body: I also had this issue. I'm using IntelliJ IDEA. I was using src/main/java for configuration files and src/test/java for test files. Because of this testNG couldn't find the class path. To prevent getting that error need to move all the files from src/main/java to src/test/java or vice versa.
answers question: http://stackoverflow.com/q/25543910
score: 0

http://stackoverflow.com/q/25547365
has answer: http://stackoverflow.com/a/39978814
type: AnsweredQuestion
has body: I want to perform search action on entered string. whatever user enter it should search on first name and last name column. //pseudo hql query Select E.someproperty .... from Entity E where upper(E.firstName || '' || E.lastName) like upper(+userEntered+'%') // In above code I combined two column and did search on it. I want similar functionality using hibernate criteria. I have tried following query but it didn`t work empCriteria.add(Restrictions.disjunction().add(Restrictions.ilike("firstName", userEntered, MatchMode.START)).add(Restrictions.ilike("lastName", userEntered, MatchMode.START))); I know it is just or condition..please let me know is there way to combine two column and do search on using criteria query
score: 1
has title: combining 2 or more properties in Hibernate Restrictions criteria query
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/25547704
downvote count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25547704
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39889810
has comment: http://stackoverflow.com/comment/39890030
possible better answer: http://stackoverflow.com/a/50759541
has answer: http://stackoverflow.com/a/50759541
has answer: http://stackoverflow.com/a/25547651
linked to: http://stackoverflow.com/q/17910428
answer count: 4

http://stackoverflow.com/comment/39678938
comment on: http://stackoverflow.com/q/25433224
score: 0
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/5171477/how-does-or-is-it-possible-E.g. for-a-browser-keep-track-of-a-pop-up-window

http://stackoverflow.com/a/25473636
has comment: http://stackoverflow.com/comment/39754761
has comment: http://stackoverflow.com/comment/39754820
answers question: http://stackoverflow.com/q/25473569
has comment: http://stackoverflow.com/comment/39755040
has comment: http://stackoverflow.com/comment/39754935
has comment: http://stackoverflow.com/comment/39754566
type: Answer
has comment: http://stackoverflow.com/comment/39754593
accepted answer of: http://stackoverflow.com/q/25473569
has comment: http://stackoverflow.com/comment/39755156
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39754995
downvote count: 0
upvote count: 1
has body: Make the method inside of SeparateClass static: public static String myMethod(String path) { ... } Then from your activity call the myMethod like this: SeparateClass.myMethod(myPathString); If that's not enough you can import the method in your MainActivity: import static com.mypackage.SeparateClass.myMethod; And then you can use the method without any class reference: myMethod();
has comment: http://stackoverflow.com/comment/39754504
has comment: http://stackoverflow.com/comment/39754554

http://stackoverflow.com/q/25446660
has title: How to use Exit button in Swing Application?
has comment: http://stackoverflow.com/comment/39703001
tagged with: swing
linked to: http://stackoverflow.com/q/258099
has answer: http://stackoverflow.com/a/25446816
has answer: http://stackoverflow.com/a/25448201
has answer: http://stackoverflow.com/a/25446935
downvote count: 0
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/25446732
tagged with: java
linked to: http://stackoverflow.com/q/1234912
has comment: http://stackoverflow.com/comment/39703085
tagged with: eclipse
has comment: http://stackoverflow.com/comment/39703496
favorite count: 0
has comment: http://stackoverflow.com/comment/39703326
type: Question
has answer: http://stackoverflow.com/a/25446952
has comment: http://stackoverflow.com/comment/39702947
answer count: 5
type: UnansweredQuestion
has body: I am new in Java Form Application development using Swing. What is the suitable code for exit button that will exit the application? For example: In C# (.NET Framework) we use Application.Exit(); as the code for exit what button. What is the equivalent code in Java to exit an application?

http://stackoverflow.com/comment/39883720
score: 0
type: AnswerComment
type: Comment
has text: I was avoiding to use query parameters, since that forces me to change my code to include a placeholder for maven to replace. It also forces to pollute code with the versioning, which I feel is a cross-cutting concern that shouldn't be hardcoded in all my files (of course I'll do it if I can't find any other way). The Last-Modified header with mvc:resources seems to be what I want. I'll give it a try. Thanks
comment on: http://stackoverflow.com/a/25534206

http://stackoverflow.com/comment/39608210
has text: How can you have a variable number of columns? It doesn't really make sense, can you provide an example/use case
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25395016
type: QuestionComment

http://stackoverflow.com/comment/39878726
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25540751
has text: u can read that data then stored into the string and merge the other string with it and write it :)
score: 0

http://stackoverflow.com/comment/39673122
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25429930
type: Comment
has text: menuItems4 = new ArrayList<HashMap<String, String>>();

http://stackoverflow.com/a/25540940
answers question: http://stackoverflow.com/q/25539064
type: Answer
accepted answer of: http://stackoverflow.com/q/25539064
has body: Had to set encoding style to utf-8 before sending to foursquare server: req.setEntity(new UrlEncodedFormEntity(params, "utf-8")); ... where req is an HttpPost object, and params is a List object.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/39700566
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25444927
score: 0
has text: @Squonk thanks but i need to ask. Is it appropriate to do something in useResults then fork to onReceive and continue and finish all the rest application logic in onReceive? I think there must be there should be a cleaner way?

http://stackoverflow.com/q/25492566
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25493043
has answer: http://stackoverflow.com/a/25493043
tagged with: java
has title: Java transitive dependency issue with no working resolution
possible better answer: http://stackoverflow.com/a/25492943
answer count: 4
type: Question
score: 2
upvote count: 2
downvote count: 0
has body: I am using Maven to manage my project dependencies. My dependency tree has a conflict on package B like like: A -&gt; B (v1.4) C -&gt; B (v1.5) It turns out that package A depended on a bug that was fixed in v1.5, and package C requires functionality from 1.5 that was not in 1.4. How do large java projects with tons of dependencies manage these types of issues? Even if package A appeared to work on a surface level with v1.5, I still feel like it would be risky to assume in all edge cases it will work as it did before. Note that this is a hypothetical situation, so it is not necessary to know which packages these represent.
has answer: http://stackoverflow.com/a/25492611
tagged with: maven
favorite count: 0
has answer: http://stackoverflow.com/a/25492943
has answer: http://stackoverflow.com/a/25494102

http://stackoverflow.com/q/25489145
tagged with: java
tagged with: outputstream
has comment: http://stackoverflow.com/comment/39794099
has title: ObjectOutputStream not sending data (server stuck at socket.accept())
has comment: http://stackoverflow.com/comment/39784081
tagged with: objectoutputstream
accepted answer: http://stackoverflow.com/a/25491398
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25497614
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25491398
has answer: http://stackoverflow.com/a/25497614
upvote count: 1
has comment: http://stackoverflow.com/comment/39783710
downvote count: 1
has comment: http://stackoverflow.com/comment/39784309
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39785054
has body: I am trying to send an object over a connection using Java. This is my client side code. The server receives the data the first time, but the second time is stuck at socket.accept(). Am i doing something wrong here? Thank you! public class Client { public static void main(String args[]) { try { Socket socket = new Socket("localhost", 40003); ClientObject c = new ClientObject(socket); c.init(); } catch (Exception e) { e.printStackTrace(); } } } class ClientObject { Socket socket; public ClientObject(Socket socket) { this.socket = socket; } public void init() { try { // computation SendObject so = new SendObject(toSend1, toSend2, rand, username.length()); // send all of this OutputStream o = socket.getOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(o); oos.writeObject(so); o.flush(); InputStream i = socket.getInputStream(); ObjectInputStream ois = new ObjectInputStream(i); // works, data received from the server so = (SendObject)ois.readObject(); // further computation so = new SendObject(null, digest, rand + 1, -1); oos.reset(); oos.writeObject(so); // doesn't work :( o.flush(); } }
has comment: http://stackoverflow.com/comment/39783775
tagged with: sockets